Continue weapon refactor, gas combinations

This commit is contained in:
2024-09-19 09:49:56 +01:00
parent 6f972bb316
commit bb18831393
21 changed files with 489 additions and 379 deletions
+3 -1
View File
@@ -269,9 +269,12 @@ testInventory =
stackedInventory :: [Item]
stackedInventory =
[ burstRifle
, poisonSprayer
, chemFuelPouch
, megaTinMag
, teslaGun
, lasGun
, tractorGun
, megaBattery
, bulletSynthesizer
, drumMag
@@ -299,7 +302,6 @@ stackedInventory =
, spawnGun (lamp 5)
, lasGun
, lasWide 20
, flameThrower
, poisonSprayer
, bulletBeltPack
, bulletBeltBracer
+1 -1
View File
@@ -10,7 +10,7 @@ import Data.Aeson.TH
data GenFloat = ConstFloat {_gfConstant :: Float}
| UniRandFloat {_gfMin :: Float, _gfMax :: Float}
deriving (Eq, Show, Read) --Generic, Flat)
deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''GenFloat
deriveJSON defaultOptions ''GenFloat
+1
View File
@@ -113,6 +113,7 @@ data AmmoMagType
| BELTMAG
| SHELLMAG
| BATTERY
| CHEMFUELPOUCH
deriving (Eq, Ord, Show, Read)
+7 -7
View File
@@ -66,17 +66,18 @@ data Luse
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data HeldMod
= PoisonSprayerMod
= PistolMod
-- | PoisonSprayerMod
| FlameSpitterMod
| FlameSpitterRepeatMod
| FlameThrowerMod
| LauncherMod
-- | FlameThrowerMod
-- | LauncherMod
-- | TeslaMod
-- | CircleLaserMod
| LasWideMod Int
| DualBeamMod
| LasMod
| LauncherXMod Int
-- | LasMod
-- | LauncherXMod Int
| ShatterMod
-- | AmmoCheckMod
-- | AmmoUseCheckMod
@@ -91,7 +92,6 @@ data HeldMod
-- | MachineGunMod
-- | ModWithDirectedTeleport HeldMod
-- | BangStickMod
| PistolMod
-- | AutoPistolMod
-- | MachinePistolMod
-- | BurstRifleMod
@@ -99,7 +99,7 @@ data HeldMod
-- | MiniGunMod Int
-- | SmgMod
-- | BangConeMod
| TractorMod --apply with AmmoCheckMod
-- | TractorMod --apply with AmmoCheckMod
| FireRemoteShellMod
| ExplodeRemoteShellMod
| DoNothingMod
-8
View File
@@ -44,7 +44,6 @@ data ItemParams
, _dbGap :: Float
}
| Attracting {_attractionPower :: Point2}
| Sprayer {_sprayNozzles :: [Nozzle]}
| AngleWalk
{ _maxWalkAngle :: Float
, _currentWalkAngle :: Float
@@ -79,13 +78,6 @@ data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Nozzle = Nozzle
{ _nzPressure :: Float
, _nzDir :: Float
, _nzMaxWalkAngle :: Float
, _nzCurrentWalkAngle :: Float
, _nzWalkSpeed :: Float
, _nzLength :: Float
}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''ItemParams
+20 -6
View File
@@ -74,9 +74,19 @@ data TriggerType = AutoTrigger
data HeldParams
= DefaultHeldParams
| GasSprayParams
{_gasCreation :: GasCreate}
{_gasCreation :: GasCreate
, _recoil :: Float
, _torqueAfter :: Float
, _randomOffset :: Float
, _sidePush :: Float
, _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- if >0, continue playing sound for
-- given time
, _weaponInvLock :: Int
, _weaponRepeat :: [Int]
}
| BeamShooterParams
{ _bulGunSound :: (SoundID, Int) -- if the int is 0, play sound on new channel
{ _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- TODO remove duplicate
}
| BulletShooterParams
@@ -86,7 +96,7 @@ data HeldParams
, _torqueAfter :: Float
, _randomOffset :: Float
, _sidePush :: Float
, _bulGunSound :: (SoundID, Int) -- if the int is 0, play sound on new channel
, _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- if >0, continue playing sound for
-- given time
, _weaponInvLock :: Int
@@ -106,7 +116,7 @@ data AmmoParams = BulletParams {_ampBullet :: Bullet}
, _ampPjDraw :: ProjectileDraw
, _ampPjCreation :: ProjectileCreate
}
| GasParams {_ampCreateGas :: GasCreate}
| GasParams {_ampCreateGas :: GasFuel}
deriving (Eq, Show, Read) --Generic, Flat)
data ScrollAttachParams
@@ -147,8 +157,12 @@ data MuzzleEffect
| MuzzleTesla
| MuzzleTractor
| MuzzleLauncher
| MuzzleFlame
| MuzzleGas
| MuzzleNozzle
{ _nzPressure :: GenFloat
, _nzMaxWalkAngle :: Float
, _nzCurrentWalkAngle :: Float
, _nzWalkSpeed :: Float
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Muzzle = Muzzle
@@ -46,11 +46,15 @@ data AmmoType
data ForceFieldType = DefaultForceField
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data GasFuel = ChemFuel
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
makeLenses ''ProjectileUpdate
makeLenses ''AmmoType
deriveJSON defaultOptions ''GasFuel
deriveJSON defaultOptions ''ProjectileDraw
deriveJSON defaultOptions ''ProjectileCreate
deriveJSON defaultOptions ''ProjectileUpdate
+1 -1
View File
@@ -42,7 +42,7 @@ defaultHeldUse =
, _torqueAfter = 0.2
, _randomOffset = 0
, _sidePush = 0
, _bulGunSound = (tap3S, 0)
, _bulGunSound = Just (tap3S, 0)
, _weaponInvLock = 0
, _weaponRepeat = []
}
+189 -166
View File
@@ -44,42 +44,42 @@ import Sound.Data
heldEffect :: HeldMod -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
heldEffect effecttype = case effecttype of
-- HeldModNothing -> const $ const id
PoisonSprayerMod -> gasEffect
[ useAmmoAmount 1
, withSoundForI foamSprayLoopS 5
, ammoCheckI
]
FlameSpitterMod -> gasEffect
[ withSidePushAfterI 20
, withSidePushI 5
, useAmmoAmount 1
, withRandomItemParams f
, repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
, lockInvFor 10
, useTimeCheck
, ammoCheckI
]
FlameSpitterRepeatMod -> gasEffect
[ withSidePushAfterI 20
, withSidePushI 5
, useAmmoAmount 1
, withRandomItemParams f
, ammoCheckI
]
FlameThrowerMod -> gasEffect
[ withSidePushAfterI 20
, --, withTempLight 1 100 (V3 1 0 0)
withSidePushI 5
, useAmmoAmount 1
, ammoCheckI
]
LauncherMod -> foldl' (&) usePjCreation
--[ useAmmoAmount 1
-- , withSoundStart tap4S
[ useTimeCheck
-- PoisonSprayerMod -> gasEffect
-- [ useAmmoAmount 1
-- , withSoundForI foamSprayLoopS 5
-- , ammoCheckI
, blCheck
]
-- ]
-- FlameSpitterMod -> gasEffect
-- [ withSidePushAfterI 20
-- , withSidePushI 5
-- , useAmmoAmount 1
-- , withRandomItemParams f
-- , repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
-- , lockInvFor 10
-- , useTimeCheck
-- , ammoCheckI
-- ]
-- FlameSpitterRepeatMod -> gasEffect
-- [ withSidePushAfterI 20
-- , withSidePushI 5
-- , useAmmoAmount 1
-- , withRandomItemParams f
-- , ammoCheckI
-- ]
-- FlameThrowerMod -> gasEffect
-- [ withSidePushAfterI 20
-- , --, withTempLight 1 100 (V3 1 0 0)
-- withSidePushI 5
-- , useAmmoAmount 1
-- , ammoCheckI
-- ]
-- LauncherMod -> foldl' (&) usePjCreation
-- --[ useAmmoAmount 1
---- , withSoundStart tap4S
-- [ useTimeCheck
---- , ammoCheckI
-- , blCheck
-- ]
-- TeslaMod -> foldl' (&) (shootTeslaArc . _ldtValue)
-- [ useAmmoAmount 1
-- , withSoundForI elecCrackleS 1
@@ -107,21 +107,21 @@ heldEffect effecttype = case effecttype of
, withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, ammoCheckI
]
LasMod -> foldl' (&) (shootLaser . _ldtValue)
[ useAmmoAmount 1
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, duplicateLoadedBarrels
, ammoCheckI
]
LauncherXMod _ -> foldl' (&) usePjCreationX
--[ useAmmoAmount i
--, withSoundStart tap4S
[ useTimeCheck
--, ammoCheckI
, blCheck
]
-- LasMod -> foldl' (&) (shootLaser . _ldtValue)
-- [ useAmmoAmount 1
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withSoundForI tone440sawtoothquietS 2
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , duplicateLoadedBarrels
-- , ammoCheckI
-- ]
-- LauncherXMod _ -> foldl' (&) usePjCreationX
-- --[ useAmmoAmount i
-- --, withSoundStart tap4S
-- [ useTimeCheck
-- --, ammoCheckI
-- , blCheck
-- ]
ShatterMod -> foldl' (&) (shootShatter . _ldtValue)
[ useAmmoAmount 1
, -- , withSoundStart tap3S
@@ -315,16 +315,16 @@ heldEffect effecttype = case effecttype of
-- , ammoCheckI
-- , blCheck
-- ]
TractorMod -> foldl' (&) (aTractorBeam . _ldtValue) [ammoCheckI]
-- TractorMod -> foldl' (&) (aTractorBeam . _ldtValue) [ammoCheckI]
FireRemoteShellMod -> undefined
ExplodeRemoteShellMod -> undefined
DoNothingMod -> const $ const id
ForceFieldMod -> undefined
DetectorMod _ -> undefined
where
f = do
nzpres <- state $ randomR (3, 4)
return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
-- f = do
-- nzpres <- state $ randomR (3, 4)
-- return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
increasecycleLasWide n it = case _heldHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
@@ -339,17 +339,17 @@ heldEffect effecttype = case effecttype of
-- & crPos %~ alongSegBy x (_crOldPos cr)
-- & crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x
gasEffect :: [(LabelDoubleTree ComposeLinkType Item
-> Creature -> World -> World)
-> LabelDoubleTree ComposeLinkType Item
-> Creature
-> World
-> World]
-> LabelDoubleTree ComposeLinkType Item
-> Creature
-> World
-> World
gasEffect = foldl' (&) (overNozzles useGasParams)
--gasEffect :: [(LabelDoubleTree ComposeLinkType Item
-- -> Creature -> World -> World)
-- -> LabelDoubleTree ComposeLinkType Item
-- -> Creature
-- -> World
-- -> World]
-- -> LabelDoubleTree ComposeLinkType Item
-- -> Creature
-- -> World
-- -> World
--gasEffect = foldl' (&) (overNozzles useGasParams)
bulGunEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
bulGunEffect = hammerCheck $ useTimeCheck bulGunEffect'
@@ -392,7 +392,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
(soundid,x) <- itm ^? itUse . heldParams . bulGunSound . _Just
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
@@ -455,6 +455,8 @@ makeMuzzleFlare mz itm cr = case mz ^. mzFlareType of
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
HeavySmokeFlare -> basicMuzFlare pos dir
LasGunFlare -> flareCircleAt (_lasColor $ _itParams itm) 0.8 (pos `v2z` 20)
. (cWorld . lWorld . tempLightSources .:~
tlsTimeRadColPos 1 100 (xyzV4 . _lasColor $ _itParams itm) (pos `v2z` 10))
TeslaGunFlare -> cWorld . lWorld . tempLightSources .:~
tlsTimeRadColPos 1 100 (V3 0 0 1) (pos `v2z` 10)
where
@@ -496,6 +498,17 @@ useLoadedAmmo itm cr (cme,w) (mz,x,mid) = (,) (cme & cmeSound .~ True) $
MuzzleTesla -> shootTeslaArc itm cr mz w
MuzzleTractor -> shootTractorBeam itm cr w
MuzzleLauncher -> createProjectile' mid mz itm cr w
MuzzleNozzle {} -> useGasParams mid mz itm cr $ walkNozzle mz itm cr w
walkNozzle mz itm cr w = w
& randGen .~ g
where
nz = _mzEffect mz
(walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
aspeed = _nzWalkSpeed nz
maxa = _nzMaxWalkAngle nz
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
shootTractorBeam :: Item -> Creature -> World -> World
shootTractorBeam _ cr w = w & cWorld . lWorld . tractorBeams .:~ tractorBeamAt' spos outpos dir power
@@ -600,42 +613,42 @@ useMod hm = case hm of
ForceFieldMod -> undefined
DetectorMod _ -> undefined
-- HeldModNothing -> []
PoisonSprayerMod ->
[ useAmmoAmount 1
, withSoundForI foamSprayLoopS 5
, ammoCheckI
]
FlameSpitterMod ->
[ withSidePushAfterI 20
, withSidePushI 5
, useAmmoAmount 1
, withRandomItemParams f
, repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
, lockInvFor 10
, useTimeCheck
, ammoCheckI
]
FlameSpitterRepeatMod ->
[ withSidePushAfterI 20
, withSidePushI 5
, useAmmoAmount 1
, withRandomItemParams f
, ammoCheckI
]
FlameThrowerMod ->
[ withSidePushAfterI 20
, --, withTempLight 1 100 (V3 1 0 0)
withSidePushI 5
, useAmmoAmount 1
, ammoCheckI
]
LauncherMod ->
--[ useAmmoAmount 1
-- , withSoundStart tap4S
[ useTimeCheck
-- PoisonSprayerMod ->
-- [ useAmmoAmount 1
-- , withSoundForI foamSprayLoopS 5
-- , ammoCheckI
, blCheck
]
-- ]
-- FlameSpitterMod ->
-- [ withSidePushAfterI 20
-- , withSidePushI 5
-- , useAmmoAmount 1
-- , withRandomItemParams f
-- , repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
-- , lockInvFor 10
-- , useTimeCheck
-- , ammoCheckI
-- ]
-- FlameSpitterRepeatMod ->
-- [ withSidePushAfterI 20
-- , withSidePushI 5
-- , useAmmoAmount 1
-- , withRandomItemParams f
-- , ammoCheckI
-- ]
-- FlameThrowerMod ->
-- [ withSidePushAfterI 20
-- , --, withTempLight 1 100 (V3 1 0 0)
-- withSidePushI 5
-- , useAmmoAmount 1
-- , ammoCheckI
-- ]
-- LauncherMod ->
-- --[ useAmmoAmount 1
---- , withSoundStart tap4S
-- [ useTimeCheck
---- , ammoCheckI
-- , blCheck
-- ]
-- TeslaMod ->
-- [ useAmmoAmount 1
-- , withSoundForI elecCrackleS 1
@@ -672,21 +685,21 @@ useMod hm = case hm of
, withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, ammoCheckI
]
LasMod ->
[ useAmmoAmount 1
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, duplicateLoadedBarrels
, ammoCheckI
]
LauncherXMod _ ->
--[ useAmmoAmount i
--, withSoundStart tap4S
[ useTimeCheck
--, ammoCheckI
, blCheck
]
-- LasMod ->
-- [ useAmmoAmount 1
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withSoundForI tone440sawtoothquietS 2
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , duplicateLoadedBarrels
-- , ammoCheckI
-- ]
-- LauncherXMod _ ->
-- --[ useAmmoAmount i
-- --, withSoundStart tap4S
-- [ useTimeCheck
-- --, ammoCheckI
-- , blCheck
-- ]
ShatterMod ->
[ useAmmoAmount 1
, -- , withSoundStart tap3S
@@ -891,9 +904,9 @@ useMod hm = case hm of
-- , blCheck
-- ]
where
f = do
nzpres <- state $ randomR (3, 4)
return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
-- f = do
-- nzpres <- state $ randomR (3, 4)
-- return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
--increasecycleLasCircle it = it & itParams . lasCycle %~ (flip mod 2000 . (+ 1))
----f it = [it & itParams . lasCycle +~ x | x <- [0,100 .. 1900] ]
--fLasCircle it = [it & itParams . lasCycle +~ x | x <- [0, 50 .. 1999]]
@@ -923,7 +936,7 @@ useHeld :: Huse -> LabelDoubleTree ComposeLinkType Item -> Creature -> World ->
useHeld hu = case hu of
HeldDoNothing -> const $ const id
-- HeldUseAmmoParams -> shootBullet
HeldOverNozzlesUseGasParams -> overNozzles useGasParams
-- HeldOverNozzlesUseGasParams -> overNozzles useGasParams
HeldPJCreation -> usePjCreation
HeldPJCreationX _ -> usePjCreationX
HeldFireRemoteShell -> fireRemoteShell
@@ -956,45 +969,45 @@ usePjCreationX = undefined
-- where
-- f (muz,am) = (createProjectile am muz itm cr .)
overNozzles ::
(Nozzle -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) ->
LabelDoubleTree ComposeLinkType Item ->
Creature ->
World ->
World
overNozzles = overNozzles' . overNozzle
--overNozzles ::
-- (Nozzle -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) ->
-- LabelDoubleTree ComposeLinkType Item ->
-- Creature ->
-- World ->
-- World
--overNozzles = overNozzles' . overNozzle
overNozzles' ::
(LabelDoubleTree ComposeLinkType Item -> Creature -> World -> Nozzle -> (World, Nozzle)) ->
LabelDoubleTree ComposeLinkType Item ->
Creature ->
World ->
World
overNozzles' eff itm cr w = neww
& cWorld . lWorld . creatures . ix cid . crInv . ix i . itParams . sprayNozzles .~ newNozzles
where
it = itm ^. ldtValue
cid = _crID cr
i = w ^?! cWorld . lWorld . creatures . ix cid . crManipulation . manObject . inInventory . ispItem
(neww, newNozzles) = mapAccumR (eff itm cr) w $ _sprayNozzles (_itParams it)
--overNozzles' ::
-- (LabelDoubleTree ComposeLinkType Item -> Creature -> World -> Nozzle -> (World, Nozzle)) ->
-- LabelDoubleTree ComposeLinkType Item ->
-- Creature ->
-- World ->
-- World
--overNozzles' eff itm cr w = neww
-- & cWorld . lWorld . creatures . ix cid . crInv . ix i . itParams . sprayNozzles .~ newNozzles
-- where
-- it = itm ^. ldtValue
-- cid = _crID cr
-- i = w ^?! cWorld . lWorld . creatures . ix cid . crManipulation . manObject . inInventory . ispItem
-- (neww, newNozzles) = mapAccumR (eff itm cr) w $ _sprayNozzles (_itParams it)
overNozzle ::
(Nozzle -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) ->
LabelDoubleTree ComposeLinkType Item ->
Creature ->
World ->
Nozzle ->
(World, Nozzle)
overNozzle eff itm cr w nz =
( eff nz itm (cr & crDir +~ wa + na) w & randGen .~ g
, nz & nzCurrentWalkAngle .~ wa
)
where
na = _nzDir nz
(walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
aspeed = _nzWalkSpeed nz
maxa = _nzMaxWalkAngle nz
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
--overNozzle ::
-- (Nozzle -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) ->
-- LabelDoubleTree ComposeLinkType Item ->
-- Creature ->
-- World ->
-- Nozzle ->
-- (World, Nozzle)
--overNozzle eff itm cr w nz =
-- ( eff nz itm (cr & crDir +~ wa + na) w & randGen .~ g
-- , nz & nzCurrentWalkAngle .~ wa
-- )
-- where
-- na = _nzDir nz
-- (walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
-- aspeed = _nzWalkSpeed nz
-- maxa = _nzMaxWalkAngle nz
-- wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
getAmmoMagazine :: Item -> Creature -> Maybe ItemUse
getAmmoMagazine itm cr = do
@@ -1005,22 +1018,32 @@ getAmmoMagazine itm cr = do
guard $ amtype == magtype
return mag
useGasParams :: Nozzle -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
useGasParams nz itm cr =
useGasParams :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
useGasParams mmagid mz itm cr w =
createGas
gastype
(_nzPressure nz)
pressure
pos
dir
cr
w & randGen .~ g'
where
(pressure,g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w)
gastype = fromMaybe (error "cannot find gas ammo") $ do
atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0
leftitms <- itm ^? ldtLeft
mag <- lookup (AmmoInLink 0 atype) leftitms
mag ^? ldtValue . itUse . amagParams . ampCreateGas
dir = _crDir cr
pos = _crPos cr +.+ (_nzLength nz *.* unitVectorAtAngle (_crDir cr))
magid <- mmagid
fueltype <- cr ^? crInv . ix magid . itUse . amagParams . ampCreateGas
gc <- itm ^? itUse . heldParams . gasCreation
return $ gasCreate fueltype gc
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
(a,g') = randomR (-inacc,inacc) g
inacc = _mzInaccuracy mz
dir = _crDir cr + _mzRot mz + a
gasCreate :: GasFuel -> GasCreate -> GasCreate
gasCreate = flip const
doGenFloat (ConstFloat x) g = (x,g)
doGenFloat (UniRandFloat x y) g = randomR (x,y) g
fireRemoteShell :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
fireRemoteShell = undefined
+1
View File
@@ -34,6 +34,7 @@ itemFromAmmoMag at = case at of
BELTMAG -> beltMag
SHELLMAG -> shellMag
BATTERY -> battery
CHEMFUELPOUCH -> chemFuelPouch
itemFromAttachType :: AttachType -> Item
itemFromAttachType at = case at of
+14
View File
@@ -87,6 +87,20 @@ battery =
}
}
chemFuelPouch :: Item
chemFuelPouch =
defaultHeldItem & itType . iyBase .~ AMMOMAG CHEMFUELPOUCH
& itUse
.~ AmmoMagUse
{ _amagParams = GasParams ChemFuel
, _amagType = GasAmmo
, _amagLoadStatus =
ReloadStatus
{ _iaMax = 1000
, _iaLoaded = 1000
}
}
bulletSynthesizer :: Item
bulletSynthesizer = defaultHeldItem
& itType . iyBase .~ ATTACH BULLETSYNTHESIZER
+3 -3
View File
@@ -22,7 +22,7 @@ sparkGun =
teslaGun :: Item
teslaGun =
defaultBatteryGun
& itUse . heldParams .~ BeamShooterParams (elecCrackleS,2)
& itUse . heldParams .~ BeamShooterParams (Just (elecCrackleS,2))
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 4 0 0
& itParams .~ teslaParams
@@ -42,7 +42,7 @@ lasGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
& itUse . heldMods .~ PistolMod
& itUse . heldParams .~ BeamShooterParams (tone440sawtoothquietS,2)
& itUse . heldParams .~ BeamShooterParams (Just (tone440sawtoothquietS,2))
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldTriggerType .~ AutoTrigger
@@ -88,7 +88,7 @@ tractorGun =
-- & itUse . heldUse .~ HeldTractor --aTractorBeam
& itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ AmmoCheckMod
& itUse . heldMods .~ TractorMod
-- & itUse . heldMods .~ TractorMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleTractor]
+1 -1
View File
@@ -94,7 +94,7 @@ miniGunX i =
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAmmoTypes .~ singleAmmo BeltBulletAmmo
& itUse . heldParams . bulGunSound .~ (mini1S,2)
& itUse . heldParams . bulGunSound ?~ (mini1S,2)
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
+1 -1
View File
@@ -23,7 +23,7 @@ bangCone =
& itUse . heldParams . recoil .~ 150
& itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldParams . randomOffset .~ 12
& itUse . heldParams . bulGunSound .~ (bangEchoS,0)
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
& itType . iyBase .~ HELD BANGCONE
blunderbuss :: Item
+1 -1
View File
@@ -42,7 +42,7 @@ launcher =
& itUse . heldParams . rifling .~ ConstFloat 0
& itUse . heldParams . recoil .~ 0
& itUse . heldParams . torqueAfter .~ 0
& itUse . heldParams . bulGunSound .~ (tap4S, 0)
& itUse . heldParams . bulGunSound ?~ (tap4S, 0)
launcherX :: Int -> Item
launcherX i =
+1 -1
View File
@@ -21,7 +21,7 @@ bangRod =
& itUse . heldParams . rifling .~ ConstFloat 1
& itUse . heldParams . recoil .~ 50
& itUse . heldParams . torqueAfter .~ 0.3
& itUse . heldParams . bulGunSound .~ (bangEchoS,0)
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
& itUse . heldDelay . rateMax .~ 12
& itDimension . dimRad .~ 12
& itDimension . dimCenter .~ V3 5 0 0
+47 -37
View File
@@ -7,6 +7,7 @@ module Dodge.Item.Held.SprayGuns (
flameWall,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.Item
import Dodge.Default.Item
--import Dodge.Reloading.Action
@@ -18,14 +19,19 @@ poisonSprayer =
flameThrower
& itType . iyBase .~ HELD POISONSPRAYER
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo
& itUse . heldParams .~ GasSprayParams CreatePoisonGas --aGasCloud
& itUse . heldMods .~ PoisonSprayerMod
-- & itUse . heldMods .~ PoisonSprayerMod
& itUse . heldParams . gasCreation .~ CreatePoisonGas --aGasCloud
& itUse . heldParams . recoil .~ 0
& itUse . heldParams . torqueAfter .~ 0
& itUse . heldParams . randomOffset .~ 0
& itUse . heldParams . sidePush .~ 0
& itUse . heldParams . bulGunSound ?~ (foamSprayLoopS,5)
flameSpitter :: Item
flameSpitter =
flameThrower
& itType . iyBase .~ HELD FLAMESPITTER
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
-- & itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
& itUse . heldMods .~ FlameSpitterMod
@@ -35,11 +41,11 @@ flameTorrent =
flameThrower
& itType . iyBase .~ HELD FLAMETORRENT
& itUse . heldAim . aimZoom .~ defaultItZoom
& itParams . sprayNozzles . ix 0
%~ ( (nzPressure .~ 10)
. (nzMaxWalkAngle .~ 1.5)
. (nzWalkSpeed .~ 0.05)
)
-- & itParams . sprayNozzles . ix 0
-- %~ ( (nzPressure .~ 10)
-- . (nzMaxWalkAngle .~ 1.5)
-- . (nzWalkSpeed .~ 0.05)
-- )
blowTorch :: Item
blowTorch =
@@ -50,45 +56,49 @@ flameWall :: Item
flameWall =
flameThrower
& itType . iyBase .~ HELD FLAMEWALL
& itParams . sprayNozzles .~ zipWith makeNozzle [0, 0.6, -0.6] [2, 2.5, 2.5]
where
makeNozzle dir pres =
Nozzle
{ _nzPressure = pres
, _nzDir = dir
, _nzMaxWalkAngle = 0
, _nzWalkSpeed = 0
, _nzCurrentWalkAngle = 0
, _nzLength = 20
}
-- & itParams . sprayNozzles .~ zipWith makeNozzle [0, 0.6, -0.6] [2, 2.5, 2.5]
-- where
-- makeNozzle dir pres =
-- Nozzle
-- { _nzPressure = pres
-- , _nzDir = dir
-- , _nzMaxWalkAngle = 0
-- , _nzWalkSpeed = 0
-- , _nzCurrentWalkAngle = 0
-- , _nzLength = 20
-- }
flameThrower :: Item
flameThrower =
defaultHeldItem
{ _itParams =
Sprayer
{ _sprayNozzles =
[ Nozzle
{ _nzPressure = 4
, _nzDir = 0
, _nzMaxWalkAngle = 0.2
, _nzWalkSpeed = 0.01
, _nzCurrentWalkAngle = 0
, _nzLength = 10
}
]
}
}
& itParams .~ NoParams
& itDimension . dimRad .~ 7
& itDimension . dimCenter .~ V3 9 0 0
-- & itUse . heldUse .~ HeldOverNozzlesUseGasParams -- overNozzles useGasParams
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ FlameThrowerMod
-- & itUse . heldMods .~ FlameThrowerMod
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType MuzzleFlame]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType
MuzzleNozzle
{ _nzPressure = ConstFloat 4
, _nzMaxWalkAngle = 0.2
, _nzWalkSpeed = 0.01
, _nzCurrentWalkAngle = 0
}
]
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo
& itType . iyBase .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
& itUse . heldParams .~ GasSprayParams
{_gasCreation = CreateFlame
, _recoil = 0
, _torqueAfter = 0
, _randomOffset = 0
, _sidePush = 25
, _bulGunSound = Nothing
, _weaponInvLock = 0
, _weaponRepeat = mempty
}
& itUse . heldTriggerType .~ AutoTrigger
+1 -1
View File
@@ -55,7 +55,7 @@ autoPistol =
pistol
& itUse . heldMods .~ PistolMod
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldParams . bulGunSound .~ (tap1S,0)
& itUse . heldParams . bulGunSound ?~ (tap1S,0)
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE