Half add explicit death event for machines
This commit is contained in:
+9
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user