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
+6 -6
View File
@@ -13,19 +13,19 @@ import LensHelp
updateLampoid :: Creature -> World -> World
updateLampoid cr w = case cr ^?! crType . lampLSID of
Nothing ->
let i = IM.newKey (_lightSources (_cWorld w))
in w & cWorld . lightSources %~ IM.insert i (lsColPosID lcol (addZ h cpos) i)
& cWorld . creatures . ix (_crID cr) . crType . lampLSID ?~ i
let i = IM.newKey (w ^. cWorld . lWorld . lightSources)
in w & cWorld . lWorld . lightSources %~ IM.insert i (lsColPosID lcol (addZ h cpos) i)
& cWorld . lWorld . creatures . ix (_crID cr) . crType . lampLSID ?~ i
Just i
| _crHP cr < 0 ->
w
& explosionFlashAt cpos
& originsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) cpos
& cWorld . lightSources . at i .~ Nothing
& cWorld . creatures . at cid .~ Nothing
& cWorld . lWorld . lightSources . at i .~ Nothing
& cWorld . lWorld . creatures . at cid .~ Nothing
| otherwise ->
w
& cWorld . lightSources . ix i . lsParam . lsPos .~ addZ h cpos
& cWorld . lWorld . lightSources . ix i . lsParam . lsPos .~ addZ h cpos
& doDamage cr
where
cpos = _crPos cr