five-on-it / apps/client/src/renderer/signal-lamps
apps/client/src/renderer/signal-lamps
The traffic lights' lamps: a lit cap on the signal head of every traffic light that rules a junction (@foi/world's buildSignals), red, amber or green as the junction's fixed plan says for the light's approaches at the tick drawn. Nothing about the lights comes over the wire but a mission's switch by hand of a junction (setOverrides, from the server's signals message): the plan is the level's and the tick's, the one the server's drivers obey (the decision is in packages/ai/README.md); a switched junction shows what its switch says, a flashing one blinks amber. A light knocked loose goes dark. Each cap is an instance of one of three unlit boxes (one per colour) hung under the light's own node, so it flies off with the piece; the three caps of a light take turns being shown.