Refactor light sources

This commit is contained in:
2021-11-28 16:53:26 +00:00
parent 1d9dd3e4e0
commit 618653a86e
28 changed files with 169 additions and 155 deletions
+2 -2
View File
@@ -87,7 +87,7 @@ initialiseColorLamp col h cr _ = ( Endo addLS , Just $ cr & crUpdate .~ updateLa
where
i = _crID cr
addLS w = w
& lightSources %~ IM.insert lsid (colorLightAt col (V3 x y h) lsid)
& lightSources %~ IM.insert lsid (lsColPosID col (V3 x y h) lsid)
& creatures . ix i . crUpdate .~ updateLamp h lsid
where
lsid = IM.newKey $ _lightSources w
@@ -99,7 +99,7 @@ updateLamp h i = unrandUpdate handleLS internalUpdate
handleLS cr w
| _crHP cr < 0 = explosionFlashAt cPos
$ mkSoundBreakGlass cPos w & lightSources %~ IM.delete i
| otherwise = w & lightSources . ix i . lsPos .~ f cPos
| otherwise = w & lightSources . ix i . lsParam . lsPos .~ f cPos
where
cPos = _crPos cr
f (V2 x y) = V3 x y h