Add terminal temporary screen light

This commit is contained in:
2024-11-07 19:17:38 +00:00
parent cbc21dbca7
commit efcd3bd84a
3 changed files with 97 additions and 81 deletions
+14 -1
View File
@@ -24,10 +24,23 @@ updateMachine mc
mcTypeUpdate :: Machine -> World -> World
mcTypeUpdate mc = case mc ^. mcType of
McStatic -> id
McTerminal -> id
McTerminal -> terminalScreenGlow mc
McTurret tu -> updateTurret (_tuTurnSpeed tu) mc
McSensor se -> mcSensorTriggerUpdate se mc . mcSensorUpdate se mc
terminalScreenGlow :: Machine -> World -> World
terminalScreenGlow mc w = fromMaybe w $ do
tid <- mc ^? mcMounts . ix ObTerminal
term <- w ^? cWorld . lWorld . terminals . ix tid
guard (_tmStatus term /= TerminalOff)
let V4 x y z _ = _tmScreenColor term
return $ w & cWorld . lWorld . tempLightSources .:~ TLS
{ _tlsParam = LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
, _tlsUpdate = TimerTLS
, _tlsTime = 1
}
updateTurret :: Float -> Machine -> World -> World
updateTurret rotSpeed mc w =
w