Refactor bullet particles

This commit is contained in:
2021-05-19 13:46:19 +02:00
parent 44f239c673
commit 4463dc7716
29 changed files with 637 additions and 535 deletions
+9
View File
@@ -49,6 +49,9 @@ crCanSeeCIDR cid cr = reader $ \w -> hasLOS (_crPos cr) (_crPos $ _creatures w I
crIsAiming :: (World,Creature) -> Bool
crIsAiming (_,cr) = _posture (_crStance cr) == Aiming
crIsAiming' :: Creature -> Bool
crIsAiming' cr = _posture (_crStance cr) == Aiming
crIsAimingR :: Creature -> Reader World Bool
crIsAimingR cr = return $ _posture (_crStance cr) == Aiming
@@ -99,3 +102,9 @@ crAwayFromPostR cr = return $ case find sentinelGoal $ _crGoal $ _crActionPlan c
where
sentinelGoal (SentinelAt _ _) = True
sentinelGoal _ = False
crHasAmmo :: (World,Creature) -> Bool
crHasAmmo (_,cr) = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . wpLoadedAmmo
crCanShoot :: (World,Creature) -> Bool
crCanShoot p = crIsAiming p && crHasAmmo p