Add file, fix lamp doDamage space leak
This commit is contained in:
@@ -28,6 +28,7 @@ lamp = defaultInanimate
|
||||
, _crHP = 100
|
||||
, _crPict = \ _ -> onLayer CrLayer $ color white $ circleSolid 3
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
|
||||
initialiseLamp :: CRUpdate
|
||||
@@ -37,7 +38,20 @@ initialiseLamp w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLam
|
||||
addLS = over lightSources (IM.insert i (lightAt (_crPos cr) i))
|
||||
|
||||
updateLamp :: Int -> CRUpdate
|
||||
updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
updateLamp i w (f,g) cr = ((handleLS . f, g), internalUpdate)
|
||||
where
|
||||
handleLS w'
|
||||
| _crHP cr < 0 = explosionFlashAt cPos
|
||||
$ mkSoundBreakGlass cPos w' & lightSources %~ IM.delete i
|
||||
| otherwise = w' & lightSources . ix i . lsPos .~ cPos
|
||||
where
|
||||
cPos = _crPos cr
|
||||
internalUpdate
|
||||
| _crHP cr < 0 = Nothing
|
||||
| otherwise = fmap doDamage $ Just cr
|
||||
|
||||
updateLamp' :: Int -> CRUpdate
|
||||
updateLamp' i = unrandUpdate handleLS internalUpdate
|
||||
where
|
||||
handleLS cr w
|
||||
| _crHP cr < 0 = explosionFlashAt cPos
|
||||
|
||||
Reference in New Issue
Block a user