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
| FLAMEWALL
| BLOWTORCH
| AUTOGUN
| SPARKGUN
| TESLAGUN
| LASGUN
+4 -8
View File
@@ -2,13 +2,9 @@ module Dodge.Combine.Module where
import Dodge.Data
import Dodge.Tesla
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import LensHelp
import Geometry
import Dodge.Beam
import Dodge.Base.Coordinate
import Data.Maybe
moduleModification :: ItemModuleType -> Item -> Item
moduleModification imt = case imt of
@@ -45,10 +41,10 @@ moduleModification imt = case imt of
& itUse . useAim . aimRange .~ 0
-- a better option would be to involve a "scope" centered on the firing
-- position
directedTelPos it cr w = (p,a)
where
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
a = argV (mouseWorldPos w -.- p)
-- directedTelPos it cr w = (p,a)
-- where
-- p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
-- a = argV (mouseWorldPos w -.- p)
applyModules :: Item -> Item
applyModules it = foldr moduleModification it (_iyModules (_itType it))
-1
View File
@@ -258,7 +258,6 @@ stackedInventory = IM.fromList $ zip [0..]
, pipe
,rewindGun
,tractorGun
,autoGun
,autoPistol
,pistol
,teslaGun
+1 -1
View File
@@ -12,7 +12,7 @@ import Control.Lens
autoCrit :: Creature
autoCrit = defaultCreature
{ _crInv = IM.fromList [(0,autoGun),(1,medkit 100)]
{ _crInv = IM.fromList [(0,autoRifle),(1,medkit 100)]
, _crRad = 10
, _crHP = 300
, _crMvType = defaultAimMvType
+1 -1
View File
@@ -26,7 +26,7 @@ useItem cr' w = fromMaybe (f w) $ do
itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^? itUse of
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 EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected
+10 -2
View File
@@ -25,10 +25,10 @@ data HeldMod = HeldModNothing
| LauncherMod
| TeslaMod
| CircleLaserMod
| LasWideMod
| LasWideMod Int
| DualBeamMod
| LasMod
| LauncherXMod
| LauncherXMod Int
| ShatterMod
| AmmoCheckMod
| AmmoUseCheckMod
@@ -42,3 +42,11 @@ data HeldMod = HeldModNothing
| MachineGunMod
| ModWithDirectedTeleport HeldMod
| BangStickMod
| PistolMod
| AutoPistolMod
| MachinePistolMod
| BurstRifleMod
| MiniGunMod Int
| SmgMod
| RevolverXMod
| BangConeMod
+157 -8
View File
@@ -1,6 +1,11 @@
module Dodge.HeldUse where
import Dodge.Data
import Dodge.Base.Coordinate
import Sound.Data
import Dodge.Bullet
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic
import Dodge.WorldEvent.Flash
import Dodge.Item.Location
import Dodge.Item.Weapon.Radar
import Dodge.Item.Weapon.BatteryGuns
@@ -14,7 +19,9 @@ import Geometry
import qualified IntMapHelp as IM
import LensHelp
import RandomHelp
import Color
import Data.Maybe
import Data.Traversable
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
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
, withItemUpdate' increasecycle
, duplicateItem f
, withItemUpdate' increasecycleLasCircle
, duplicateItem fLasCircle
]
LasWideMod ->
LasWideMod n ->
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
, crAtMuzPos
, withItemUpdate' increasecycle
, withItem $ \it -> duplicateOffsetsV2 (xs it)
, withItemUpdate' (increasecycleLasWide n)
, withItem $ \it -> duplicateOffsetsV2 (xsLasWide it)
]
DualBeamMod ->
[ ammoCheckI
, withItem $ \it -> withMuzPosShift (V2 0 (thegap 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 (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPosShift (V2 0 (-thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
]
@@ -89,7 +96,7 @@ useMod hm = case hm of
, useAmmoAmount 1
, crAtMuzPos
]
LauncherXMod ->
LauncherXMod i ->
[ hammerCheckI
, ammoCheckI
, useTimeCheck
@@ -195,10 +202,129 @@ useMod hm = case hm of
-- , applyInaccuracy
, 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
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] ]
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 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
]
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
FLAMEWALL -> flameWall
BLOWTORCH -> blowTorch
AUTOGUN -> autoGun
-- SPREADGUN -> spreadGun
-- MULTGUN -> multGun
SPARKGUN -> sparkGun
-1
View File
@@ -85,7 +85,6 @@ heldItemSPic ht it = case ht of
FLAMETORRENT -> flamerPic it
FLAMEWALL -> flamerPic it
BLOWTORCH -> flamerPic it
AUTOGUN -> defSPic
SPARKGUN -> teslaGunPic
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
+1 -20
View File
@@ -24,14 +24,6 @@ import Dodge.Beam
import Dodge.Item.Weapon.LaserPath
import Dodge.Item.Location
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.Base
--import Dodge.Zone
@@ -115,24 +107,14 @@ lasCircle = lasGun
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
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 n = lasGun
& itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . useMods .~ LasWideMod
& itUse . useMods .~ LasWideMod n
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 = lasGun
-- & itType . iyBase .~ LASGUNWIDEPULSE
@@ -220,7 +202,6 @@ dualBeam = lasGun
& itUse . useAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
where
thegap = _dbGap . _itParams
--lasSwing :: Item
--lasSwing = lasGun
-- & itType . iyBase .~ LASGUNSWING
+2 -43
View File
@@ -4,21 +4,13 @@ module Dodge.Item.Weapon.BulletGun.Cane
, rifle
, autoRifle
, burstRifle
-- , completeBurstRifle
-- , fastBurstRifle
, miniGunX
) where
--import Dodge.Particle.Bullet.HitEffect
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.Bullet
import Dodge.Default.Weapon
import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
import Sound.Data
import LensHelp
defaultBangCane :: Item
@@ -73,10 +65,6 @@ volleyGun i = defaultBangCane
}
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i)
caneStickSoundChoice :: Item -> SoundID
caneStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
rifle :: Item
rifle = defaultBangCane
& itUse . useAim . aimStance .~ TwoHandTwist
@@ -107,18 +95,7 @@ burstRifle = repeater
& itType . iyBase .~ HELD BURSTRIFLE
& itParams . gunBarrels . brlInaccuracy .~ 0.05
& itUse . useDelay . rateMax .~ 18
& itUse . useMods .~
[ 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
]
& itUse . useMods .~ BurstRifleMod
--fastBurstRifle :: Item
--fastBurstRifle = repeater
-- & itType . iyBase .~ FASTBURSTRIFLE
@@ -158,26 +135,8 @@ miniGunUse :: Int -> ItemUse
miniGunUse i = defaultrUse
& rUse .~ HeldUseAmmoParams
& useDelay .~ NoDelay
& useMods .~
[ 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]
]
& useMods .~ MiniGunMod i
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 i = defaultAutoGun
-8
View File
@@ -11,18 +11,10 @@ import Dodge.Reloading.Action
import Dodge.Default.Weapon
import Dodge.Item.Weapon.Bullet
import Dodge.Default
--import Dodge.Item.Weapon.ZoomScope
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Geometry
import LensHelp
--import qualified Data.Sequence as Seq
--import Control.Lens
--import Control.Monad.State
--import System.Random
bangRod :: Item
bangRod = defaultBulletWeapon
& itParams .~ BulletShooter
+5 -68
View File
@@ -9,25 +9,10 @@ module Dodge.Item.Weapon.BulletGun.Stick
) where
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default.Weapon
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Geometry
import Sound.Data
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 i = defaultBulletWeapon
& itParams .~ BulletShooter
@@ -65,47 +50,13 @@ revolver = pistol
& laCycle .~ [loadPartialInsert 10 1] )
& 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 = bangStick 1
& itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods)
& itUse . useMods .~ PistolMod
& itParams %~
( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 )
@@ -117,19 +68,19 @@ pistol = bangStick 1
& itType . iyBase .~ HELD PISTOL
autoPistol :: Item
autoPistol = pistol
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
& itUse . useMods .~ AutoPistolMod
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item
machinePistol = autoPistol
& itUse . useDelay . rateMax .~ 2
& itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods)
& itUse . useMods .~ MachinePistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
smg :: Item
smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods)
& itUse . useMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2
@@ -137,20 +88,6 @@ smg = autoPistol -- & some parameter affecting stability
revolverX :: Int -> Item
revolverX i = revolver
& itUse . useDelay . rateMax .~ 8
& itUse . useMods .~
[ 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
]
& itUse . useMods .~ RevolverXMod
& itConsumption . laMax .~ i * 6
& itType . iyBase .~ HELD (REVOLVERX i)
+47 -99
View File
@@ -4,8 +4,7 @@ module Dodge.Item.Weapon.BulletGuns
, grapeCannon
, grenadeLauncher
, autogunSpread
, autoGun
, autoGunPic
--, autoGunPic
, module Dodge.Item.Weapon.BulletGun.Stick
, module Dodge.Item.Weapon.BulletGun.Cane
, module Dodge.Item.Weapon.BulletGun.Rod
@@ -14,81 +13,56 @@ import Dodge.Item.Weapon.BulletGun.Stick
import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Cane
import Dodge.Item.Weapon.BulletGun.Rod
--import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
--import Dodge.ChainEffect
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 ShapePicture
import Shape
--import Sound.Data
import LensHelp
import qualified Data.Sequence as Seq
--import Control.Lens
import Control.Monad.State
import System.Random
autoGun :: Item
autoGun = defaultAutoGun
{ _itConsumption = defaultBulletLoadable
{ _laMax = 30
, _laLoaded = 30
}
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
-- , _itFloorPict = autoGunPic
-- , _itZoom = defaultItZoom
, _itAttachment = AttachCharMode $ Seq.fromList "MS"
, _itParams = BulletShooter
{ _muzVel = 1
, _rifling = 0.9
, _bore = 2
, _gunBarrels = SingleBarrel 0.1
, _recoil = 0
, _torqueAfter = 0
, _randomOffset = 0
}
}
& itUse . useDelay . rateMax .~ 4
& itUse . useMods .~
[ ammoCheckI
, charFiringStratI
[('S', hammerCheckI)
]
, useTimeCheck
, charFiringStratI
[('M', torqueBefore 0.08)
,('S', torqueBefore 0.05)
]
, withSoundForI autoBS 5
--, withSoundForI seagullChatterS 5
, useAmmoAmount 1
, applyInaccuracy
, withMuzFlareI
, withSmoke 1 black 20 200 5
]
& itUse . useAim . aimWeight .~ 6
& 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
--autoGun :: Item
--autoGun = defaultAutoGun
-- { _itConsumption = defaultBulletLoadable
-- { _laMax = 30
-- , _laLoaded = 30
-- }
-- & laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
---- , _itFloorPict = autoGunPic
---- , _itZoom = defaultItZoom
-- , _itAttachment = AttachCharMode $ Seq.fromList "MS"
-- , _itParams = BulletShooter
-- { _muzVel = 1
-- , _rifling = 0.9
-- , _bore = 2
-- , _gunBarrels = SingleBarrel 0.1
-- , _recoil = 0
-- , _torqueAfter = 0
-- , _randomOffset = 0
-- }
-- }
-- & itUse . useDelay . rateMax .~ 4
-- & itUse . useMods .~
-- [ ammoCheckI
-- , charFiringStratI
-- [('S', hammerCheckI)
-- ]
-- , useTimeCheck
-- , charFiringStratI
-- [('M', torqueBefore 0.08)
-- ,('S', torqueBefore 0.05)
-- ]
-- , withSoundForI autoBS 5
-- --, withSoundForI seagullChatterS 5
-- , useAmmoAmount 1
-- , applyInaccuracy
-- , withMuzFlareI
-- , withSmoke 1 black 20 200 5
-- ]
-- & itUse . useAim . aimWeight .~ 6
-- & itUse . useAim . aimRange .~ 1
-- & itUse . useAim . aimStance .~ TwoHandTwist
-- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
-- & itUse . heldScroll .~ HeldScrollCharMode
-- & itType . iyBase .~ HELD AUTOGUN
bangCone :: Item
bangCone = defaultBulletWeapon
{ _itParams = BulletShooter
@@ -104,38 +78,12 @@ bangCone = defaultBulletWeapon
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
& itUse . useDelay . rateMax .~ 20
& itUse . useMods .~
[ ammoCheckI
, hammerCheckI
, useTimeCheck
, withSoundStart bangEchoS
, useAllAmmo
, withTorqueAfter
, withRecoil
, duplicateLoaded
, withMuzFlareI
, applyInaccuracy
, withRandomOffset
, withRandomItemUpdate coneRandItemUpdate
, withRandomItemParams coneRandItemParams
]
& itUse . useMods .~ BangConeMod
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 15
& itType . iyBase .~ HELD BANGCONE
& itConsumption . laMax .~ 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 = bangCone
-4
View File
@@ -1,10 +1,6 @@
module Dodge.Item.Weapon.Drone where
--import Dodge.Projectile.Draw
import Dodge.Data
import Dodge.Default.Weapon
--import Dodge.Default
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Weapon.TriggerType
import Geometry
import Picture
import ShapePicture
+1 -3
View File
@@ -11,8 +11,6 @@ import Dodge.Payload
import Dodge.Reloading.Action
import Dodge.Default.Weapon
import Dodge.Item.Location
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Weapon.TriggerType
import Geometry
import qualified IntMapHelp as IM
@@ -60,7 +58,7 @@ launcherX i = launcher
& itConsumption . laMax .~ i
& itConsumption . laLoaded .~ i
& itUse . rUse .~ HeldPJCreationX i
& itUse . useMods .~ LauncherXMod
& itUse . useMods .~ LauncherXMod i
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves = IM.fromList . zip [0..] $
-1
View File
@@ -2,7 +2,6 @@ module Dodge.Item.Weapon.Radar where
import Dodge.Data
import Dodge.RadarSweep
import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.ExtraEffect
import Dodge.SoundLogic
-9
View File
@@ -10,18 +10,9 @@ import Dodge.Base.Collide
import Dodge.Creature.HandPos
--import Dodge.ChainEffect
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 LensHelp
--import qualified Data.IntMap.Strict as IM
shatterGun :: Item
shatterGun = defaultWeapon
& itType . iyBase .~ HELD SHATTERGUN
-8
View File
@@ -2,14 +2,6 @@ module Dodge.Item.Weapon.SonicGuns where
import Dodge.Data
import Dodge.Reloading.Action
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.Item.Attachment
--import Dodge.WorldEvent.HelperParticle
-4
View File
@@ -1,10 +1,6 @@
module Dodge.Item.Weapon.Spawn where
import Dodge.Data
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon
--import Dodge.Default
--import Dodge.Item.Weapon.Grenade
import Geometry
import qualified IntMapHelp as IM
-4
View File
@@ -8,14 +8,10 @@ module Dodge.Item.Weapon.SprayGuns
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.SoundLogic.LoadSound
import Dodge.Default
import Dodge.Item.Weapon.TriggerType
import Geometry
import LensHelp
import Control.Monad.State
import System.Random
poisonSprayer :: Item
poisonSprayer = flameThrower
& itType . iyBase .~ HELD POISONSPRAYER
+3 -2
View File
@@ -121,8 +121,9 @@ forceFieldGun = defaultWeapon
}
& itUse . rUse .~ HeldForceField --useForceFieldGun
& itUse . useDelay .~ NoDelay
& itUse . useMods .~
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itUse . useMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing