Half add explicit death event for machines

This commit is contained in:
2022-06-05 10:37:40 +01:00
parent 7398791194
commit fcc6d3952c
9 changed files with 26 additions and 10 deletions
+9 -1
View File
@@ -8,6 +8,7 @@ import Dodge.Menu
import Dodge.Block
import Dodge.Distortion
import Dodge.SoundLogic
import Dodge.Wall.Delete
--import Dodge.Menu
import Dodge.Base
import Dodge.Zone
@@ -71,7 +72,7 @@ functionalUpdate cfig w = checkEndGame
. updateGusts
. zoneClouds
. updateMIM magnets _mgUpdate
. updateIMl _machines _mcUpdate
. updateIMl _machines mcChooseUpdate
. updateIMl _creatures _crUpdate
-- creatures should be updated early so that crOldPos is set before any position change
. over creatures (fmap setOldPos)
@@ -89,6 +90,13 @@ functionalUpdate cfig w = checkEndGame
where
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
mcChooseUpdate :: Machine -> Machine -> World -> World
mcChooseUpdate mc mc'
| _mcHP mc > 0 = _mcUpdate mc mc'
| otherwise = (machines %~ IM.delete (_mcID mc))
. deleteWallIDs (_mcWallIDs mc)
. _mcDeath mc mc'
setOldPos :: Creature -> Creature
setOldPos cr = cr
& crOldPos .~ _crPos cr