mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-03 02:47:56 +00:00
Allow peripherals to have multiple types (#963)
Peripherals can now have multiple types: - A single primary type. This is the same as the current idea of a type - some identifier which (mostly) uniquely identifies this kind of peripheral. For instance, "speaker" or "minecraft:chest". - 0 or more "additional" types. These are more like traits, and describe what other behaviour the peripheral has - is it an inventory? Does it supply additional peripherals (like a wired modem)?. This is mostly intended for the generic peripheral system, but it might prove useful elsewhere too - we'll have to see! - peripheral.getType (and modem.getTypeRemote) now returns 1 or more values, rather than exactly one. - Add a new peripheral.hasType (and modem.hasTypeRemote) function which determines if a peripheral has the given type (primary or additional). - Change peripheral.find and all internal peripheral methods to use peripheral.hasType instead. - Update the peripherals program to show all types This effectively allows you to do things like `peripheral.find("inventory")` to find all inventories. This also rewrites the introduction to the peripheral API, hopefully making it a little more useful.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
module: [kind=event] redstone
|
||||
---
|
||||
|
||||
The @{redstone} event is fired whenever any redstone inputs on the computer change.
|
||||
The @{event!redstone} event is fired whenever any redstone inputs on the computer change.
|
||||
|
||||
## Example
|
||||
Prints a message when a redstone input changes:
|
||||
|
Reference in New Issue
Block a user