mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-10 17:30:29 +00:00
4f66ac79d3
- Move redstone methods out of the IAPIEnvironment, and into a new RedstoneAccess. We similarly move the implementation from Environment into a new RedstoneState class. The interface is possibly a little redundant (interfaces with a single implementation are always a little suspect), but it's nice to keep the consumer/producer interfaces separate. - Abstract most redstone API methods into a separate shared class, that can be used by both the rs API and the new redstone relay. - Add the new redstone relay block. The docs are probably a little lacking here, but I really struggled to write anything which wasn't just "look, it's the same as the redstone API".
28 lines
589 B
Markdown
28 lines
589 B
Markdown
---
|
|
module: [kind=event] redstone
|
|
---
|
|
|
|
<!--
|
|
SPDX-FileCopyrightText: 2021 The CC: Tweaked Developers
|
|
|
|
SPDX-License-Identifier: MPL-2.0
|
|
-->
|
|
|
|
The [`event!redstone`] event is fired whenever any redstone inputs on the computer or [relay][`redstone_relay`] change.
|
|
|
|
## Return values
|
|
1. [`string`]: The event name.
|
|
|
|
## Example
|
|
Prints a message when a redstone input changes:
|
|
```lua
|
|
while true do
|
|
os.pullEvent("redstone")
|
|
print("A redstone input has changed!")
|
|
end
|
|
```
|
|
|
|
## See also
|
|
- [The `redstone` API on computers][`module!redstone`]
|
|
- [The `redstone_relay` peripheral][`redstone_relay`]
|