Separate out concrete part of world

This commit is contained in:
2022-07-25 12:10:50 +01:00
parent 3354d108be
commit b2efbd2b3e
134 changed files with 933 additions and 930 deletions
+5 -5
View File
@@ -10,16 +10,16 @@ import LensHelp
import qualified IntMapHelp as IM
updateLampoid :: Creature -> World -> World
updateLampoid cr w = case cr ^?! crType . lampLSID of
Nothing -> let i = IM.newKey (_lightSources w)
in w & lightSources %~ IM.insert i (lsColPosID lcol (addZ h cpos) i)
Nothing -> let i = IM.newKey (_lightSources (_cWorld w))
in w & cWorld . lightSources %~ IM.insert i (lsColPosID lcol (addZ h cpos) i)
Just i
| _crHP cr < 0 -> w
& explosionFlashAt cpos
& originsIDsAt [MaterialSound Glass n | n <- [0,1,2]] (destroyMatS Glass) cpos
& lightSources . at i .~ Nothing
& creatures . at cid .~ Nothing
& cWorld . lightSources . at i .~ Nothing
& cWorld . creatures . at cid .~ Nothing
| otherwise -> w
& lightSources . ix i . lsParam . lsPos .~ addZ h cpos
& cWorld . lightSources . ix i . lsParam . lsPos .~ addZ h cpos
& doDamage cr
where
cpos = _crPos cr