Add in "linear" lWorld to separate time reversable worlds

This commit is contained in:
2022-10-28 12:24:51 +01:00
parent 5f6bd43599
commit 7e790b7153
130 changed files with 827 additions and 980 deletions
+5 -5
View File
@@ -62,8 +62,8 @@ doDamagesFL ::
World ->
World
doDamagesFL fdm (p, thhit) bt = case thhit of
Left cr -> cWorld . creatures . ix (_crID cr) . crState . csDamage .++~ dams
Right wl -> cWorld . wallDamages %~ IM.insertWith (++) (_wlID wl) dams
Left cr -> cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .++~ dams
Right wl -> cWorld . lWorld . wallDamages %~ IM.insertWith (++) (_wlID wl) dams
where
dams = fdm bt p
@@ -112,7 +112,7 @@ flDamageInArea :: (Creature -> Bool) -> (Wall -> Bool) -> Flame -> World -> Worl
flDamageInArea crt wlt pt w = damwls damcrs
where
p = _flPos pt
damcrs = foldl' (flip $ \cr -> fst . hiteff [(p, Left cr)]) w $ IM.filter crt $ _creatures (_cWorld w)
damcrs = foldl' (flip $ \cr -> fst . hiteff [(p, Left cr)]) w $ IM.filter crt $ w ^. cWorld . lWorld . creatures--_creatures (_cWorld w)
damwls w' =
foldl'
(flip $ \wl -> fst . hiteff [(p, Right wl)])
@@ -124,14 +124,14 @@ flDamageInArea crt wlt pt w = damwls damcrs
flFlicker :: Flame -> World -> World
flFlicker pt
| _flTimer pt `mod` 7 == 0 =
cWorld . tempLightSources
cWorld . lWorld . tempLightSources
.:~ tlsTimeRadColPos 1 70 (0.5 *.*.* xyzV4 (_flColor pt)) (addZ 10 $ _flPos pt)
| otherwise = id
makeFlame :: Point2 -> Point2 -> World -> World
makeFlame pos vel w =
w
& cWorld . flames .:~ aFlameParticle t pos vel
& cWorld . lWorld . flames .:~ aFlameParticle t pos vel
& randGen .~ g
where
(t, g) = randomR (99, 101) (_randGen w)