Cleanup, hlints

This commit is contained in:
2025-07-12 21:35:35 +01:00
parent 5544e891c5
commit dc631263da
9 changed files with 58 additions and 74 deletions
+21 -21
View File
@@ -69,19 +69,19 @@ hammerCheck ::
World
hammerCheck f pt loc cr w = case itemTriggerType loc of
WarmUpNoDelay wm
| _wTime (_itParams $ it) < wm ->
| _wTime (_itParams it) < wm ->
w & setwarming
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ it ^. itType) (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix invid . itParams . wTime +~ 1
WarmUpNoDelay{} -> f loc cr w & setwarming
WarmUpCoolDown ws _ _
-- UNSAFE:
| _wTime (_itParams $ it) < ws ->
| _wTime (_itParams it) < ws ->
w & setwarming
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ it ^. itType) (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix invid . itParams . wTime +~ 1
WarmUpCoolDown _ cs _
| _wTime (_itParams $ it) < cs ->
| _wTime (_itParams it) < cs ->
f loc cr w & setwarming
& cWorld . lWorld . creatures . ix cid . crInv . ix invid . itParams . wTime +~ 1
WarmUpCoolDown{} -> w & setwarming
@@ -671,7 +671,7 @@ loadMuzzle ::
loadMuzzle t@(DT _ l _) mz = fromMaybe (t, Nothing) $ do
let as = _mzAmmoSlot mz
amamount = _mzAmmoPerShot mz
(i, ( mag)) <- findWithIx (isAmmoIntLink as . (^. dtValue . _2)) l
(i, mag) <- findWithIx (isAmmoIntLink as . (^. dtValue . _2)) l
availableammo <- mag ^. dtValue . _1 . itConsumables
let usedammo = case amamount of
UseUpTo x -> min x availableammo
@@ -681,7 +681,7 @@ loadMuzzle t@(DT _ l _) mz = fromMaybe (t, Nothing) $ do
guard $ usedammo > 0
return
( t & dtLeft . ix i . dtValue . _1 . itConsumables . _Just -~ usedammo
, Just (mz, usedammo, (mag))
, Just (mz, usedammo, mag)
)
makeMuzzleFlare :: Muzzle -> LocationDT OItem -> Creature -> World -> World
@@ -771,9 +771,9 @@ useLoadedAmmo loc cr (_, w) (Just (mz, x, magtree)) = (,) True $
MuzzleGLauncher ->
createProjectile
(itmtree ^. dtValue . _3)
(Grenade (getGrenadeHitEffect $ itmtree))
(Grenade (getGrenadeHitEffect itmtree))
magtree
(getPJStabiliser $ itmtree)
(getPJStabiliser itmtree)
mz
cr
w
@@ -933,14 +933,14 @@ getBulletType magtree =
bpayload = fromMaybe (BulPlain 100) $ do
attree <- find ispayload (magtree ^. dtLeft)
attree ^? dtValue . _1 . itUse . ubMod . bmPayload
ispayload :: (DTree OItem) -> Bool
ispayload :: DTree OItem -> Bool
ispayload y = case y ^. dtValue . _2 of
AmmoPayloadSF {} -> True
_ -> False
beffect = fromMaybe DestroyBullet $ do
attree <- find isammoeffect (magtree ^. dtLeft)
attree ^? dtValue . _1 . itUse . ubMod . bmEffect
isammoeffect :: (DTree OItem) -> Bool
isammoeffect :: DTree OItem -> Bool
isammoeffect y = case y ^. dtValue . _2 of
AmmoEffectSF {} -> True
_ -> False
@@ -984,7 +984,7 @@ shootBullets ::
World ->
World
shootBullets loc cr (mz, x, magtree) w = fromMaybe w $ do
thebullet <- getBulletType $ magtree
thebullet <- getBulletType magtree
return $ foldl' (&) w (replicate x (shootBullet thebullet loc cr mz))
shootBullet :: Bullet -> LocationDT OItem -> Creature -> Muzzle -> World -> World
@@ -1246,19 +1246,19 @@ determineProjectileTracking magtree itmtree =
_ <- find isammotargeting (magtree ^. dtLeft)
targetingtree <- find isweapontargeting (itmtree ^. dtRight)
return $ HomeUsingTargeting (targetingtree ^. dtValue . _1 . itID)
isremscreen :: (DTree OItem) -> Bool
isremscreen :: DTree OItem -> Bool
isremscreen x = case x ^. dtValue . _2 of
RemoteScreenSF {} -> True
_ -> False
isjoystick :: (DTree OItem) -> Bool
isjoystick :: DTree OItem -> Bool
isjoystick x = case x ^. dtValue . _2 of
JoystickSF {} -> True
_ -> False
isammotargeting :: (DTree OItem) -> Bool
isammotargeting :: DTree OItem -> Bool
isammotargeting x = case x ^. dtValue . _2 of
AmmoTargetingSF {} -> True
_ -> False
isweapontargeting :: (DTree OItem) -> Bool
isweapontargeting :: DTree OItem -> Bool
isweapontargeting x = case x ^. dtValue . _2 of
WeaponTargetingSF {} -> True
_ -> False
@@ -1274,7 +1274,7 @@ createProjectileR loc magtree =
createProjectile
(loc ^. locDT . dtValue . _3)
( Rocket
(determineProjectileTracking ( magtree) $ itmtree)
(determineProjectileTracking magtree itmtree)
smoke
)
magtree
@@ -1284,7 +1284,7 @@ createProjectileR loc magtree =
smoke
| isJust $ find issmokereducer (magtree ^. dtLeft) = Just ReducedRocketSmoke
| otherwise = Nothing
issmokereducer :: (DTree OItem) -> Bool
issmokereducer :: DTree OItem -> Bool
issmokereducer y = case y ^. dtValue . _2 of
SmokeReducerSF {} -> True
_ -> False
@@ -1297,7 +1297,7 @@ getPJStabiliser ldt = case find isprojstab (ldt ^. dtRight) of
_ -> Nothing
_ -> Nothing
where
isprojstab :: (DTree OItem) -> Bool
isprojstab :: DTree OItem -> Bool
isprojstab y = case y ^.dtValue . _2 of
ProjectileStabiliserSF {} -> True
_ -> False
@@ -1309,7 +1309,7 @@ getGrenadeHitEffect t = case find isghiteff (t ^. dtRight) of
_ -> GBounce 2
_ -> GBounce 2
where
isghiteff :: (DTree OItem) -> Bool
isghiteff :: DTree OItem -> Bool
isghiteff y = case y ^. dtValue . _2 of
GrenadeHitEffectSF {} -> True
_ -> False
@@ -1340,15 +1340,15 @@ createProjectile x pjtype magtree stab muz cr = fromMaybe failsound $ do
createShell x rdetonate rscreen stab pjtype aparams muz cr
. startthesound
where
isrdet :: (DTree OItem) -> Bool
isrdet :: DTree OItem -> Bool
isrdet y = case y ^. dtValue . _2 of
RemoteDetonatorSF {} -> True
_ -> False
isrscreen :: (DTree OItem) -> Bool
isrscreen :: DTree OItem -> Bool
isrscreen y = case y ^. dtValue . _2 of
RemoteScreenSF {} -> True
_ -> False
isampay :: (DTree OItem) -> Bool
isampay :: DTree OItem -> Bool
isampay y = case y ^. dtValue . _2 of
AmmoPayloadSF {} -> True
_ -> False