Cleanup UseEquip constructor

This commit is contained in:
2024-10-03 10:15:17 +01:00
parent 3b75ab73aa
commit 91bf1bc62a
6 changed files with 14 additions and 22 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ itemUseEffect cr it w = case it ^. ldtValue . itUse of
UseHeld{} -> heldEffect it cr w
& pointerToItem itm . itUse . heldHammer .~ HammerDown
UseHotkey{} -> doequipmentchange
EquipUse{} -> doequipmentchange
UseEquip{} -> doequipmentchange
(UseConsume eff) -> useC eff (_ldtValue it) cr w
CraftUse{} -> w
UseAttach{} -> selectUse it cr w
@@ -105,7 +105,7 @@ useItemLeftClick cr w = fromMaybe w $ do
case ituse of
UseHeld{} -> return w
UseConsume{} -> return $ useItemLeftClick' cr w
EquipUse{} -> return $ useItemLeftClick' cr w
UseEquip{} -> return $ useItemLeftClick' cr w
UseHotkey{} -> return $ useItemLeftClick' cr w
UseAmmoMag{} -> return w
_ -> Nothing
+6 -9
View File
@@ -26,7 +26,6 @@ import Dodge.Item.HeldOffset
import Dodge.LightSource
import Dodge.Prop.Gib
import Dodge.SoundLogic
--import Dodge.WorldEvent.Flash
import Dodge.Zoning.Creature
import FoldableHelp
import Geometry
@@ -72,16 +71,14 @@ stateUpdate f =
]
checkDeath :: Creature -> World -> World
checkDeath cr w
checkDeath cr
| _crHP cr > 0 =
w
& cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
cWorld . lWorld . creatures . ix (_crID cr) . crState . csDamage .~ []
| otherwise =
w
& dropByState cr
& removecr
& stopSoundFrom (CrWeaponSound (_crID cr) 0)
& corpseOrGib cr
dropByState cr
. removecr
. stopSoundFrom (CrWeaponSound (_crID cr) 0)
. corpseOrGib cr
where
removecr
| _crID cr == 0 =