Remove more LDTs
This commit is contained in:
@@ -26,17 +26,17 @@ useItemLoc cr loc pt w
|
||||
| HeldPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
| LaserWeaponSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
| UnderBarrelPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
| RemoteDetonatorSF <- sf
|
||||
, pt == InitialPress =
|
||||
return $ activateDetonator ldt w
|
||||
|
||||
@@ -153,7 +153,7 @@ invRootItemEffs cr =
|
||||
invItemLocUpdate :: Creature -> LocationLDT ItemLink OItem -> World -> World
|
||||
invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
||||
ATTACH BULLETSYNTH -> trySynthBullet loc w
|
||||
EQUIP WRIST_ECG | haspulse -> tryUseParent loc w
|
||||
EQUIP WRIST_ECG | haspulse -> tryUseParent (locLDTToLocDT loc) w
|
||||
COPIER _ -> copierItemUpdate itm cr w
|
||||
HELD FLATSHIELD -> rootNotrootEff createShieldWall removeShieldWall itm cr w
|
||||
HELD MINIGUNX{} -> coolMinigun itm w
|
||||
@@ -223,9 +223,9 @@ doAnyEquipmentEffect :: LocationLDT ItemLink OItem -> Creature -> World -> World
|
||||
doAnyEquipmentEffect loc cr = maybe id (equipBackgroundEffect loc cr)
|
||||
$ loc ^? locLDT . ldtValue . _1 . itLocation . ilEquipSite . _Just
|
||||
|
||||
tryUseParent :: LocationLDT ItemLink OItem -> World -> World
|
||||
tryUseParent :: LocationDT OItem -> World -> World
|
||||
tryUseParent loc w = fromMaybe w $ do
|
||||
t <- locUp loc
|
||||
t <- locUp' loc
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
return $ gadgetEffect InitialPress t cr w
|
||||
|
||||
|
||||
+11
-12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user