five-on-it / packages/ai/src/traffic / switchSignal
Function: switchSignal()
switchSignal(
ai,x,z,state,axis?,seconds?):number
Defined in: packages/ai/src/traffic.ts:424
Switches the signalled junction nearest a point (within 30 m) by hand: green for the approaches along an axis (red for the others), red for all, flashing amber, or back to its plan (auto); for so many seconds, or until switched again (none). Returns the junction's index in the signals, or −1 with none near.
Parameters
ai
x
number
z
number
state
SignalState | "auto"
axis?
SignalAxis = 'north-south'
seconds?
number
Returns
number