Allow for bullet drag

This commit is contained in:
2021-12-02 18:29:46 +00:00
parent 85ededc158
commit 8b8d75b016
35 changed files with 362 additions and 228 deletions
+3 -3
View File
@@ -106,8 +106,8 @@ creatureTurnToward p turnSpeed cr
equipSpeed :: Item -> Float
equipSpeed _ = 1
{- | Speed modifier of an item when aiming. -}
equipAimSpeed :: Item -> Float
equipAimSpeed :: Item -> Float -- TODO remove/rethink
equipAimSpeed it
| _itIdentity it == FrontArmour = 0.5
| _itIdentity it == FlameShield = 0.5
| _itCombineType it == FRONTARMOUR = 0.5
| _itCombineType it == FLAMESHIELD = 0.5
| otherwise = 1
+2 -2
View File
@@ -4,7 +4,7 @@ module Dodge.Creature.Impulse.UseItem
, useLeftItem
) where
import Dodge.Data
import Dodge.Inventory
--import Dodge.Inventory
import qualified Data.IntMap.Strict as IM
import Control.Lens
@@ -22,7 +22,7 @@ tryUseItem cr' w = case w ^? creatures . ix (_crID cr') of
Nothing -> w
itemEffect :: Creature -> Item -> World -> World
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
--itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
itemEffect cr it w = case it ^? itUse of
Just RightUse {_rUse = eff,_useMods = usemods} -> foldr ($) eff usemods it cr w
Just LeftUse {} -> w
+1 -1
View File
@@ -11,7 +11,7 @@ import Control.Lens
crIsArmouredFrom :: Point2 -> Creature -> Bool
crIsArmouredFrom p cr
= p /= _crPos cr
&& any (\it -> it ^? itIdentity == Just FrontArmour) (_crInv cr)
&& any (\it -> it ^? itCombineType == Just FRONTARMOUR) (_crInv cr)
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
-- even though angleVV can generate NaN, the comparison seems to deal with it
+2 -1
View File
@@ -110,7 +110,7 @@ movementSideEff cr w
_ -> w
| otherwise = footstepSideEffect cr w
where
hasJetPack = any (\it -> it ^? itIdentity == Just JetPack) $ _crInv cr
hasJetPack = any (\it -> it ^? itCombineType == Just JETPACK) $ _crInv cr
oldPos = _crOldPos cr
momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr)
momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum'
@@ -158,6 +158,7 @@ weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption o
ActivePartial{} | _reloadState am == Nothing' -> w
ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
Just ChargeableAmmo {} -> w
Just NoConsumption {} -> w
Just ItemItselfConsumable {} -> w
Nothing -> w
where