This commit is contained in:
2024-11-07 19:45:53 +00:00
parent efcd3bd84a
commit 216d55865f
3 changed files with 30 additions and 25 deletions
+18 -13
View File
@@ -1,4 +1,6 @@
module Dodge.Machine.Update where
module Dodge.Machine.Update (
updateMachine,
) where
import Control.Monad
import Data.List (partition)
@@ -34,12 +36,13 @@ terminalScreenGlow mc w = fromMaybe w $ do
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
}
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 =
@@ -102,9 +105,11 @@ mcPlaySound mc w = case _mcCloseSound mc of
mcApplyDamage :: [Damage] -> Machine -> World -> World
mcApplyDamage ds mc = case mc ^? mcType . _McSensor of
Nothing -> mcpointer
Nothing ->
mcpointer
%~ ((mcDamage .~ []) . (mcHP -~ sum (map _dmAmount ds)))
_ -> mcpointer
_ ->
mcpointer
%~ (mcDamage .~ [])
where
mcpointer = cWorld . lWorld . machines . ix (_mcID mc)
@@ -161,7 +166,7 @@ senseDamage threshold dt mc =
lsid <- mc ^? mcMounts . ix ObLightSource
return $ cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol .~ V3 ni ni ni
damageUsing :: DamageType -> Damage -> Either Int Int
damageUsing dt dm
| _dmType dm == dt = Left $ _dmAmount dm
| otherwise = Right 0
--damageUsing :: DamageType -> Damage -> Either Int Int
--damageUsing dt dm
-- | _dmType dm == dt = Left $ _dmAmount dm
-- | otherwise = Right 0