Cleanup
This commit is contained in:
+16
-18
@@ -45,9 +45,7 @@ import Sound.Data
|
||||
gadgetEffect :: PressType -> LocationDT OItem -> Creature -> World -> World
|
||||
gadgetEffect pt loc
|
||||
| UseHeld{} <- loc ^. locDT . dtValue . _1 . itUse =
|
||||
heldEffect
|
||||
pt
|
||||
loc
|
||||
heldEffect pt loc
|
||||
| DROPPER x <- loc ^. locDT . dtValue . _1 . itType
|
||||
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt
|
||||
, pt == InitialPress =
|
||||
@@ -98,8 +96,8 @@ hammerCheck f pt loc cr w = case itemTriggerType loc of
|
||||
& randGen .~ gen
|
||||
HammerTrigger t
|
||||
| w ^. cWorld . lWorld . lClock - t > timelastused
|
||||
-- , isNothing $ lookup MakeAutoLink (tree ^. ldtRight)
|
||||
, pt == InitialPress ->
|
||||
, -- , isNothing $ lookup MakeAutoLink (tree ^. ldtRight)
|
||||
pt == InitialPress ->
|
||||
f loc cr w
|
||||
AutoTrigger t
|
||||
| w ^. cWorld . lWorld . lClock - t > timelastused ->
|
||||
@@ -932,14 +930,14 @@ getBulletType magtree =
|
||||
attree ^? dtValue . _1 . itUse . ubMod . bmPayload
|
||||
ispayload :: DTree OItem -> Bool
|
||||
ispayload y = case y ^. dtValue . _2 of
|
||||
AmmoPayloadSF {} -> True
|
||||
AmmoPayloadSF{} -> True
|
||||
_ -> False
|
||||
beffect = fromMaybe DestroyBullet $ do
|
||||
attree <- find isammoeffect (magtree ^. dtLeft)
|
||||
attree ^? dtValue . _1 . itUse . ubMod . bmEffect
|
||||
isammoeffect :: DTree OItem -> Bool
|
||||
isammoeffect y = case y ^. dtValue . _2 of
|
||||
AmmoEffectSF {} -> True
|
||||
AmmoEffectSF{} -> True
|
||||
_ -> False
|
||||
|
||||
magAmmoParams :: Item -> Maybe AmmoParams
|
||||
@@ -1245,19 +1243,19 @@ determineProjectileTracking magtree itmtree =
|
||||
return $ HomeUsingTargeting (targetingtree ^. dtValue . _1 . itID)
|
||||
isremscreen :: DTree OItem -> Bool
|
||||
isremscreen x = case x ^. dtValue . _2 of
|
||||
RemoteScreenSF {} -> True
|
||||
RemoteScreenSF{} -> True
|
||||
_ -> False
|
||||
isjoystick :: DTree OItem -> Bool
|
||||
isjoystick x = case x ^. dtValue . _2 of
|
||||
JoystickSF {} -> True
|
||||
JoystickSF{} -> True
|
||||
_ -> False
|
||||
isammotargeting :: DTree OItem -> Bool
|
||||
isammotargeting x = case x ^. dtValue . _2 of
|
||||
AmmoTargetingSF {} -> True
|
||||
AmmoTargetingSF{} -> True
|
||||
_ -> False
|
||||
isweapontargeting :: DTree OItem -> Bool
|
||||
isweapontargeting x = case x ^. dtValue . _2 of
|
||||
WeaponTargetingSF {} -> True
|
||||
WeaponTargetingSF{} -> True
|
||||
_ -> False
|
||||
|
||||
createProjectileR ::
|
||||
@@ -1283,7 +1281,7 @@ createProjectileR loc magtree =
|
||||
| otherwise = Nothing
|
||||
issmokereducer :: DTree OItem -> Bool
|
||||
issmokereducer y = case y ^. dtValue . _2 of
|
||||
SmokeReducerSF {} -> True
|
||||
SmokeReducerSF{} -> True
|
||||
_ -> False
|
||||
|
||||
getPJStabiliser :: DTree OItem -> Maybe PJStabiliser
|
||||
@@ -1295,8 +1293,8 @@ getPJStabiliser ldt = case find isprojstab (ldt ^. dtRight) of
|
||||
_ -> Nothing
|
||||
where
|
||||
isprojstab :: DTree OItem -> Bool
|
||||
isprojstab y = case y ^.dtValue . _2 of
|
||||
ProjectileStabiliserSF {} -> True
|
||||
isprojstab y = case y ^. dtValue . _2 of
|
||||
ProjectileStabiliserSF{} -> True
|
||||
_ -> False
|
||||
|
||||
getGrenadeHitEffect :: DTree OItem -> GrenadeHitEffect
|
||||
@@ -1308,7 +1306,7 @@ getGrenadeHitEffect t = case find isghiteff (t ^. dtRight) of
|
||||
where
|
||||
isghiteff :: DTree OItem -> Bool
|
||||
isghiteff y = case y ^. dtValue . _2 of
|
||||
GrenadeHitEffectSF {} -> True
|
||||
GrenadeHitEffectSF{} -> True
|
||||
_ -> False
|
||||
|
||||
createProjectile ::
|
||||
@@ -1339,15 +1337,15 @@ createProjectile x pjtype magtree stab muz cr = fromMaybe failsound $ do
|
||||
where
|
||||
isrdet :: DTree OItem -> Bool
|
||||
isrdet y = case y ^. dtValue . _2 of
|
||||
RemoteDetonatorSF {} -> True
|
||||
RemoteDetonatorSF{} -> True
|
||||
_ -> False
|
||||
isrscreen :: DTree OItem -> Bool
|
||||
isrscreen y = case y ^. dtValue . _2 of
|
||||
RemoteScreenSF {} -> True
|
||||
RemoteScreenSF{} -> True
|
||||
_ -> False
|
||||
isampay :: DTree OItem -> Bool
|
||||
isampay y = case y ^. dtValue . _2 of
|
||||
AmmoPayloadSF {} -> True
|
||||
AmmoPayloadSF{} -> True
|
||||
_ -> False
|
||||
|
||||
-- the sound should be moved to the projectile firing
|
||||
|
||||
@@ -118,8 +118,7 @@ itemToFunction itm = case itm ^. itType of
|
||||
HELD{} -> case itUseCondition itm of
|
||||
UseableWhenAimed -> HeldPlatformSF
|
||||
_ -> GadgetPlatformSF
|
||||
_
|
||||
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
|
||||
_ | Just amtype <- magAmmoType itm-- ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
|
||||
AmmoMagSF 0 amtype
|
||||
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 ltree rtree = do
|
||||
let l = rightChildList ltree
|
||||
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction rtree)) l
|
||||
sf <- safeHead xs
|
||||
sf <- find (`S.member` treeToPotentialFunction rtree) (rightChildList ltree)
|
||||
return $ ltree & dtRight .:~ ( rtree & dtValue . _2 .~ sf)
|
||||
|
||||
rightIsParentCombine :: DTComb CItem
|
||||
rightIsParentCombine ltree rtree = do
|
||||
let l = leftChildList rtree
|
||||
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction ltree)) l
|
||||
sf <- safeHead xs
|
||||
sf <- find (`S.member` treeToPotentialFunction ltree) (leftChildList rtree)
|
||||
return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf)
|
||||
|
||||
leftChildList :: DTree CItem -> [ItemSF]
|
||||
|
||||
Reference in New Issue
Block a user