-
Notifications
You must be signed in to change notification settings - Fork 17
[Archive] Trafficlight
IMPORTANT: This wiki page is for the old trafficlight system.
Trafficlights can be controlled with the digilines (some kind of data wire) of Jeija's mod digilines.
A basic setup might look like this:
A more advanced setup:
The trafficlights aim at being as flexible while good-looking as possible. To achieve this, they can be placed whereever you want. Nevertheless, I recommend to put them on poles which conduct digiline signals to the trafficlights around them. If your digiline signals come from underground, you can use the digiline distributor to conduct them up (as seen in the simple setup).
To make the trafficlights actually do something, they have to be coded with a luacontroller. Link them as seen in Basic setup, and give them a channel by right-clicking. A trafficlight basicly knows 5 commands:
- OFF
- RED
- GREEN
- WARN
- GET
Each of them represents a trafficlight state and might also contain a "trafficlight rythm" (a rythm defines what happens before the final state is reached, e.g. RED switches to yellow first, then to red).
To make it show some lights, you just have to send one of the five commands to it:
digiline_send("channel", "RED")
Of course you have to replace channel with the channel you gave the trafficlight when you set it up. Don't forget to replace RED with the command you actually want to see!
Did you notice that GET doesn't change the state? Whenever you send GET on channel XY, the trafficlights answers with its state on the same channel. Useful, isn't it?
Your trafficlight changed its state? Great, now you know everything important about trafficlight coding!
- yellow (3s)
- red
- red-yellow (1.5s)
- green
- warn
- warn (5s)
- off