Skip to content

[Archive] Trafficlight

Thomas--S edited this page Feb 21, 2017 · 1 revision

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.

Setup

A basic setup might look like this: Basic trafficlight setup

A more advanced setup: Advanced trafficlight 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).

Coding

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!

Trafficlight states and rythms

RED

  1. yellow (3s)
  2. red

GREEN

  1. red-yellow (1.5s)
  2. green

WARN

  1. warn

OFF

  1. warn (5s)
  2. off
Clone this wiki locally