Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
+12
-12
@@ -36,7 +36,7 @@ updateTurret rotSpeed mc w =
|
||||
& elecDamBranch
|
||||
where
|
||||
dodamage =
|
||||
cWorld . machines . ix mcid
|
||||
cWorld . lWorld . machines . ix mcid
|
||||
%~ ( (mcDamage .~ [Damage ELECTRICAL (min 2500 $ max 0 (elecDam - 10)) 0 0 0 NoDamageEffect])
|
||||
. (mcHP -~ dam)
|
||||
)
|
||||
@@ -51,12 +51,12 @@ updateTurret rotSpeed mc w =
|
||||
dam = sum $ map _dmAmount dams
|
||||
elecDam = sum $ map _dmAmount elecDams
|
||||
doTurn
|
||||
| seesYou = cWorld . machines . ix mcid . mcType . _McTurret . tuDir %~ turnTo rotSpeed mcpos ypos
|
||||
| seesYou = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuDir %~ turnTo rotSpeed mcpos ypos
|
||||
| otherwise = id
|
||||
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
|
||||
updateFiringStatus
|
||||
| closeFireAngle = cWorld . machines . ix mcid . mcType . _McTurret . tuFireTime .~ 20
|
||||
| otherwise = cWorld . machines . ix mcid . mcType . _McTurret . tuFireTime %~ (max 0 . subtract 1)
|
||||
| closeFireAngle = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime .~ 20
|
||||
| otherwise = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime %~ (max 0 . subtract 1)
|
||||
|
||||
mcUseItem :: Machine -> World -> World
|
||||
mcUseItem mc = fromMaybe id $ do
|
||||
@@ -70,7 +70,7 @@ mcSensorTriggerUpdate :: Sensor -> Machine -> World -> World
|
||||
mcSensorTriggerUpdate se mc = fromMaybe id $ do
|
||||
trid <- mc ^? mcMounts . ix ObTrigger
|
||||
bval <- mcTriggerVal se
|
||||
return $ cWorld . triggers . ix trid ||~ bval
|
||||
return $ cWorld . lWorld . triggers . ix trid ||~ bval
|
||||
|
||||
mcTriggerVal :: Sensor -> Maybe Bool
|
||||
mcTriggerVal se = case se of
|
||||
@@ -94,7 +94,7 @@ mcApplyDamage ds mc = case mc ^? mcType . _McSensor of
|
||||
_ -> mcpointer
|
||||
%~ (mcDamage .~ [])
|
||||
where
|
||||
mcpointer = cWorld . machines . ix (_mcID mc)
|
||||
mcpointer = cWorld . lWorld . machines . ix (_mcID mc)
|
||||
|
||||
mcSensorUpdate :: Sensor -> Machine -> World -> World
|
||||
mcSensorUpdate se mc w = case se of
|
||||
@@ -110,13 +110,13 @@ mcProximitySensorUpdate mc w = case ( _proxStatus sens
|
||||
(_, True, _, _) -> w
|
||||
(_, False, True, True) ->
|
||||
w
|
||||
& cWorld . machines . ix (_mcID mc) . mcType . _McSensor . sensToggle .~ True
|
||||
& cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McSensor . sensToggle .~ True
|
||||
& playsound dedaS
|
||||
& cWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ IsClose
|
||||
& cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ IsClose
|
||||
(NotClose, _, False, True) ->
|
||||
w & playsound dedumS
|
||||
& cWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ IsClose
|
||||
(_, _, _, False) -> w & cWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ NotClose
|
||||
& cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ IsClose
|
||||
(_, _, _, False) -> w & cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McSensor . proxStatus .~ NotClose
|
||||
_ -> w
|
||||
where
|
||||
playsound sid = soundContinue (MachineAltSound (_mcID mc)) (_mcPos mc) sid Nothing
|
||||
@@ -133,7 +133,7 @@ mcProxTest mc w = case mc ^? mcType . _McSensor . proxRequirement of
|
||||
|
||||
senseDamage :: Int -> DamageType -> Machine -> World -> World
|
||||
senseDamage threshold dt mc =
|
||||
(cWorld . machines . ix mcid %~ upmc)
|
||||
(cWorld . lWorld . machines . ix mcid %~ upmc)
|
||||
. updatels
|
||||
where
|
||||
upmc = mcType . _McSensor . sensAmount %~ min (100 * threshold) . max 0 . (+ newsense)
|
||||
@@ -146,7 +146,7 @@ senseDamage threshold dt mc =
|
||||
ni = fromIntegral (mc ^?! mcType . _McSensor . sensAmount) / fromIntegral threshold
|
||||
updatels = fromMaybe id $ do
|
||||
lsid <- mc ^? mcMounts . ix ObLightSource
|
||||
return $ cWorld . lightSources . ix lsid . lsParam . lsCol .~ V3 ni ni ni
|
||||
return $ cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol .~ V3 ni ni ni
|
||||
|
||||
damageUsing :: DamageType -> Damage -> Either Int Int
|
||||
damageUsing dt dm
|
||||
|
||||
Reference in New Issue
Block a user