mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-17 07:14:51 +00:00
53811f8169
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.
15 lines
286 B
Markdown
15 lines
286 B
Markdown
---
|
|
module: [kind=event] redstone
|
|
---
|
|
|
|
The @{event!redstone} event is fired whenever any redstone inputs on the computer change.
|
|
|
|
## Example
|
|
Prints a message when a redstone input changes:
|
|
```lua
|
|
while true do
|
|
os.pullEvent("redstone")
|
|
print("A redstone input has changed!")
|
|
end
|
|
```
|