Continue weapon effect chain work

Start work on using muzzles to determine the effect of the ammo when
loaded
This commit is contained in:
2024-09-18 00:36:28 +01:00
parent 791003ebb9
commit 2c96a514ea
22 changed files with 502 additions and 404 deletions
+38 -1
View File
@@ -1 +1,38 @@
All good (617 modules, at 11:03:32) /home/justin/Haskell/loop/src/Dodge/HeldUse.hs:(44,25)-(322,30): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: MachineGunMod
|
44 | heldEffect effecttype = case effecttype of
| ^^^^^^^^^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:(487,43)-(500,9): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative:
Patterns not matched:
MuzzleLaser
MuzzleTesla
MuzzleTractor
MuzzleLauncher
...
|
487 | useLoadedAmmo itm cr (cme,w) (mz,x,mid) = case _mzEffect mz of
| ^^^^^^^^^^^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/Bullet.hs:6:1-30: warning: [-Wunused-imports]
The import of Dodge.Data.ComposedItem is redundant
|
6 | import Dodge.Data.ComposedItem
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Bullet.hs:7:1-28: warning: [-Wunused-imports]
The import of Dodge.Data.DoubleTree is redundant
|
7 | import Dodge.Data.DoubleTree
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Bullet.hs:13:1-28: warning: [-Wunused-imports]
The import of Dodge.Base.Coordinate is redundant
|
13 | import Dodge.Base.Coordinate
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Bullet.hs:14:1-29: warning: [-Wunused-imports]
The import of Dodge.Creature.HandPos is redundant
|
14 | import Dodge.Creature.HandPos
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1 -1
View File
File diff suppressed because one or more lines are too long
+39 -38
View File
@@ -1,6 +1,6 @@
module Dodge.Bullet ( module Dodge.Bullet (
updateBullet, updateBullet,
shootBullet, -- shootBullet,
) where ) where
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
@@ -58,43 +58,44 @@ updateBulVel bt = case _buTrajectory bt of
where where
t = _buTimer bt t = _buTimer bt
shootBullet :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World -- NOTE THE FOLLOWING HAS BEZIER CURE/FLECHETTE STUFF THAT MIGHT BE USEFUL
shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do --shootBullet :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0 --shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
leftitms <- itm ^? ldtLeft -- atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0
mag <- lookup (AmmoInLink 0 atype) leftitms -- leftitms <- itm ^? ldtLeft
thebullet <- mag ^? ldtValue . itUse . amagParams . ampBullet -- mag <- lookup (AmmoInLink 0 atype) leftitms
return $ w -- thebullet <- mag ^? ldtValue . itUse . amagParams . ampBullet
& randGen .~ g' -- return $ w
& cWorld . lWorld . instantBullets -- & randGen .~ g'
.:~ ( thebullet -- & cWorld . lWorld . instantBullets
& buPos .~ _crPos cr -- .:~ ( thebullet
& buTrajectory %~ settrajectory -- & buPos .~ _crPos cr
& buVel %~ (rotateV dir . (muzvel *.*)) -- & buTrajectory %~ settrajectory
& buDrag *~ drag -- & buVel %~ (rotateV dir . (muzvel *.*))
) -- & buDrag *~ drag
where -- )
it = itm ^. ldtValue -- where
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir -- it = itm ^. ldtValue
dir = _crDir cr -- sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
(drag,g) = case _rifling (_heldParams $ _itUse it) of -- dir = _crDir cr
ConstFloat x -> (x, _randGen w) -- (drag,g) = case _rifling (_heldParams $ _itUse it) of
UniRandFloat x y -> randomR (x,y) $ _randGen w -- ConstFloat x -> (x, _randGen w)
(muzvel,g') = case _muzVel $ _heldParams $ _itUse it of -- UniRandFloat x y -> randomR (x,y) $ _randGen w
ConstFloat x -> (x,g) -- (muzvel,g') = case _muzVel $ _heldParams $ _itUse it of
UniRandFloat x y -> randomR (x,y) $ _randGen w -- ConstFloat x -> (x,g)
muzlength = aimingMuzzlePos cr it -- UniRandFloat x y -> randomR (x,y) $ _randGen w
settrajectory traj = case traj of -- muzlength = aimingMuzzlePos cr it
BasicBulletTrajectory -> BasicBulletTrajectory -- settrajectory traj = case traj of
MagnetTrajectory{} -> fromMaybe BasicBulletTrajectory $ do -- BasicBulletTrajectory -> BasicBulletTrajectory
tpos <- cr ^? crTargeting . ctPos . _Just -- MagnetTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
return $ MagnetTrajectory tpos -- tpos <- cr ^? crTargeting . ctPos . _Just
FlechetteTrajectory{} -> fromMaybe BasicBulletTrajectory $ do -- return $ MagnetTrajectory tpos
tpos <- cr ^? crTargeting . ctPos . _Just -- FlechetteTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
return $ FlechetteTrajectory tpos -- tpos <- cr ^? crTargeting . ctPos . _Just
BezierTrajectory{} -> fromMaybe BasicBulletTrajectory $ do -- return $ FlechetteTrajectory tpos
tpos <- cr ^? crTargeting . ctPos . _Just -- BezierTrajectory{} -> fromMaybe BasicBulletTrajectory $ do
return $ BezierTrajectory sp tpos (mouseWorldPos (w ^. input) (w ^. wCam)) -- tpos <- cr ^? crTargeting . ctPos . _Just
-- return $ BezierTrajectory sp tpos (mouseWorldPos (w ^. input) (w ^. wCam))
bounceDir :: (Point2, Either Creature Wall) -> Maybe Point2 bounceDir :: (Point2, Either Creature Wall) -> Maybe Point2
bounceDir (_, Right wl) | _wlBouncy wl = Just $ uncurry (-.-) (_wlLine wl) bounceDir (_, Right wl) | _wlBouncy wl = Just $ uncurry (-.-) (_wlLine wl)
+2
View File
@@ -5,6 +5,7 @@
module Dodge.Data.Item.HeldDelay where module Dodge.Data.Item.HeldDelay where
import Sound.Data
import Control.Lens import Control.Lens
import Data.Aeson import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
@@ -24,6 +25,7 @@ data UseDelay -- should just be Delay
| WarmUpNoDelay | WarmUpNoDelay
{ _warmTime :: Int { _warmTime :: Int
, _warmMax :: Int , _warmMax :: Int
, _warmSound :: SoundID
} }
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
+4 -4
View File
@@ -14,7 +14,7 @@ import Control.Lens
data Huse data Huse
= HeldDoNothing = HeldDoNothing
| HeldUseAmmoParams -- | HeldUseAmmoParams
| HeldOverNozzlesUseGasParams | HeldOverNozzlesUseGasParams
| HeldPJCreation | HeldPJCreation
| HeldPJCreationX Int | HeldPJCreationX Int
@@ -94,9 +94,9 @@ data HeldMod
| PistolMod | PistolMod
-- | AutoPistolMod -- | AutoPistolMod
-- | MachinePistolMod -- | MachinePistolMod
| BurstRifleMod -- | BurstRifleMod
| BurstRifleRepeatMod -- | BurstRifleRepeatMod
| MiniGunMod Int -- | MiniGunMod Int
-- | SmgMod -- | SmgMod
-- | BangConeMod -- | BangConeMod
| TractorMod --apply with AmmoCheckMod | TractorMod --apply with AmmoCheckMod
+20 -1
View File
@@ -75,6 +75,10 @@ data HeldParams
= DefaultHeldParams = DefaultHeldParams
| GasSprayParams | GasSprayParams
{_gasCreation :: GasCreate} {_gasCreation :: GasCreate}
| BeamShooterParams
{ _bulGunSound :: (SoundID, Int) -- if the int is 0, play sound on new channel
-- TODO remove duplicate
}
| BulletShooterParams | BulletShooterParams
{ _muzVel :: GenFloat { _muzVel :: GenFloat
, _rifling :: GenFloat , _rifling :: GenFloat
@@ -82,7 +86,9 @@ data HeldParams
, _torqueAfter :: Float , _torqueAfter :: Float
, _randomOffset :: Float , _randomOffset :: Float
, _sidePush :: Float , _sidePush :: Float
, _bulGunSound :: SoundID , _bulGunSound :: (SoundID, Int) -- if the int is 0, play sound on new channel
-- if >0, continue playing sound for
-- given time
, _weaponInvLock :: Int , _weaponInvLock :: Int
, _weaponRepeat :: [Int] , _weaponRepeat :: [Int]
} }
@@ -130,7 +136,18 @@ data AimParams = AimParams
data FlareType = DefaultFlareType data FlareType = DefaultFlareType
| PistolFlare | PistolFlare
| MiniGunFlare
| HeavySmokeFlare | HeavySmokeFlare
| LasGunFlare
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data MuzzleEffect
= MuzzleShootBullet
| MuzzleLaser
| MuzzleTesla
| MuzzleTractor
| MuzzleLauncher
| MuzzleFlame
| MuzzleGas
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Muzzle = Muzzle data Muzzle = Muzzle
@@ -139,6 +156,7 @@ data Muzzle = Muzzle
, _mzInaccuracy :: Float , _mzInaccuracy :: Float
, _mzAmmoSlot :: Int , _mzAmmoSlot :: Int
, _mzFlareType :: FlareType , _mzFlareType :: FlareType
, _mzEffect :: MuzzleEffect
-- , _mzRecoil :: Float -- , _mzRecoil :: Float
-- , _mzTorque :: Float -- , _mzTorque :: Float
-- , _mzSidePush :: Float -- , _mzSidePush :: Float
@@ -175,6 +193,7 @@ makeLenses ''HeldParams
makeLenses ''AttachParams makeLenses ''AttachParams
makeLenses ''ScrollAttachParams makeLenses ''ScrollAttachParams
makeLenses ''AmmoParams makeLenses ''AmmoParams
deriveJSON defaultOptions ''MuzzleEffect
deriveJSON defaultOptions ''FlareType deriveJSON defaultOptions ''FlareType
deriveJSON defaultOptions ''TriggerType deriveJSON defaultOptions ''TriggerType
deriveJSON defaultOptions ''AmmoParams deriveJSON defaultOptions ''AmmoParams
+1
View File
@@ -144,6 +144,7 @@ data LWorld = LWorld
, _distortions :: [Distortion] , _distortions :: [Distortion]
, _lClock :: Int , _lClock :: Int
, _lTestString :: [String] , _lTestString :: [String]
, _lTestInt :: Int
} }
data WorldBeams = WorldBeams data WorldBeams = WorldBeams
{ _blockingBeams :: [Beam] { _blockingBeams :: [Beam]
+1
View File
@@ -52,6 +52,7 @@ defaultBulletWeapon =
& itUse . heldAmmoTypes .~ singleAmmo BulletAmmo & itUse . heldAmmoTypes .~ singleAmmo BulletAmmo
-- & itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams -- & itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE & itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE -- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE -- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
+1 -1
View File
@@ -42,7 +42,7 @@ defaultHeldUse =
, _torqueAfter = 0.2 , _torqueAfter = 0.2
, _randomOffset = 0 , _randomOffset = 0
, _sidePush = 0 , _sidePush = 0
, _bulGunSound = tap3S , _bulGunSound = (tap3S, 0)
, _weaponInvLock = 0 , _weaponInvLock = 0
, _weaponRepeat = [] , _weaponRepeat = []
} }
+1
View File
@@ -24,6 +24,7 @@ defaultMuzzle = Muzzle
, _mzInaccuracy = 0.05 , _mzInaccuracy = 0.05
, _mzAmmoSlot = 0 , _mzAmmoSlot = 0
, _mzFlareType = DefaultFlareType , _mzFlareType = DefaultFlareType
, _mzEffect = MuzzleShootBullet
} }
+1
View File
@@ -144,6 +144,7 @@ defaultLWorld =
, _distortions = [] , _distortions = []
, _lClock = 0 , _lClock = 0
, _lTestString = [] , _lTestString = []
, _lTestInt = 0
} }
defaultHUD :: HUD defaultHUD :: HUD
+122 -110
View File
@@ -18,7 +18,7 @@ import Color
import Data.Maybe import Data.Maybe
--import Data.Traversable --import Data.Traversable
import Dodge.Base.Coordinate import Dodge.Base.Coordinate
import Dodge.Bullet --import Dodge.Bullet
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
import Dodge.Data.World import Dodge.Data.World
import Dodge.Gas import Dodge.Gas
@@ -209,13 +209,13 @@ heldEffect effecttype = case effecttype of
-- , useTimeCheck -- , useTimeCheck
-- , ammoCheckI -- cf ElephantGun -- , ammoCheckI -- cf ElephantGun
-- ] -- ]
MachineGunMod -> bulletGunEffect -- MachineGunMod -> bulletGunEffect
[ withFlare -- [ withFlare
, withThinSmokeI -- , withThinSmokeI
, withSoundStart bangEchoS -- , withSoundStart bangEchoS
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter -- , rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, ammoCheckI -- , ammoCheckI
] -- ]
-- BangStickMod -> bulletGunEffect -- BangStickMod -> bulletGunEffect
-- [ withRecoil -- [ withRecoil
-- , useAllAmmo -- , useAllAmmo
@@ -250,44 +250,44 @@ heldEffect effecttype = case effecttype of
-- , useTimeCheck -- , useTimeCheck
-- , ammoCheckI -- , ammoCheckI
-- ] -- ]
BurstRifleMod -> bulletGunEffect -- BurstRifleMod -> bulletGunEffect
[ withRecoil -- [ withRecoil
, withFlare -- , withFlare
, duplicateLoadedBarrels -- , duplicateLoadedBarrels
, useAmmoAmount 1 -- , useAmmoAmount 1
, withSoundStart tap3S -- , withSoundStart tap3S
, repeatOnFrames [3, 6] BurstRifleRepeatMod -- , repeatOnFrames [3, 6] BurstRifleRepeatMod
, lockInvFor 7 -- , lockInvFor 7
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2) -- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
, useTimeCheck -- , useTimeCheck
, ammoCheckI -- , ammoCheckI
, blCheck -- , blCheck
] -- ]
BurstRifleRepeatMod -> bulletGunEffect -- BurstRifleRepeatMod -> bulletGunEffect
[ withRecoil -- [ withRecoil
, withFlare -- , withFlare
, duplicateLoadedBarrels -- , duplicateLoadedBarrels
, useAmmoAmount 1 -- , useAmmoAmount 1
, withSoundStart tap3S -- , withSoundStart tap3S
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2) -- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
, ammoCheckI -- , ammoCheckI
] -- ]
MiniGunMod i -> bulletGunEffect -- MiniGunMod i -> bulletGunEffect
[ duplicateNumBarrels 1 -- [ duplicateNumBarrels 1
, repeatTransformed -- , repeatTransformed
[ (id, modcrpos x) -- [ (id, modcrpos x)
| x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1] -- | x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
] -- ]
, afterRecoil (fromIntegral i * 5) -- , afterRecoil (fromIntegral i * 5)
, torqueBefore (fromIntegral i * 0.05) -- , torqueBefore (fromIntegral i * 0.05)
, withSidePushI (fromIntegral i * 25) -- , withSidePushI (fromIntegral i * 25)
, withMuzFlare -- , withMuzFlare
, withSmoke 1 black 20 200 5 -- , withSmoke 1 black 20 200 5
, useAmmoAmount i -- , useAmmoAmount i
, withSoundForI mini1S 2 -- , withSoundForI mini1S 2
, withWarmUp crankSlowS -- , withWarmUp crankSlowS
, ammoCheckI -- , ammoCheckI
] -- ]
-- SmgMod -> bulletGunEffect -- SmgMod -> bulletGunEffect
-- [ withFlare -- [ withFlare
-- , withSidePushI 30 -- , withSidePushI 30
@@ -332,11 +332,11 @@ heldEffect effecttype = case effecttype of
-- where -- where
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just -- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
-- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p) -- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
modcrpos x cr = fromMaybe cr $ do -- modcrpos x cr = fromMaybe cr $ do
invid <- cr ^? crManipulation . manObject . inInventory . ispItem -- invid <- cr ^? crManipulation . manObject . inInventory . ispItem
return $ cr & crDir %~ tweenAngles x (_crOldDir cr) -- return $ cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ alongSegBy x (_crOldPos cr) -- & crPos %~ alongSegBy x (_crOldPos cr)
& crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x -- & crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x
gasEffect :: [(LabelDoubleTree ComposeLinkType Item gasEffect :: [(LabelDoubleTree ComposeLinkType Item
-> Creature -> World -> World) -> Creature -> World -> World)
@@ -361,6 +361,7 @@ bulGunEffect' t cr w = fromMaybe (error "error in bulGunEffect") $ do
return $ uncurry (applyCME (_ldtValue t) cr) cmew return $ uncurry (applyCME (_ldtValue t) cr) cmew
& cWorld . lWorld . lTestString .~ map (show . _mzAmmoSlot) muzzles & cWorld . lWorld . lTestString .~ map (show . _mzAmmoSlot) muzzles
& doWeaponRepetitions upitm cr & doWeaponRepetitions upitm cr
-- & cWorld . lWorld . lTestInt +~ 1
doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponRepeat of doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponRepeat of
@@ -390,8 +391,10 @@ applyInvLock itm cr = case itm ^? itUse . heldParams . weaponInvLock of
applySoundCME :: Item -> Creature -> World -> World applySoundCME :: Item -> Creature -> World -> World
applySoundCME itm cr = fromMaybe id $ do applySoundCME itm cr = fromMaybe id $ do
soundid <- itm ^? itUse . heldParams . bulGunSound (soundid,x) <- itm ^? itUse . heldParams . bulGunSound
return $ soundMultiFrom [CrWeaponSound cid j | j <- [0..3]] (_crPos cr) soundid Nothing if x > 0
then return $ soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) soundid (Just x)
else return $ soundMultiFrom [CrWeaponSound cid j | j <- [0..5]] (_crPos cr) soundid Nothing
where where
cid = _crID cr cid = _crID cr
@@ -447,7 +450,10 @@ makeMuzzleFlare :: Muzzle -> Item -> Creature -> World -> World
makeMuzzleFlare mz itm cr = case mz ^. mzFlareType of makeMuzzleFlare mz itm cr = case mz ^. mzFlareType of
DefaultFlareType -> id DefaultFlareType -> id
PistolFlare -> basicMuzFlare pos dir PistolFlare -> basicMuzFlare pos dir
MiniGunFlare -> makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (pos `v2z` 20)
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
HeavySmokeFlare -> basicMuzFlare pos dir HeavySmokeFlare -> basicMuzFlare pos dir
LasGunFlare -> flareCircleAt (_lasColor $ _itParams itm) 0.8 (pos `v2z` 20)
where where
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm) pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz dir = _crDir cr + _mzRot mz
@@ -461,8 +467,10 @@ basicMuzFlare pos dir = makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (pos `v2z` 20)
makeMuzzleSmoke :: Muzzle -> Item -> Creature -> World -> World makeMuzzleSmoke :: Muzzle -> Item -> Creature -> World -> World
makeMuzzleSmoke mz itm cr w = case mz ^. mzFlareType of makeMuzzleSmoke mz itm cr w = case mz ^. mzFlareType of
DefaultFlareType -> w DefaultFlareType -> w
PistolFlare -> foldl' (flip $ smokeCloudAt (greyN 0.5) 20 400 5 . (+.+.+ pos) . (* 8)) w ps PistolFlare -> foldl' (flip $ smokeCloudAt (greyN 0.5) 5 400 5 . (+.+.+ pos) . (* 8)) w ps
MiniGunFlare -> smokeCloudAt (greyN 0.5) 5 400 5 pos w
HeavySmokeFlare -> foldl' (flip $ smokeCloudAt black 20 400 5 . (+.+.+ pos) . (* 8)) w ps' HeavySmokeFlare -> foldl' (flip $ smokeCloudAt black 20 400 5 . (+.+.+ pos) . (* 8)) w ps'
LasGunFlare -> w
where where
ps = replicateM 2 randOnUnitSphere & evalState $ _randGen w ps = replicateM 2 randOnUnitSphere & evalState $ _randGen w
ps' = replicateM 4 randOnUnitSphere & evalState $ _randGen w ps' = replicateM 4 randOnUnitSphere & evalState $ _randGen w
@@ -476,7 +484,11 @@ isAmmoIntLink _ _ = False
useLoadedAmmo :: Item -> Creature -> (CumulativeMuzzleEffect,World) -> (Muzzle,Int,Maybe Int) useLoadedAmmo :: Item -> Creature -> (CumulativeMuzzleEffect,World) -> (Muzzle,Int,Maybe Int)
-> (CumulativeMuzzleEffect,World) -> (CumulativeMuzzleEffect,World)
useLoadedAmmo _ _ (cme,w) (_,0,_) = (cme, w) useLoadedAmmo _ _ (cme,w) (_,0,_) = (cme, w)
useLoadedAmmo itm cr (cme,w) (mz,x,mid) = fromMaybe (cme,w) $ do useLoadedAmmo itm cr (cme,w) (mz,x,mid) = case _mzEffect mz of
MuzzleShootBullet ->
fromMaybe (cme,w) $ do
magid <- mid magid <- mid
-- should be able to pass the magazine in from elsewhere? -- should be able to pass the magazine in from elsewhere?
thebullet <- cr ^? crInv . ix magid . itUse . amagParams . ampBullet thebullet <- cr ^? crInv . ix magid . itUse . amagParams . ampBullet
@@ -515,17 +527,17 @@ makeBullet thebullet itm cr mz w =
Just x | x /= 0 -> fst . randomR (-x,x) $ _randGen w Just x | x /= 0 -> fst . randomR (-x,x) $ _randGen w
_ -> 0 _ -> 0
bulletGunEffect :: [(LabelDoubleTree ComposeLinkType Item --bulletGunEffect :: [(LabelDoubleTree ComposeLinkType Item
-> Creature -> World -> World) -- -> Creature -> World -> World)
-> LabelDoubleTree ComposeLinkType Item -- -> LabelDoubleTree ComposeLinkType Item
-> Creature -- -> Creature
-> World -- -> World
-> World] -- -> World]
-> LabelDoubleTree ComposeLinkType Item -- -> LabelDoubleTree ComposeLinkType Item
-> Creature -- -> Creature
-> World -- -> World
-> World -- -> World
bulletGunEffect = foldl' (&) shootBullet --bulletGunEffect = foldl' (&) shootBullet
useMod :: HeldMod -> useMod :: HeldMod ->
[(LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) [(LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World)
@@ -764,44 +776,44 @@ useMod hm = case hm of
-- , useTimeCheck -- , useTimeCheck
-- , ammoCheckI -- , ammoCheckI
-- ] -- ]
BurstRifleMod -> -- BurstRifleMod ->
[ withRecoil -- [ withRecoil
, withFlare -- , withFlare
, duplicateLoadedBarrels -- , duplicateLoadedBarrels
, useAmmoAmount 1 -- , useAmmoAmount 1
, withSoundStart tap3S -- , withSoundStart tap3S
, repeatOnFrames [3, 6] BurstRifleRepeatMod -- , repeatOnFrames [3, 6] BurstRifleRepeatMod
, lockInvFor 7 -- , lockInvFor 7
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2) -- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
, useTimeCheck -- , useTimeCheck
, ammoCheckI -- , ammoCheckI
, blCheck -- , blCheck
] -- ]
BurstRifleRepeatMod -> -- BurstRifleRepeatMod ->
[ withRecoil -- [ withRecoil
, withFlare -- , withFlare
, duplicateLoadedBarrels -- , duplicateLoadedBarrels
, useAmmoAmount 1 -- , useAmmoAmount 1
, withSoundStart tap3S -- , withSoundStart tap3S
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2) -- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
, ammoCheckI -- , ammoCheckI
] -- ]
MiniGunMod i -> -- MiniGunMod i ->
[ duplicateNumBarrels 1 -- [ duplicateNumBarrels 1
, repeatTransformed -- , repeatTransformed
[ (id, modcrpos x) -- [ (id, modcrpos x)
| x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1] -- | x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
] -- ]
, afterRecoil (fromIntegral i * 5) -- , afterRecoil (fromIntegral i * 5)
, torqueBefore (fromIntegral i * 0.05) -- , torqueBefore (fromIntegral i * 0.05)
, withSidePushI (fromIntegral i * 25) -- , withSidePushI (fromIntegral i * 25)
, withMuzFlare -- , withMuzFlare
, withSmoke 1 black 20 200 5 -- , withSmoke 1 black 20 200 5
, useAmmoAmount i -- , useAmmoAmount i
, withSoundForI mini1S 2 -- , withSoundForI mini1S 2
, withWarmUp crankSlowS -- , withWarmUp crankSlowS
, ammoCheckI -- , ammoCheckI
] -- ]
-- SmgMod -> -- SmgMod ->
-- [ withFlare -- [ withFlare
-- , withSidePushI 30 -- , withSidePushI 30
@@ -843,11 +855,11 @@ useMod hm = case hm of
-- where -- where
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just -- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
-- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p) -- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
modcrpos x cr = fromMaybe cr $ do -- modcrpos x cr = fromMaybe cr $ do
invid <- cr ^? crManipulation . manObject . inInventory . ispItem -- invid <- cr ^? crManipulation . manObject . inInventory . ispItem
return $ cr & crDir %~ tweenAngles x (_crOldDir cr) -- return $ cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ alongSegBy x (_crOldPos cr) -- & crPos %~ alongSegBy x (_crOldPos cr)
& crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x -- & crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x
lasWideRate :: Int lasWideRate :: Int
lasWideRate = 2 lasWideRate = 2
@@ -860,7 +872,7 @@ mcUseHeld hit = case hit of
useHeld :: Huse -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World useHeld :: Huse -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
useHeld hu = case hu of useHeld hu = case hu of
HeldDoNothing -> const $ const id HeldDoNothing -> const $ const id
HeldUseAmmoParams -> shootBullet -- HeldUseAmmoParams -> shootBullet
HeldOverNozzlesUseGasParams -> overNozzles useGasParams HeldOverNozzlesUseGasParams -> overNozzles useGasParams
HeldPJCreation -> usePjCreation HeldPJCreation -> usePjCreation
HeldPJCreationX _ -> usePjCreationX HeldPJCreationX _ -> usePjCreationX
+14 -14
View File
@@ -1,8 +1,9 @@
module Dodge.Item.Held.BatteryGuns where module Dodge.Item.Held.BatteryGuns where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Default.Item
import Dodge.Base import Dodge.Base
import Dodge.Data.Beam import Dodge.Data.Beam
import Dodge.Default.Item
import Color import Color
import Control.Lens import Control.Lens
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
@@ -30,13 +31,19 @@ teslaGun =
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat & itUse . heldAim . aimStance .~ TwoHandFlat
-- & itUse . heldAim . aimMuzPos .~ 4 -- & itUse . heldAim . aimMuzPos .~ 4
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 DefaultFlareType] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 DefaultFlareType MuzzleTesla]
& itType . iyBase .~ HELD TESLAGUN & itType . iyBase .~ HELD TESLAGUN
lasGun :: Item lasGun :: Item
lasGun = lasGun =
defaultAutoBatteryGun defaultHeldItem
& itType . iyModules .~ batteryModules
& itUse . heldMods .~ PistolMod
& itUse . heldParams .~ BeamShooterParams (tone440sawtoothquietS,2)
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo & itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser]
& itParams & itParams
.~ Refracting .~ Refracting
{ _phaseV = 1 { _phaseV = 1
@@ -52,14 +59,11 @@ lasGun =
& itDimension . dimRad .~ 10 & itDimension . dimRad .~ 10
& itDimension . dimCenter .~ V3 15 0 0 & itDimension . dimCenter .~ V3 15 0 0
-- & itUse . heldUse .~ HeldLaser --shootLaser -- & itUse . heldUse .~ HeldLaser --shootLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ LasMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandUnder & itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
-- & itUse . heldAim . aimMuzPos .~ 30 -- & itUse . heldAim . aimMuzPos .~ 30
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType]
& itType . iyBase .~ HELD LASGUN & itType . iyBase .~ HELD LASGUN
lasGunTweak :: TweakParam lasGunTweak :: TweakParam
@@ -84,7 +88,7 @@ tractorGun =
& itUse . heldMods .~ TractorMod & itUse . heldMods .~ TractorMod
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleTractor]
& itType . iyBase .~ HELD TRACTORGUN & itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam tractorGunTweak :: TweakParam
@@ -102,7 +106,8 @@ lasWide n =
& itParams . lasColor .~ yellow & itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2 & itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n & itUse . heldMods .~ LasWideMod n
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType | y <- spreadFromCenter n 1] & itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item defaultBatteryGun :: Item
defaultBatteryGun = defaultBatteryGun =
@@ -116,11 +121,6 @@ batteryModules =
, (ModTeleport, EMPTYMODULE) , (ModTeleport, EMPTYMODULE)
] ]
defaultAutoBatteryGun :: Item
defaultAutoBatteryGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
--lasCircle :: Item --lasCircle :: Item
--lasCircle = --lasCircle =
-- lasGun -- lasGun
@@ -137,7 +137,7 @@ dualBeam :: Item
dualBeam = dualBeam =
lasGun lasGun
& itType . iyBase .~ HELD DUALBEAM & itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser]
& itParams & itParams
.~ DualBeam .~ DualBeam
{ _phaseV = 1 { _phaseV = 1
+17 -19
View File
@@ -6,6 +6,7 @@ module Dodge.Item.Held.Cane (
miniGunX, miniGunX,
) where ) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Base import Dodge.Base
import Dodge.Data.Item import Dodge.Data.Item
import Dodge.Default import Dodge.Default
@@ -27,7 +28,7 @@ defaultBangCane =
-- & itUse . heldMods .~ BangCaneMod -- & itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand & itUse . heldAim . aimStance .~ OneHand
-- & itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
volleyGun :: Int -> Item volleyGun :: Int -> Item
volleyGun i = volleyGun i =
@@ -41,9 +42,10 @@ volleyGun i =
(ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6] (ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
<*> ZipList [0..i-1] <*> ZipList [0..i-1]
<*> pure PistolFlare <*> pure PistolFlare
<*> pure MuzzleShootBullet
) )
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i & itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itUse . heldParams . recoil .~ 10 + 5 * fromIntegral i & itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i) & itType . iyBase .~ HELD (VOLLEYGUN i)
& itUse . heldAmmoTypes .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo) & itUse . heldAmmoTypes .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
@@ -55,7 +57,7 @@ rifle =
& itUse . heldAim . aimWeight .~ 6 & itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01 0 PistolFlare] & itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 25 0
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE & itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
--repeater :: Item --repeater :: Item
@@ -84,27 +86,23 @@ burstRifle =
& itUse . heldParams . weaponInvLock .~ 7 & itUse . heldParams . weaponInvLock .~ 7
& itUse . heldParams . weaponRepeat .~ [3,6] & itUse . heldParams . weaponRepeat .~ [3,6]
miniGunUse :: Int -> ItemUse
miniGunUse i =
defaultHeldUse
-- & heldUse .~ HeldUseAmmoParams
& heldMods .~ MiniGunMod i
& heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
& heldAim . aimWeight .~ 6
& heldAim . aimRange .~ 1
& heldAim . aimStance .~ TwoHandUnder
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& heldAmmoTypes .~ singleAmmo BeltBulletAmmo
miniGunX :: Int -> Item miniGunX :: Int -> Item
miniGunX i = miniGunX i =
autoRifle autoRifle
& itUse .~ miniGunUse i & itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100, _warmSound = crankSlowS}
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAmmoTypes .~ singleAmmo BeltBulletAmmo
& itUse . heldParams . bulGunSound .~ (mini1S,2)
& itUse . heldAim . aimTurnSpeed .~ 0.5 & itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05 0 DefaultFlareType) & itUse . heldAim . aimMuzzles
& itUse . heldParams . recoil .~ 10 .~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
& itUse . heldParams . torqueAfter .~ 0.01 & itUse . heldParams . recoil .~ 10 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
& itUse . heldParams . randomOffset .~ 10 & itUse . heldParams . randomOffset .~ 10
& itUse . heldParams . rifling .~ UniRandFloat 0.8 0.9
& itInvSize .~ fromIntegral i + 1 & itInvSize .~ fromIntegral i + 1
& itDimension . dimRad .~ 20 & itDimension . dimRad .~ 20
& itDimension . dimCenter .~ V3 5 0 0 & itDimension . dimCenter .~ V3 5 0 0
+3 -2
View File
@@ -16,13 +16,14 @@ bangCone =
& itUse . heldDelay . rateMax .~ 20 & itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ PistolMod & itUse . heldMods .~ PistolMod
-- & itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType) & itUse . heldAim . aimMuzzles
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet)
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8 & itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8 & itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
& itUse . heldParams . recoil .~ 150 & itUse . heldParams . recoil .~ 150
& itUse . heldParams . torqueAfter .~ 0.1 & itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldParams . randomOffset .~ 12 & itUse . heldParams . randomOffset .~ 12
& itUse . heldParams . bulGunSound .~ bangEchoS & itUse . heldParams . bulGunSound .~ (bangEchoS,0)
& itType . iyBase .~ HELD BANGCONE & itType . iyBase .~ HELD BANGCONE
blunderbuss :: Item blunderbuss :: Item
+8 -2
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Held.Launcher where module Dodge.Item.Held.Launcher where
import Control.Applicative
import Dodge.Default.Item import Dodge.Default.Item
--import Dodge.Reloading.Action --import Dodge.Reloading.Action
import Control.Lens import Control.Lens
@@ -31,7 +32,7 @@ launcher =
& itUse . heldAim . aimStance .~ TwoHandOver & itUse . heldAim . aimStance .~ TwoHandOver
-- & itUse . heldAim . aimHandlePos .~ V2 3 0 -- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20 -- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType MuzzleLauncher]
& itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo & itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo
& itType . iyBase .~ HELD LAUNCHER & itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE & itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
@@ -42,7 +43,12 @@ launcherX i =
& itType . iyBase .~ HELD (LAUNCHERX i) & itType . iyBase .~ HELD (LAUNCHERX i)
-- & itUse . heldUse .~ HeldPJCreationX i -- & itUse . heldUse .~ HeldPJCreationX i
& itUse . heldMods .~ LauncherXMod i & itUse . heldMods .~ LauncherXMod i
& itUse . heldAim . aimMuzzles .~ ([Muzzle (V2 20 0) a 0 | a <- angles] <*> [0..] <*> [DefaultFlareType]) & itUse . heldAim . aimMuzzles .~ getZipList
(ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
<*> ZipList [0..]
<*> pure DefaultFlareType
<*> pure MuzzleLauncher
)
where where
angles = take i [0,2*pi/ fromIntegral i ..] angles = take i [0,2*pi/ fromIntegral i ..]
--angles = take i [1,2 ..] --angles = take i [1,2 ..]
+7 -5
View File
@@ -21,7 +21,7 @@ bangRod =
& itUse . heldParams . rifling .~ ConstFloat 1 & itUse . heldParams . rifling .~ ConstFloat 1
& itUse . heldParams . recoil .~ 50 & itUse . heldParams . recoil .~ 50
& itUse . heldParams . torqueAfter .~ 0.3 & itUse . heldParams . torqueAfter .~ 0.3
& itUse . heldParams . bulGunSound .~ bangEchoS & itUse . heldParams . bulGunSound .~ (bangEchoS,0)
& itUse . heldDelay . rateMax .~ 12 & itUse . heldDelay . rateMax .~ 12
& itDimension . dimRad .~ 12 & itDimension . dimRad .~ 12
& itDimension . dimCenter .~ V3 5 0 0 & itDimension . dimCenter .~ V3 5 0 0
@@ -31,7 +31,7 @@ bangRod =
& itUse . heldAim . aimStance .~ OneHand & itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5 -- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare MuzzleShootBullet]
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo -- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item elephantGun :: Item
@@ -63,12 +63,14 @@ machineGun :: Item
machineGun = machineGun =
bangRod bangRod
& itType . iyBase .~ HELD MACHINEGUN & itType . iyBase .~ HELD MACHINEGUN
& itUse . heldDelay . rateMax .~ 25 -- & itUse . heldMods .~ MachineGunMod
& itUse . heldMods .~ MachineGunMod & itUse . heldMods .~ PistolMod
& itUse . heldAim . aimWeight .~ 8 & itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1 & itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandUnder & itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0} & itUse . heldDelay .~ VariableRate
{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itInvSize .~ 3 & itInvSize .~ 3
& itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary? & itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
& itUse . heldTriggerType .~ AutoTrigger
+1 -1
View File
@@ -88,7 +88,7 @@ flameThrower =
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5} & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandUnder & itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 0 -- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType MuzzleFlame]
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo & itUse . heldAmmoTypes .~ singleAmmo GasAmmo
& itType . iyBase .~ HELD FLAMETHROWER & itType . iyBase .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud & itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
+4 -3
View File
@@ -27,7 +27,7 @@ bangStick i =
-- & itUse . heldMods .~ BangStickMod -- & itUse . heldMods .~ BangStickMod
& itUse . heldMods .~ PistolMod & itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles & itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType | a <- spreadAroundCenter i baseStickSpread] .~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet | a <- spreadAroundCenter i baseStickSpread]
baseStickSpread :: Float baseStickSpread :: Float
baseStickSpread = 0.2 baseStickSpread = 0.2
@@ -55,14 +55,15 @@ autoPistol =
pistol pistol
& itUse . heldMods .~ PistolMod & itUse . heldMods .~ PistolMod
& itUse . heldTriggerType .~ AutoTrigger & itUse . heldTriggerType .~ AutoTrigger
& itUse . heldParams . bulGunSound .~ tap1S & itUse . heldParams . bulGunSound .~ (tap1S,0)
& itType . iyBase .~ HELD AUTOPISTOL & itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE & itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item machinePistol :: Item
machinePistol = machinePistol =
autoPistol autoPistol
& itUse . heldDelay . rateMax .~ 2 & itUse . heldDelay .~ WarmUpNoDelay {_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
--rateMax .~ 2
& itUse . heldMods .~ PistolMod -- (ammoCheckI : machinePistolAfterHamMods) & itUse . heldMods .~ PistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL & itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing & itType . iyModules . at ModAutoMag .~ Nothing
+10 -3
View File
@@ -214,7 +214,7 @@ withWarmUp soundID f item cr w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2) & soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
| otherwise = | otherwise =
w w
& pointertoitem . itUse . heldDelay . warmTime .~ maxWarmUp & pointertoitem . itUse . heldDelay . warmTime .~ (maxWarmUp + 1)
& f item cr & f item cr
where where
item' = _ldtValue item item' = _ldtValue item
@@ -376,8 +376,15 @@ useAmmoAmount amAmount eff item cr = fromMaybe id $ do
Applies a world effect after an item use cooldown check. Applies a world effect after an item use cooldown check.
-} -}
useTimeCheck :: ChainEffect useTimeCheck :: ChainEffect
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay . rateTime of useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just 0 -> f item cr $ setUseTime w Just (FixedRate _ 0) -> f item cr $ setUseTime w
Just (FixedRate _ _) -> w
Just (WarmUpNoDelay wt wm ws) | wt < wm -> w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) ws (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime +~2
Just (WarmUpNoDelay _ wm _) -> f item cr w
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime .~ (wm+1)
Just NoDelay -> f item cr w
_ -> w _ -> w
where where
cid = _crID cr cid = _crID cr
+6 -2
View File
@@ -20,8 +20,12 @@ fixedCoordPictures u =
<> drawConcurrentMessage u <> drawConcurrentMessage u
<> customMouseCursor u <> customMouseCursor u
<> toTopLeft cfig (translate (halfWidth cfig) 0 $ drawList (map text (_uvTestString u u))) <> toTopLeft cfig (translate (halfWidth cfig) 0 $ drawList (map text (_uvTestString u u)))
<> toTopLeft cfig (translate (0.5 * halfWidth cfig) (- halfHeight cfig) <> toTopLeft cfig
$ drawList (map text (u ^. uvWorld . cWorld . lWorld . lTestString))) (translate (0.5 * halfWidth cfig) (- halfHeight cfig)
$ drawList $ map text $
show (u ^. uvWorld . cWorld . lWorld . lTestInt)
: (u ^. uvWorld . cWorld . lWorld . lTestString)
)
<> displayFrameTicks u <> displayFrameTicks u
where where
cfig = _uvConfig u cfig = _uvConfig u
+201 -197
View File
File diff suppressed because it is too large Load Diff