Continue removing LDTs
This commit is contained in:
@@ -18,25 +18,25 @@ import qualified IntMapHelp as IM
|
||||
useItem :: Int -> PressType -> World -> Maybe World
|
||||
useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
|
||||
useItemLoc cr itmloc pt w
|
||||
itmloc <- invIndents (_crInv cr) ^? ix invid . _2
|
||||
useItemLoc cr (itmloc) pt w
|
||||
|
||||
useItemLoc :: Creature -> LocationLDT ItemLink OItem -> PressType -> World -> Maybe World
|
||||
useItemLoc :: Creature -> LocationDT OItem -> PressType -> World -> Maybe World
|
||||
useItemLoc cr loc pt w
|
||||
| HeldPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, fromMaybe False $ loc ^? locDT . dtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| LaserWeaponSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, fromMaybe False $ loc ^? locDT . dtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
return $ gadgetEffect pt (loc) cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
return $ gadgetEffect pt (loc) cr w
|
||||
| UnderBarrelPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, fromMaybe False $ loc ^? locDT . dtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt (locLDTToLocDT loc) cr w
|
||||
return $ gadgetEffect pt (loc) cr w
|
||||
| RemoteDetonatorSF <- sf
|
||||
, pt == InitialPress =
|
||||
return $ activateDetonator ldt w
|
||||
@@ -53,12 +53,12 @@ useItemLoc cr loc pt w
|
||||
, pt == InitialPress
|
||||
, Just invid' <- itm ^? itLocation . ilInvID =
|
||||
return $ toggleEquipmentAt invid' cr w
|
||||
| otherwise = (\loc' -> useItemLoc cr loc' pt w) =<< locUp loc
|
||||
| otherwise = (\loc' -> useItemLoc cr loc' pt w) =<< locUp' loc
|
||||
-- ie try location above
|
||||
where
|
||||
sf = loc ^. locLDT . ldtValue . _2
|
||||
ldt = loc ^. locLDT
|
||||
itm = ldt ^. ldtValue . _1
|
||||
sf = loc ^. locDT . dtValue . _2
|
||||
ldt = loc ^. locDT
|
||||
itm = ldt ^. dtValue . _1
|
||||
|
||||
--chooseUseLocation :: LocationLDT ItemLink OItem -> LocationLDT ItemLink OItem
|
||||
--chooseUseLocation loc
|
||||
@@ -78,9 +78,9 @@ useItemLoc cr loc pt w
|
||||
-- MapperSF -> True
|
||||
-- _ -> False
|
||||
|
||||
activateDetonator :: LDTree ItemLink OItem -> World -> World
|
||||
activateDetonator :: DTree OItem -> World -> World
|
||||
activateDetonator det = fromMaybe id $ do
|
||||
pjid <- det ^? ldtValue . _1 . itUse . uaParams . apProjectiles . ix 0
|
||||
pjid <- det ^? dtValue . _1 . itUse . uaParams . apProjectiles . ix 0
|
||||
return $ cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
|
||||
|
||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user