Make aimStance record into function
This commit is contained in:
+50
-8
@@ -8,6 +8,7 @@ module Dodge.HeldUse (
|
||||
mcUseHeld,
|
||||
) where
|
||||
|
||||
import Sound.Data
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -187,7 +188,7 @@ applyInvLock itm cr = case itm ^? itUse . heldParams . weaponInvLock of
|
||||
|
||||
applySoundCME :: Item -> Creature -> World -> World
|
||||
applySoundCME itm cr = fromMaybe id $ do
|
||||
(soundid, x) <- itm ^? itUse . heldParams . bulGunSound . _Just
|
||||
(soundid, x) <- bgunSound itm
|
||||
return $
|
||||
if x > 0
|
||||
then soundContinue (CrWeaponSound cid 0) (_crPos cr) soundid (Just x)
|
||||
@@ -198,7 +199,6 @@ applySoundCME itm cr = fromMaybe id $ do
|
||||
applyRecoil :: Item -> Creature -> World -> World
|
||||
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) %~ pushback
|
||||
where
|
||||
-- recoilAmount = fromMaybe 0 $ itm ^? itUse . heldParams . recoil
|
||||
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0))
|
||||
|
||||
recoilAmount :: Item -> Float
|
||||
@@ -247,6 +247,54 @@ recoilAmount itm
|
||||
BLINKERUNSAFE -> 0
|
||||
| otherwise = 0
|
||||
|
||||
-- if the int is 0, play sound on new channel
|
||||
-- if >0, continue playing sound for given time
|
||||
bgunSound :: Item -> Maybe (SoundID,Int)
|
||||
bgunSound itm
|
||||
| HELD hit <- itm ^. itType = case hit of
|
||||
BANGSTICK _ -> Just (tap3S, 0)
|
||||
REWINDER -> Nothing
|
||||
TIMESTOPPER -> Nothing
|
||||
TIMESCROLLER -> Nothing
|
||||
PISTOL -> Just (tap3S, 0)
|
||||
MACHINEPISTOL -> Just (tap1S, 0)
|
||||
AUTOPISTOL -> Just (tap1S, 0)
|
||||
SMG -> Just (tap1S, 0)
|
||||
BANGCONE -> Just (bangEchoS,0)
|
||||
BLUNDERBUSS -> Just (bangEchoS,0)
|
||||
GRAPECANNON _ -> Just (bangEchoS,0)
|
||||
MINIGUNX _ -> Just (mini1S,2)
|
||||
VOLLEYGUN _ -> Just (tap3S, 0)
|
||||
RIFLE -> Just (tap3S, 0)
|
||||
ALTERIFLE -> Just (tap3S, 0)
|
||||
AUTORIFLE -> Just (tap3S, 0)
|
||||
BURSTRIFLE -> Just (tap3S, 0)
|
||||
BANGROD -> Just (bangEchoS,0)
|
||||
ELEPHANTGUN -> Just (bangEchoS,0)
|
||||
AMR -> Just (bangEchoS,0)
|
||||
AUTOAMR -> Just (bangEchoS,0)
|
||||
SNIPERRIFLE -> Just (bangEchoS,0)
|
||||
FLAMESPITTER -> Nothing
|
||||
FLAMETHROWER -> Nothing
|
||||
FLAMETORRENT -> Nothing
|
||||
FLAMEWALL -> Nothing
|
||||
BLOWTORCH -> Nothing
|
||||
SPARKGUN -> Nothing
|
||||
TESLAGUN -> Nothing
|
||||
LASER -> Nothing
|
||||
TRACTORGUN -> Nothing
|
||||
RLAUNCHER -> Just (tap4S, 0)
|
||||
RLAUNCHERX _ -> Just (tap4S, 0)
|
||||
GLAUNCHER -> Just (tap4S, 0)
|
||||
POISONSPRAYER -> Just (foamSprayLoopS,5)
|
||||
SHATTERGUN -> Nothing
|
||||
TORCH -> Nothing
|
||||
FLATSHIELD -> Nothing
|
||||
KEYCARD _ -> Nothing
|
||||
BLINKER -> Nothing
|
||||
BLINKERUNSAFE -> Nothing
|
||||
| otherwise = Nothing
|
||||
|
||||
applySidePush :: Float -> Creature -> World -> World
|
||||
applySidePush 0 _ w = w
|
||||
applySidePush maxSide cr w =
|
||||
@@ -545,13 +593,8 @@ removeAmmoFromMag x mid cr = fromMaybe id $ do
|
||||
-~ x
|
||||
|
||||
getBulletType ::
|
||||
-- LabelDoubleTree ComposeLinkType Item ->
|
||||
LabelDoubleTree ComposeLinkType Item ->
|
||||
-- Muzzle ->
|
||||
-- Creature ->
|
||||
-- World ->
|
||||
Maybe Bullet
|
||||
--getBulletType itmtree magtree mz cr w =
|
||||
getBulletType magtree =
|
||||
magtree ^? ldtValue . itConsumables . magParams . ampBullet
|
||||
-- <&> buTrajectory .~ btraj
|
||||
@@ -598,7 +641,6 @@ shootBullet ::
|
||||
World ->
|
||||
World
|
||||
shootBullet itmtree cr (mz, x, magtree) w = fromMaybe w $ do
|
||||
-- thebullet <- getBulletType itmtree magtree mz cr w
|
||||
thebullet <- getBulletType magtree
|
||||
return $ foldl' (&) w (replicate x (makeBullet' thebullet (itmtree ^. ldtValue) cr mz))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user