@name CarAccessories @inputs Light Brake LeftIndicator RightIndicator @outputs [BrakeLights HeadLights LeftIndicators RightIndicators]:vector @persist [HLDefault BLDefault ILDefault]:vector HLOn LIOn RIOn RI LI if( first() ){ HLDefault = vec(255,208,150) BLDefault = vec(255,0,0) ILDefault = vec(255,200,80) function lights(){ if( Light ){ HLOn = !HLOn if( HLOn ){ HeadLights = HLDefault }else{ HeadLights = vec() } } } function brake(){ if( Brake ){ BrakeLights = BLDefault }else{ BrakeLights = vec() } } function leftIndStart(){ timer("LeftInd",0) } function leftIndStop(){ stoptimer("LeftInd") LeftIndicators = vec() } function rightIndStart(){ timer("RightInd",0) } function rightIndStop(){ stoptimer("RightInd") RightIndicators = vec() } function indicators(){ if( LeftIndicator ){ LIOn = !LIOn if( LIOn ){ leftIndStart() }else{ leftIndStop() } } if( RightIndicator ){ RIOn = !RIOn if( RIOn ){ rightIndStart() }else{ rightIndStop() } } } } if( inputClk() ){ lights() brake() indicators() } if( clk("LeftInd") ){ LI = !LI if( LI ){ LeftIndicators = ILDefault }else{ LeftIndicators = vec() } timer("LeftInd",350) } if( clk("RightInd") ){ RI = !RI if( RI ){ RightIndicators = ILDefault }else{ RightIndicators = vec() } timer("RightInd",350) }