Fix bug in creature death drop/destruction ordering

This commit is contained in:
2024-10-03 11:19:53 +01:00
parent 1953fb2d0c
commit 3c9941923d
6 changed files with 17 additions and 102 deletions
-4
View File
@@ -179,10 +179,6 @@ dropItem cr invid = rmInvItem (_crID cr) invid .
copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
where
itm = fromMaybe (error "dropItem cannot find item") $ cr ^? crInv . ix invid
-- the following should be done in rmInvItem
-- mayberemoveequip = case _crLeftInvSel cr of
-- Just i | i == invid -> creatures . ix cid . crLeftInvSel .~ Nothing
-- _ -> id
-- | Get your creature to drop the item under the cursor.
youDropItem :: World -> World
+8 -8
View File
@@ -71,14 +71,14 @@ stateUpdate f =
]
checkDeath :: Creature -> World -> World
checkDeath cr
| _crHP cr > 0 =
cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
| otherwise =
dropByState cr
. removecr
. stopSoundFrom (CrWeaponSound (_crID cr) 0)
. corpseOrGib cr
checkDeath cr w
| _crHP cr > 0 = w
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
| otherwise = w
& dropByState cr -- the order of
& removecr -- these is important
& stopSoundFrom (CrWeaponSound (_crID cr) 0)
& corpseOrGib cr
where
removecr
| _crID cr == 0 =