Make item use mods an external function

This commit is contained in:
2022-07-20 17:06:45 +01:00
parent 795c4c1987
commit 12246462fe
22 changed files with 232 additions and 297 deletions
-1
View File
@@ -148,7 +148,6 @@ data HeldItemType
| FLAMETORRENT | FLAMETORRENT
| FLAMEWALL | FLAMEWALL
| BLOWTORCH | BLOWTORCH
| AUTOGUN
| SPARKGUN | SPARKGUN
| TESLAGUN | TESLAGUN
| LASGUN | LASGUN
+4 -8
View File
@@ -2,13 +2,9 @@ module Dodge.Combine.Module where
import Dodge.Data import Dodge.Data
import Dodge.Tesla import Dodge.Tesla
import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import LensHelp import LensHelp
import Geometry import Geometry
import Dodge.Beam import Dodge.Beam
import Dodge.Base.Coordinate
import Data.Maybe
moduleModification :: ItemModuleType -> Item -> Item moduleModification :: ItemModuleType -> Item -> Item
moduleModification imt = case imt of moduleModification imt = case imt of
@@ -45,10 +41,10 @@ moduleModification imt = case imt of
& itUse . useAim . aimRange .~ 0 & itUse . useAim . aimRange .~ 0
-- a better option would be to involve a "scope" centered on the firing -- a better option would be to involve a "scope" centered on the firing
-- position -- position
directedTelPos it cr w = (p,a) -- directedTelPos it cr w = (p,a)
where -- where
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just -- p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
a = argV (mouseWorldPos w -.- p) -- a = argV (mouseWorldPos w -.- p)
applyModules :: Item -> Item applyModules :: Item -> Item
applyModules it = foldr moduleModification it (_iyModules (_itType it)) applyModules it = foldr moduleModification it (_iyModules (_itType it))
-1
View File
@@ -258,7 +258,6 @@ stackedInventory = IM.fromList $ zip [0..]
, pipe , pipe
,rewindGun ,rewindGun
,tractorGun ,tractorGun
,autoGun
,autoPistol ,autoPistol
,pistol ,pistol
,teslaGun ,teslaGun
+1 -1
View File
@@ -12,7 +12,7 @@ import Control.Lens
autoCrit :: Creature autoCrit :: Creature
autoCrit = defaultCreature autoCrit = defaultCreature
{ _crInv = IM.fromList [(0,autoGun),(1,medkit 100)] { _crInv = IM.fromList [(0,autoRifle),(1,medkit 100)]
, _crRad = 10 , _crRad = 10
, _crHP = 300 , _crHP = 300
, _crMvType = defaultAimMvType , _crMvType = defaultAimMvType
+1 -1
View File
@@ -26,7 +26,7 @@ useItem cr' w = fromMaybe (f w) $ do
itemEffect :: Creature -> Item -> World -> World itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^? itUse of itemEffect cr it w = case it ^? itUse of
Just RightUse {_rUse = eff,_useMods = usemods} Just RightUse {_rUse = eff,_useMods = usemods}
-> hammerTest $ tryReload cr it w $ foldr ($) (useHeld eff) usemods it cr -> hammerTest $ tryReload cr it w $ foldr ($) (useHeld eff) (useMod usemods) it cr
Just LeftUse {} -> doequipmentchange Just LeftUse {} -> doequipmentchange
Just EquipUse{} -> doequipmentchange Just EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected -- ConsumeUse will cause problems if the item is not selected
+10 -2
View File
@@ -25,10 +25,10 @@ data HeldMod = HeldModNothing
| LauncherMod | LauncherMod
| TeslaMod | TeslaMod
| CircleLaserMod | CircleLaserMod
| LasWideMod | LasWideMod Int
| DualBeamMod | DualBeamMod
| LasMod | LasMod
| LauncherXMod | LauncherXMod Int
| ShatterMod | ShatterMod
| AmmoCheckMod | AmmoCheckMod
| AmmoUseCheckMod | AmmoUseCheckMod
@@ -42,3 +42,11 @@ data HeldMod = HeldModNothing
| MachineGunMod | MachineGunMod
| ModWithDirectedTeleport HeldMod | ModWithDirectedTeleport HeldMod
| BangStickMod | BangStickMod
| PistolMod
| AutoPistolMod
| MachinePistolMod
| BurstRifleMod
| MiniGunMod Int
| SmgMod
| RevolverXMod
| BangConeMod
+157 -8
View File
@@ -1,6 +1,11 @@
module Dodge.HeldUse where module Dodge.HeldUse where
import Dodge.Data import Dodge.Data
import Dodge.Base.Coordinate
import Sound.Data
import Dodge.Bullet import Dodge.Bullet
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic
import Dodge.WorldEvent.Flash
import Dodge.Item.Location import Dodge.Item.Location
import Dodge.Item.Weapon.Radar import Dodge.Item.Weapon.Radar
import Dodge.Item.Weapon.BatteryGuns import Dodge.Item.Weapon.BatteryGuns
@@ -14,7 +19,9 @@ import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import LensHelp import LensHelp
import RandomHelp import RandomHelp
import Color
import Data.Maybe
import Data.Traversable import Data.Traversable
useMod :: HeldMod -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World] useMod :: HeldMod -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
@@ -61,23 +68,23 @@ useMod hm = case hm of
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8 , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1 , useAmmoAmount 1
, withItemUpdate' increasecycle , withItemUpdate' increasecycleLasCircle
, duplicateItem f , duplicateItem fLasCircle
] ]
LasWideMod -> LasWideMod n ->
[ ammoCheckI [ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it)) , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8 , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1 , useAmmoAmount 1
, crAtMuzPos , crAtMuzPos
, withItemUpdate' increasecycle , withItemUpdate' (increasecycleLasWide n)
, withItem $ \it -> duplicateOffsetsV2 (xs it) , withItem $ \it -> duplicateOffsetsV2 (xsLasWide it)
] ]
DualBeamMod -> DualBeamMod ->
[ ammoCheckI [ ammoCheckI
, withItem $ \it -> withMuzPosShift (V2 0 (thegap it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8 , withItem $ \it -> withMuzPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPosShift (V2 0 (-thegap it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8 , withItem $ \it -> withMuzPosShift (V2 0 (-thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2 , withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1 , useAmmoAmount 1
] ]
@@ -89,7 +96,7 @@ useMod hm = case hm of
, useAmmoAmount 1 , useAmmoAmount 1
, crAtMuzPos , crAtMuzPos
] ]
LauncherXMod -> LauncherXMod i ->
[ hammerCheckI [ hammerCheckI
, ammoCheckI , ammoCheckI
, useTimeCheck , useTimeCheck
@@ -195,10 +202,129 @@ useMod hm = case hm of
-- , applyInaccuracy -- , applyInaccuracy
, withRecoil , withRecoil
] ]
PistolMod ->
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 50
, withMuzFlareI
]
AutoPistolMod ->
[ ammoCheckI
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 50
, withMuzFlareI
]
MachinePistolMod ->
[ ammoCheckI
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap1S
, applyInaccuracy
, withTorqueAfter
, withSidePushI 50
, withRecoil
, withMuzFlareI
]
BurstRifleMod ->
[ ammoHammerCheck
, useTimeCheck
, sideEffectOnFrame 7 (torqueSideEffect 0.2)
, lockInvFor 7
, \f' it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [3,6]) f' it
, withSoundStart tap3S
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoil
]
MiniGunMod i ->
[ ammoCheckI
, withWarmUp crankSlowS
, withSoundForI mini1S 2
--, withThinSmokeI
, withSmoke 1 black 20 200 5
, withMuzFlareI
, useAmmoAmount i
, withSidePushI (fromIntegral i * 50)
, torqueBefore (fromIntegral i * 0.05)
, afterRecoil (fromIntegral i * 5)
] <>
[ trigDoAlso' (moddelay x) (modcrpos x) useAmmoParams
| x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
]
SmgMod ->
[ ammoCheckI
, useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 30
, withMuzFlareI
]
RevolverXMod ->
[ ammoHammerCheck
, useTimeCheck
-- rather than locking the inventory, a better solution may be to check
-- that the weapon is still in your hands in the repeated frames
, lockInvFor 10
, \f' it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f' it
, withSoundStart tap3S
, useAmmoUpTo 1
, applyInaccuracy
, withMuzFlareI
-- , spreadLoaded
, withTorqueAfter
, withRecoil
]
BangConeMod ->
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, withTorqueAfter
, withRecoil
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffset
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
where where
f = do f = do
nzpres <- state $ randomR (3,4) nzpres <- state $ randomR (3,4)
return $ sprayNozzles . ix 0 . nzPressure .~ nzpres 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] ]
increasecycleLasWide n it = case _useHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * 5) . (+ 1))
xsLasWide it = [ V2 ((0.2*yoff x) ^ (2::Int)) (yoff x) | x <- [(0::Int)..n'-1] ]
where
yoff x = fromIntegral x - fromIntegral (n'-1) / 2
n' = _lasCycle (_itParams it)
thegapDualBeam = _dbGap . _itParams
directedTelPos it cr w = (p,a)
where
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
a = argV (mouseWorldPos w -.- p)
moddelay x = itConsumption . laAmmoType . amBullet . buState .~ DelayedBullet x
modcrpos x cr = cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ tweenPoints x (_crOldPos cr)
useHeld :: HeldUse -> Item -> Creature -> World -> World useHeld :: HeldUse -> Item -> Creature -> World -> World
useHeld hu = case hu of useHeld hu = case hu of
@@ -274,3 +400,26 @@ fireRemoteShell it cr w = set (creatures . ix cid . crInv . ix j . itUse . rUse)
, PJRemoteDirection 340 0 cid itid , PJRemoteDirection 340 0 cid itid
] ]
j = crSel cr j = crSel cr
caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
wth <- state $ randomR (1,5)
return (itConsumption . laAmmoType . amBullet . buWidth .~ wth)
coneRandItemParams :: State StdGen (ItemParams -> ItemParams)
coneRandItemParams = do
muzv <- state $ randomR (0.5,1)
rifl <- state $ randomR (0.3,0.9)
return $ \itparams -> itparams
{ _muzVel = muzv
, _rifling = rifl
}
-1
View File
@@ -92,7 +92,6 @@ itemFromHeldType ht = case ht of
FLAMETORRENT -> flameTorrent FLAMETORRENT -> flameTorrent
FLAMEWALL -> flameWall FLAMEWALL -> flameWall
BLOWTORCH -> blowTorch BLOWTORCH -> blowTorch
AUTOGUN -> autoGun
-- SPREADGUN -> spreadGun -- SPREADGUN -> spreadGun
-- MULTGUN -> multGun -- MULTGUN -> multGun
SPARKGUN -> sparkGun SPARKGUN -> sparkGun
-1
View File
@@ -85,7 +85,6 @@ heldItemSPic ht it = case ht of
FLAMETORRENT -> flamerPic it FLAMETORRENT -> flamerPic it
FLAMEWALL -> flamerPic it FLAMEWALL -> flamerPic it
BLOWTORCH -> flamerPic it BLOWTORCH -> flamerPic it
AUTOGUN -> defSPic
SPARKGUN -> teslaGunPic SPARKGUN -> teslaGunPic
TESLAGUN -> teslaGunPic TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it LASGUN -> lasGunPic it
+1 -20
View File
@@ -24,14 +24,6 @@ import Dodge.Beam
import Dodge.Item.Weapon.LaserPath import Dodge.Item.Weapon.LaserPath
import Dodge.Item.Location import Dodge.Item.Location
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
--import Dodge.Particle.TeslaArc
--import Dodge.Particle.Flame
import Dodge.SoundLogic.LoadSound
import Dodge.WorldEvent.Flash
--import Dodge.WorldEvent.Damage
--import Dodge.Default
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Base import Dodge.Base
--import Dodge.Zone --import Dodge.Zone
@@ -115,24 +107,14 @@ lasCircle = lasGun
& itUse . useAim . aimRange .~ 1 & itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
where where
increasecycle it = it & itParams . lasCycle %~ (flip mod 2000 . (+ 1))
--f it = [it & itParams . lasCycle +~ x | x <- [0,100 .. 1900] ]
f it = [it & itParams . lasCycle +~ x | x <- [0,50 .. 1999] ]
lasWide :: Int -> Item lasWide :: Int -> Item
lasWide n = lasGun lasWide n = lasGun
& itType . iyBase .~ HELD (LASWIDE n) & itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow & itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2 & itParams . lasDamage .~ 2
& itUse . useMods .~ LasWideMod & itUse . useMods .~ LasWideMod n
where where
increasecycle it = case _useHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * 5) . (+ 1))
xs it = [ V2 ((0.2*yoff x) ^ (2::Int)) (yoff x) | x <- [(0::Int)..n'-1] ]
where
yoff x = fromIntegral x - fromIntegral (n'-1) / 2
n' = _lasCycle (_itParams it)
--lasWidePulse :: Item --lasWidePulse :: Item
--lasWidePulse = lasGun --lasWidePulse = lasGun
-- & itType . iyBase .~ LASGUNWIDEPULSE -- & itType . iyBase .~ LASGUNWIDEPULSE
@@ -220,7 +202,6 @@ dualBeam = lasGun
& itUse . useAim . aimStance .~ TwoHandFlat & itUse . useAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE & itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
where where
thegap = _dbGap . _itParams
--lasSwing :: Item --lasSwing :: Item
--lasSwing = lasGun --lasSwing = lasGun
-- & itType . iyBase .~ LASGUNSWING -- & itType . iyBase .~ LASGUNSWING
+2 -43
View File
@@ -4,21 +4,13 @@ module Dodge.Item.Weapon.BulletGun.Cane
, rifle , rifle
, autoRifle , autoRifle
, burstRifle , burstRifle
-- , completeBurstRifle
-- , fastBurstRifle
, miniGunX , miniGunX
) where ) where
--import Dodge.Particle.Bullet.HitEffect
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Data import Dodge.Data
import Dodge.Bullet
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Default import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry import Geometry
import Sound.Data
import LensHelp import LensHelp
defaultBangCane :: Item defaultBangCane :: Item
@@ -73,10 +65,6 @@ volleyGun i = defaultBangCane
} }
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i & itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i) & itType . iyBase .~ HELD (VOLLEYGUN i)
caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
rifle :: Item rifle :: Item
rifle = defaultBangCane rifle = defaultBangCane
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
@@ -107,18 +95,7 @@ burstRifle = repeater
& itType . iyBase .~ HELD BURSTRIFLE & itType . iyBase .~ HELD BURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.05 & itParams . gunBarrels . brlInaccuracy .~ 0.05
& itUse . useDelay . rateMax .~ 18 & itUse . useDelay . rateMax .~ 18
& itUse . useMods .~ & itUse . useMods .~ BurstRifleMod
[ ammoHammerCheck
, useTimeCheck
, sideEffectOnFrame 7 (torqueSideEffect 0.2)
, lockInvFor 7
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [3,6]) f it
, withSoundStart tap3S
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withRecoil
]
--fastBurstRifle :: Item --fastBurstRifle :: Item
--fastBurstRifle = repeater --fastBurstRifle = repeater
-- & itType . iyBase .~ FASTBURSTRIFLE -- & itType . iyBase .~ FASTBURSTRIFLE
@@ -158,26 +135,8 @@ miniGunUse :: Int -> ItemUse
miniGunUse i = defaultrUse miniGunUse i = defaultrUse
& rUse .~ HeldUseAmmoParams & rUse .~ HeldUseAmmoParams
& useDelay .~ NoDelay & useDelay .~ NoDelay
& useMods .~ & useMods .~ MiniGunMod i
[ ammoCheckI
, withWarmUp crankSlowS
, withSoundForI mini1S 2
--, withThinSmokeI
, withSmoke 1 black 20 200 5
, withMuzFlareI
, useAmmoAmount i
, withSidePushI (y * 50)
, torqueBefore (y * 0.05)
, afterRecoil (y * 5)
] <>
[ trigDoAlso' (moddelay x) (modcrpos x) useAmmoParams
| x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
]
where where
y = fromIntegral i
moddelay x = itConsumption . laAmmoType . amBullet . buState .~ DelayedBullet x
modcrpos x cr = cr & crDir %~ tweenAngles x (_crOldDir cr)
& crPos %~ tweenPoints x (_crOldPos cr)
miniGunX :: Int -> Item miniGunX :: Int -> Item
miniGunX i = defaultAutoGun miniGunX i = defaultAutoGun
-8
View File
@@ -11,18 +11,10 @@ import Dodge.Reloading.Action
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Item.Weapon.Bullet import Dodge.Item.Weapon.Bullet
import Dodge.Default import Dodge.Default
--import Dodge.Item.Weapon.ZoomScope
import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Geometry import Geometry
import LensHelp import LensHelp
--import qualified Data.Sequence as Seq
--import Control.Lens
--import Control.Monad.State
--import System.Random
bangRod :: Item bangRod :: Item
bangRod = defaultBulletWeapon bangRod = defaultBulletWeapon
& itParams .~ BulletShooter & itParams .~ BulletShooter
+5 -68
View File
@@ -9,25 +9,10 @@ module Dodge.Item.Weapon.BulletGun.Stick
) where ) where
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Data import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Geometry import Geometry
import Sound.Data
import LensHelp import LensHelp
--import Data.Maybe
--import qualified Data.Sequence as Seq
--import Control.Lens
--import Control.Monad.State
--import System.Random
bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
bangStick :: Int -> Item bangStick :: Int -> Item
bangStick i = defaultBulletWeapon bangStick i = defaultBulletWeapon
& itParams .~ BulletShooter & itParams .~ BulletShooter
@@ -65,47 +50,13 @@ revolver = pistol
& laCycle .~ [loadPartialInsert 10 1] ) & laCycle .~ [loadPartialInsert 10 1] )
& itType . iyBase .~ HELD REVOLVER & itType . iyBase .~ HELD REVOLVER
pistolAfterHamMods :: [ChainEffect]
pistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 50
, withMuzFlareI
]
machinePistolAfterHamMods :: [ChainEffect]
machinePistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap1S
, applyInaccuracy
, withTorqueAfter
, withSidePushI 50
, withRecoil
, withMuzFlareI
]
smgAfterHamMods :: [ChainEffect]
smgAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 30
, withMuzFlareI
]
pistol :: Item pistol :: Item
pistol = bangStick 1 pistol = bangStick 1
& itConsumption .~ ( defaultBulletLoadable & itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15 & laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] ) & laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6 & itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods) & itUse . useMods .~ PistolMod
& itParams %~ & itParams %~
( ( muzVel .~ 0.8 ) ( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 ) . ( rifling .~ 0.8 )
@@ -117,19 +68,19 @@ pistol = bangStick 1
& itType . iyBase .~ HELD PISTOL & itType . iyBase .~ HELD PISTOL
autoPistol :: Item autoPistol :: Item
autoPistol = pistol autoPistol = pistol
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods) & itUse . useMods .~ AutoPistolMod
& itType . iyBase .~ HELD AUTOPISTOL & itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE & itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item machinePistol :: Item
machinePistol = autoPistol machinePistol = autoPistol
& itUse . useDelay . rateMax .~ 2 & itUse . useDelay . rateMax .~ 2
& itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods) & itUse . useMods .~ MachinePistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL & itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing & itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20 & itParams . recoil .~ 20
smg :: Item smg :: Item
smg = autoPistol -- & some parameter affecting stability smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods) & itUse . useMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG & itType . iyBase .~ HELD SMG
& itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2 & itUse . useAim . aimHandlePos .~ 2
@@ -137,20 +88,6 @@ smg = autoPistol -- & some parameter affecting stability
revolverX :: Int -> Item revolverX :: Int -> Item
revolverX i = revolver revolverX i = revolver
& itUse . useDelay . rateMax .~ 8 & itUse . useDelay . rateMax .~ 8
& itUse . useMods .~ & itUse . useMods .~ RevolverXMod
[ ammoHammerCheck
, useTimeCheck
-- rather than locking the inventory, a better solution may be to check
-- that the weapon is still in your hands in the repeated frames
, lockInvFor 10
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f it
, withSoundStart tap3S
, useAmmoUpTo 1
, applyInaccuracy
, withMuzFlareI
-- , spreadLoaded
, withTorqueAfter
, withRecoil
]
& itConsumption . laMax .~ i * 6 & itConsumption . laMax .~ i * 6
& itType . iyBase .~ HELD (REVOLVERX i) & itType . iyBase .~ HELD (REVOLVERX i)
+46 -98
View File
@@ -4,8 +4,7 @@ module Dodge.Item.Weapon.BulletGuns
, grapeCannon , grapeCannon
, grenadeLauncher , grenadeLauncher
, autogunSpread , autogunSpread
, autoGun --, autoGunPic
, autoGunPic
, module Dodge.Item.Weapon.BulletGun.Stick , module Dodge.Item.Weapon.BulletGun.Stick
, module Dodge.Item.Weapon.BulletGun.Cane , module Dodge.Item.Weapon.BulletGun.Cane
, module Dodge.Item.Weapon.BulletGun.Rod , module Dodge.Item.Weapon.BulletGun.Rod
@@ -14,80 +13,55 @@ import Dodge.Item.Weapon.BulletGun.Stick
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Cane import Dodge.Item.Weapon.BulletGun.Cane
import Dodge.Item.Weapon.BulletGun.Rod import Dodge.Item.Weapon.BulletGun.Rod
--import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data import Dodge.Data
--import Dodge.ChainEffect
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Default
import Dodge.Item.Attachment
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry import Geometry
import ShapePicture
import Shape
--import Sound.Data
import LensHelp import LensHelp
import qualified Data.Sequence as Seq --autoGun :: Item
--import Control.Lens --autoGun = defaultAutoGun
import Control.Monad.State -- { _itConsumption = defaultBulletLoadable
import System.Random -- { _laMax = 30
-- , _laLoaded = 30
autoGun :: Item -- }
autoGun = defaultAutoGun -- & laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
{ _itConsumption = defaultBulletLoadable ---- , _itFloorPict = autoGunPic
{ _laMax = 30 ---- , _itZoom = defaultItZoom
, _laLoaded = 30 -- , _itAttachment = AttachCharMode $ Seq.fromList "MS"
} -- , _itParams = BulletShooter
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10] -- { _muzVel = 1
-- , _itFloorPict = autoGunPic -- , _rifling = 0.9
-- , _itZoom = defaultItZoom -- , _bore = 2
, _itAttachment = AttachCharMode $ Seq.fromList "MS" -- , _gunBarrels = SingleBarrel 0.1
, _itParams = BulletShooter -- , _recoil = 0
{ _muzVel = 1 -- , _torqueAfter = 0
, _rifling = 0.9 -- , _randomOffset = 0
, _bore = 2 -- }
, _gunBarrels = SingleBarrel 0.1 -- }
, _recoil = 0 -- & itUse . useDelay . rateMax .~ 4
, _torqueAfter = 0 -- & itUse . useMods .~
, _randomOffset = 0 -- [ ammoCheckI
} -- , charFiringStratI
} -- [('S', hammerCheckI)
& itUse . useDelay . rateMax .~ 4 -- ]
& itUse . useMods .~ -- , useTimeCheck
[ ammoCheckI -- , charFiringStratI
, charFiringStratI -- [('M', torqueBefore 0.08)
[('S', hammerCheckI) -- ,('S', torqueBefore 0.05)
] -- ]
, useTimeCheck -- , withSoundForI autoBS 5
, charFiringStratI -- --, withSoundForI seagullChatterS 5
[('M', torqueBefore 0.08) -- , useAmmoAmount 1
,('S', torqueBefore 0.05) -- , applyInaccuracy
] -- , withMuzFlareI
, withSoundForI autoBS 5 -- , withSmoke 1 black 20 200 5
--, withSoundForI seagullChatterS 5 -- ]
, useAmmoAmount 1 -- & itUse . useAim . aimWeight .~ 6
, applyInaccuracy -- & itUse . useAim . aimRange .~ 1
, withMuzFlareI -- & itUse . useAim . aimStance .~ TwoHandTwist
, withSmoke 1 black 20 200 5 -- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
] -- & itUse . heldScroll .~ HeldScrollCharMode
& itUse . useAim . aimWeight .~ 6 -- & itType . iyBase .~ HELD AUTOGUN
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . heldScroll .~ HeldScrollCharMode
& itType . iyBase .~ HELD AUTOGUN
autoGunPic :: Item -> SPic
autoGunPic it = noPic $
colorSH red (prismPoly
(map (addZ 5) $ rectNESW 2 12 (-2) (-8))
(map (addZ 0) $ rectNESW 4 12 (-4) (-12))
)
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
where
x = fromIntegral $ _laLoaded $ _itConsumption it
bangCone :: Item bangCone :: Item
bangCone = defaultBulletWeapon bangCone = defaultBulletWeapon
@@ -104,38 +78,12 @@ bangCone = defaultBulletWeapon
& itDimension . dimRad .~ 8 & itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0 & itDimension . dimCenter .~ V3 5 0 0
& itUse . useDelay . rateMax .~ 20 & itUse . useDelay . rateMax .~ 20
& itUse . useMods .~ & itUse . useMods .~ BangConeMod
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, withTorqueAfter
, withRecoil
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffset
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& itUse . useAim . aimHandlePos .~ 5 & itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 15 & itUse . useAim . aimMuzPos .~ 15
& itType . iyBase .~ HELD BANGCONE & itType . iyBase .~ HELD BANGCONE
& itConsumption . laMax .~ 5 & itConsumption . laMax .~ 5
& itConsumption . laCycle .~ [loadEject 5, loadInsert 20 , loadPrime 5] & itConsumption . laCycle .~ [loadEject 5, loadInsert 20 , loadPrime 5]
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
wth <- state $ randomR (1,5)
return (itConsumption . laAmmoType . amBullet . buWidth .~ wth)
coneRandItemParams :: State StdGen (ItemParams -> ItemParams)
coneRandItemParams = do
muzv <- state $ randomR (0.5,1)
rifl <- state $ randomR (0.3,0.9)
return $ \itparams -> itparams
{ _muzVel = muzv
, _rifling = rifl
}
blunderbuss :: Item blunderbuss :: Item
blunderbuss = bangCone blunderbuss = bangCone
-4
View File
@@ -1,10 +1,6 @@
module Dodge.Item.Weapon.Drone where module Dodge.Item.Weapon.Drone where
--import Dodge.Projectile.Draw
import Dodge.Data import Dodge.Data
import Dodge.Default.Weapon import Dodge.Default.Weapon
--import Dodge.Default
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Weapon.TriggerType
import Geometry import Geometry
import Picture import Picture
import ShapePicture import ShapePicture
+1 -3
View File
@@ -11,8 +11,6 @@ import Dodge.Payload
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Dodge.Item.Location import Dodge.Item.Location
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Weapon.TriggerType
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
@@ -60,7 +58,7 @@ launcherX i = launcher
& itConsumption . laMax .~ i & itConsumption . laMax .~ i
& itConsumption . laLoaded .~ i & itConsumption . laLoaded .~ i
& itUse . rUse .~ HeldPJCreationX i & itUse . rUse .~ HeldPJCreationX i
& itUse . useMods .~ LauncherXMod & itUse . useMods .~ LauncherXMod i
basicAmPjMoves :: IM.IntMap TweakParam basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves = IM.fromList . zip [0..] $ basicAmPjMoves = IM.fromList . zip [0..] $
-1
View File
@@ -2,7 +2,6 @@ module Dodge.Item.Weapon.Radar where
import Dodge.Data import Dodge.Data
import Dodge.RadarSweep import Dodge.RadarSweep
import Dodge.Default import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.ExtraEffect
import Dodge.SoundLogic import Dodge.SoundLogic
-9
View File
@@ -10,18 +10,9 @@ import Dodge.Base.Collide
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
--import Dodge.ChainEffect --import Dodge.ChainEffect
import Dodge.Default.Weapon import Dodge.Default.Weapon
--import Dodge.Default
--import Dodge.Item.Attachment
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
--import Dodge.SoundLogic.LoadSound
import Geometry import Geometry
import LensHelp import LensHelp
--import qualified Data.IntMap.Strict as IM
shatterGun :: Item shatterGun :: Item
shatterGun = defaultWeapon shatterGun = defaultWeapon
& itType . iyBase .~ HELD SHATTERGUN & itType . iyBase .~ HELD SHATTERGUN
-8
View File
@@ -2,14 +2,6 @@ module Dodge.Item.Weapon.SonicGuns where
import Dodge.Data import Dodge.Data
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.Creature.HandPos import Dodge.Creature.HandPos
--import Dodge.Particle.TeslaArc
--import Dodge.SoundLogic.LoadSound
--import Dodge.WorldEvent
--import Dodge.WorldEvent.ThingsHit
--import Dodge.Default
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.AmmoParams
import Dodge.Default.Weapon import Dodge.Default.Weapon
--import Dodge.Item.Attachment --import Dodge.Item.Attachment
--import Dodge.WorldEvent.HelperParticle --import Dodge.WorldEvent.HelperParticle
-4
View File
@@ -1,10 +1,6 @@
module Dodge.Item.Weapon.Spawn where module Dodge.Item.Weapon.Spawn where
import Dodge.Data import Dodge.Data
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon import Dodge.Default.Weapon
--import Dodge.Default
--import Dodge.Item.Weapon.Grenade
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
-4
View File
@@ -8,14 +8,10 @@ module Dodge.Item.Weapon.SprayGuns
) where ) where
import Dodge.Data import Dodge.Data
import Dodge.Reloading.Action import Dodge.Reloading.Action
import Dodge.SoundLogic.LoadSound
import Dodge.Default import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Geometry import Geometry
import LensHelp import LensHelp
import Control.Monad.State
import System.Random
poisonSprayer :: Item poisonSprayer :: Item
poisonSprayer = flameThrower poisonSprayer = flameThrower
& itType . iyBase .~ HELD POISONSPRAYER & itType . iyBase .~ HELD POISONSPRAYER
+3 -2
View File
@@ -121,8 +121,9 @@ forceFieldGun = defaultWeapon
} }
& itUse . rUse .~ HeldForceField --useForceFieldGun & itUse . rUse .~ HeldForceField --useForceFieldGun
& itUse . useDelay .~ NoDelay & itUse . useDelay .~ NoDelay
& itUse . useMods .~ & itUse . useMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
[ hammerCheckI , ammoCheckI , useAmmoAmount 1] -- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN & itType . iyBase .~ HELD FORCEFIELDGUN
-- I believe because the targeting returns to nothing straight after you release -- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing -- the rmb, it is possible for this to do nothing