This commit is contained in:
2025-07-12 22:03:21 +01:00
parent a054d433b3
commit 6df7f657bc
2 changed files with 25 additions and 32 deletions
+3 -5
View File
@@ -45,9 +45,7 @@ import Sound.Data
gadgetEffect :: PressType -> LocationDT OItem -> Creature -> World -> World gadgetEffect :: PressType -> LocationDT OItem -> Creature -> World -> World
gadgetEffect pt loc gadgetEffect pt loc
| UseHeld{} <- loc ^. locDT . dtValue . _1 . itUse = | UseHeld{} <- loc ^. locDT . dtValue . _1 . itUse =
heldEffect heldEffect pt loc
pt
loc
| DROPPER x <- loc ^. locDT . dtValue . _1 . itType | DROPPER x <- loc ^. locDT . dtValue . _1 . itType
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt , Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt
, pt == InitialPress = , pt == InitialPress =
@@ -98,8 +96,8 @@ hammerCheck f pt loc cr w = case itemTriggerType loc of
& randGen .~ gen & randGen .~ gen
HammerTrigger t HammerTrigger t
| w ^. cWorld . lWorld . lClock - t > timelastused | w ^. cWorld . lWorld . lClock - t > timelastused
-- , isNothing $ lookup MakeAutoLink (tree ^. ldtRight) , -- , isNothing $ lookup MakeAutoLink (tree ^. ldtRight)
, pt == InitialPress -> pt == InitialPress ->
f loc cr w f loc cr w
AutoTrigger t AutoTrigger t
| w ^. cWorld . lWorld . lClock - t > timelastused -> | w ^. cWorld . lWorld . lClock - t > timelastused ->
+3 -8
View File
@@ -118,8 +118,7 @@ itemToFunction itm = case itm ^. itType of
HELD{} -> case itUseCondition itm of HELD{} -> case itUseCondition itm of
UseableWhenAimed -> HeldPlatformSF UseableWhenAimed -> HeldPlatformSF
_ -> GadgetPlatformSF _ -> GadgetPlatformSF
_ _ | Just amtype <- magAmmoType itm-- ^? itConsumables . magType
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
, Just _ <- itm ^? itLocation . ilEquipSite . _Just -> , Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
AmmoMagSF 0 amtype AmmoMagSF 0 amtype
AMMOMAG{} -> maybe NoSF (AmmoMagSF 0) $ magAmmoType itm -- ^? itConsumables . magType AMMOMAG{} -> maybe NoSF (AmmoMagSF 0) $ magAmmoType itm -- ^? itConsumables . magType
@@ -161,16 +160,12 @@ type DTComb a = DTree a -> DTree a -> Maybe (DTree a)
leftIsParentCombine :: DTComb CItem leftIsParentCombine :: DTComb CItem
leftIsParentCombine ltree rtree = do leftIsParentCombine ltree rtree = do
let l = rightChildList ltree sf <- find (`S.member` treeToPotentialFunction rtree) (rightChildList ltree)
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction rtree)) l
sf <- safeHead xs
return $ ltree & dtRight .:~ ( rtree & dtValue . _2 .~ sf) return $ ltree & dtRight .:~ ( rtree & dtValue . _2 .~ sf)
rightIsParentCombine :: DTComb CItem rightIsParentCombine :: DTComb CItem
rightIsParentCombine ltree rtree = do rightIsParentCombine ltree rtree = do
let l = leftChildList rtree sf <- find (`S.member` treeToPotentialFunction ltree) (leftChildList rtree)
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction ltree)) l
sf <- safeHead xs
return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf) return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf)
leftChildList :: DTree CItem -> [ItemSF] leftChildList :: DTree CItem -> [ItemSF]