Remove more LDTs

This commit is contained in:
2025-07-11 00:49:36 +01:00
parent 05ff4651bd
commit 8ff607675b
3 changed files with 18 additions and 19 deletions
+11 -12
View File
@@ -8,7 +8,6 @@ module Dodge.HeldUse (
heldEffectMuzzles,
) where
import Dodge.DoubleTree
import Color
import Control.Applicative
import Control.Monad
@@ -43,18 +42,18 @@ import RandomHelp
import qualified SDL
import Sound.Data
gadgetEffect :: PressType -> LocationLDT ItemLink OItem -> Creature -> World -> World
gadgetEffect :: PressType -> LocationDT OItem -> Creature -> World -> World
gadgetEffect pt loc
| UseHeld{} <- loc ^. locLDT . ldtValue . _1 . itUse =
| UseHeld{} <- loc ^. locDT . dtValue . _1 . itUse =
heldEffect
pt
(locLDTToLocDT loc)
| DROPPER x <- loc ^. locLDT . ldtValue . _1 . itType
, Just i <- loc ^? locLDT . ldtValue . _1 . itUse . uInt
loc
| DROPPER x <- loc ^. locDT . dtValue . _1 . itType
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt
, pt == InitialPress =
dropInventoryPath i x loc
| CLICKER x <- loc ^. locLDT . ldtValue . _1 . itType
, Just i <- loc ^? locLDT . ldtValue . _1 . itUse . uInt =
| CLICKER x <- loc ^. locDT . dtValue . _1 . itType
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt =
useInventoryPath pt i x loc
| otherwise = const id
@@ -1412,12 +1411,12 @@ useRewindGun i =
dropInventoryPath ::
Int ->
InventoryPathing ->
LocationLDT ItemLink OItem ->
LocationDT OItem ->
Creature ->
World ->
World
dropInventoryPath i ip loc cr = fromMaybe id $ do
invid <- loc ^? locLDT . ldtValue . _1 . itLocation . ilInvID
invid <- loc ^? locDT . dtValue . _1 . itLocation . ilInvID
j <- getInventoryPath i ip invid cr
return $ dropItem cr j
@@ -1444,7 +1443,7 @@ useInventoryPath ::
PressType ->
Int ->
InventoryPathing ->
LocationLDT ItemLink OItem ->
LocationDT OItem ->
Creature ->
World ->
World
@@ -1459,7 +1458,7 @@ useInventoryPath pt i ip loc cr w = case ip of
w
& cWorld . lWorld . delayedEvents .:~ (1, UseInvItem (i + j) pt)
RELITEM -> fromMaybe w $ do
j <- loc ^? locLDT . ldtValue . _1 . itLocation . ilInvID
j <- loc ^? locDT . dtValue . _1 . itLocation . ilInvID
guard $ (i + j) `IM.member` (cr ^. crInv)
return $
w