Move muzzles out of records

This commit is contained in:
2025-06-05 10:04:35 +01:00
parent 83a41e0204
commit 324a64814e
20 changed files with 320 additions and 213 deletions
+5 -3
View File
@@ -276,9 +276,11 @@ torchShape =
back = upperPrismPolySE 3 $ rectXH 1 2
baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX it _ = foldMap f (it ^?! itUse . heldMuzzles)
where
f brl = rotateSH (_mzRot brl) baseStickShape
baseStickShapeX _ _ = mempty
--baseStickShapeX it _ = mempty
-- foldMap f (it ^?! itUse . heldMuzzles)
-- where
-- f brl = rotateSH (_mzRot brl) baseStickShape
baseStickShape :: Shape
baseStickShape = colorSH green $ xCylinderST 3 10
+13 -13
View File
@@ -8,7 +8,7 @@ module Dodge.Item.Held.BatteryGuns (
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
import Geometry.Data
--import Geometry.Data
sparkGun :: Item
sparkGun =
@@ -22,10 +22,10 @@ teslaGun =
-- & itUse . heldParams .~ BeamShooterParams-- (Just (elecCrackleS, 2))
& itParams .~ teslaParams
& itUse . heldDelay .~ NoDelay
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 10 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldMuzzles . ix 0 . mzFlareType .~ TeslaGunFlare
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleTesla
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 10 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ TeslaGunFlare
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleTesla
& itType .~ HELD TESLAGUN
& itAmmoSlots .~ singleAmmo ElectricalAmmo
@@ -44,10 +44,10 @@ laser =
-- & itUse . heldParams .~ BeamShooterParams-- Nothing
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 6 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldMuzzles . ix 0 . mzFlareType .~ LasGunFlare
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleLaser
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 6 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ LasGunFlare
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleLaser
& itTargeting
.~ ItTargeting
{ _itTgPos = Nothing
@@ -62,8 +62,8 @@ tractorGun =
defaultHeldItem
-- & itUse . heldParams .~ BeamShooterParams
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldMuzzles . ix 0 . mzFlareType .~ NoFlare
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleTractor
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ NoFlare
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleTractor
& itType .~ HELD TRACTORGUN
+17 -16
View File
@@ -8,14 +8,14 @@ module Dodge.Item.Held.Cane (
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Base
--import Dodge.Base
import Dodge.Data.Item
import Dodge.Default
import qualified Data.IntMap.Strict as IM
--import Dodge.Reloading.Action
import Geometry.Data
--import Geometry.Data
import LensHelp
import Control.Applicative
--import Control.Applicative
defaultBangCane :: Item
defaultBangCane =
@@ -28,14 +28,14 @@ defaultBangCane =
volleyGun :: Int -> Item
volleyGun i =
defaultBangCane
& itUse . heldMuzzles .~ getZipList
(ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
<*> ZipList [0..i-1]
<*> pure MiniGunFlare
<*> pure MuzzleShootBullet
<*> pure (UseExactly 1)
<*> ZipList [0..i-1]
)
-- & itUse . heldMuzzles .~ getZipList
-- (ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
-- <*> ZipList [0..i-1]
-- <*> pure MiniGunFlare
-- <*> pure MuzzleShootBullet
-- <*> pure (UseExactly 1)
-- <*> ZipList [0..i-1]
-- )
& itType .~ HELD (VOLLEYGUN i)
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
-- & itUse . heldUseEffect .~ RandomiseMuzzleFrames i
@@ -44,12 +44,13 @@ rifle :: Item
rifle =
defaultBangCane
& itType .~ HELD RIFLE
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 25 0
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 25 0
alteRifle :: Item
alteRifle = rifle
& itType .~ HELD ALTERIFLE
& itAmmoSlots .~ IM.fromList (zip [0..1] $ repeat BulletAmmo)
& itParams .~ AlteRifleSwitch 0
--repeater :: Item
--repeater =
@@ -66,7 +67,7 @@ burstRifle :: Item
burstRifle =
rifle
& itType .~ HELD BURSTRIFLE
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0.05
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0.05
& itUse . heldDelay . rateMax .~ 6
miniGunX :: Int -> Item
@@ -74,9 +75,9 @@ miniGunX i =
autoRifle
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100, _warmSound = crankSlowS}
& itAmmoSlots .~ singleAmmo BeltBulletAmmo
& itUse . heldMuzzles
.~ replicate i
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
-- & itUse . heldMuzzles
-- .~ replicate i
-- (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
& itType .~ HELD (MINIGUNX i)
& itEffect . ieInv .~ ItemReduceWarmTime
& itEffect . ieOnDrop .~ ItemSetWarmTime 0
+5 -5
View File
@@ -7,21 +7,21 @@ module Dodge.Item.Held.Cone (
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
import Geometry.Data
import Linear
--import Geometry.Data
--import Linear
bangCone :: Item
bangCone =
defaultBulletWeapon
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMuzzles
.~ [Muzzle (V2 15 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
-- & itUse . heldMuzzles
-- .~ [Muzzle (V2 15 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
& itType .~ HELD BANGCONE
blunderbuss :: Item
blunderbuss =
bangCone
& itUse . heldMuzzles . ix 0 . mzPos . _x .~ 30
-- & itUse . heldMuzzles . ix 0 . mzPos . _x .~ 30
& itType .~ HELD BLUNDERBUSS
grapeCannon :: Int -> Item
+16 -16
View File
@@ -4,20 +4,20 @@ module Dodge.Item.Held.Launcher (
gLauncher,
) where
import Control.Applicative
--import Control.Applicative
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
import Geometry.Data
--import Geometry.Data
import qualified IntMapHelp as IM
rLauncher :: Item
rLauncher =
defaultHeldItem
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRLauncher
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRLauncher
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
& itAmmoSlots .~ singleAmmo LauncherAmmo
& itType .~ HELD RLAUNCHER
@@ -25,21 +25,21 @@ gLauncher :: Item
gLauncher =
rLauncher
& itType .~ HELD GLAUNCHER
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleGLauncher
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleGLauncher
rLauncherX :: Int -> Item
rLauncherX i =
rLauncher
& itType .~ HELD (RLAUNCHERX i)
& itUse . heldMuzzles
.~ getZipList
( ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
<*> ZipList [0 ..]
<*> pure NoFlare
<*> pure MuzzleRLauncher
<*> pure (UseExactly 1)
<*> pure 0
)
-- & itUse . heldMuzzles
-- .~ getZipList
-- ( ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
-- <*> ZipList [0 ..]
-- <*> pure NoFlare
-- <*> pure MuzzleRLauncher
-- <*> pure (UseExactly 1)
-- <*> pure 0
-- )
& itAmmoSlots .~ IM.fromList [(j, LauncherAmmo) | j <- [0 .. i -1]]
where
angles = take i [0, 2 * pi / fromIntegral i ..]
-- angles = take i [0, 2 * pi / fromIntegral i ..]
+5 -5
View File
@@ -12,7 +12,7 @@ import Dodge.Data.Item
import Dodge.Default
--import Dodge.Item.Weapon.Bullet
--import Dodge.Reloading.Action
import Geometry
--import Geometry
import LensHelp
bangRod :: Item
@@ -20,15 +20,15 @@ bangRod =
defaultBulletWeapon
& itUse . heldDelay . rateMax .~ 12
& itType .~ HELD BANGROD
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldMuzzles . ix 0 . mzFlareType .~ HeavySmokeFlare
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ HeavySmokeFlare
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item
elephantGun =
bangRod
& itType .~ HELD ELEPHANTGUN
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0.05
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0.05
-- & itUse . heldParams . recoil .~ 50
amr :: Item
@@ -45,7 +45,7 @@ sniperRifle :: Item
sniperRifle =
elephantGun
& itType .~ HELD SNIPERRIFLE
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
--machineGun :: Item
+12 -12
View File
@@ -11,7 +11,7 @@ module Dodge.Item.Held.SprayGuns (
import Dodge.Data.Item
import Dodge.Default.Item
--import Dodge.Reloading.Action
import Geometry
--import Geometry
import LensHelp
poisonSprayer :: Item
@@ -27,7 +27,7 @@ flameSpitter =
& itUse . heldDelay .~ FixedRate{_rateMax = 3, _rateTimeLastUsed = 0}
-- & itUse . heldParams . weaponInvLock .~ 10
-- & itUse . heldParams . weaponRepeat .~ [1..9]
& itUse . heldMuzzles . ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
-- & itUse . heldMuzzles . ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
flameTorrent :: Item
flameTorrent =
@@ -67,16 +67,16 @@ flameThrower =
& itParams .~ NozzleAngle 0
& itUse . heldDelay .~ NoDelay
-- & itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldMuzzles .~ [Muzzle (V2 18 0) 0 0 0 NoFlare
MuzzleNozzle
{ _nzPressure = ConstFloat 4
, _nzMaxWalkAngle = 0.2
, _nzWalkSpeed = 0.01
-- , _nzCurrentWalkAngle = 0
}
(UseExactly 1)
0
]
-- & itUse . heldMuzzles .~ [Muzzle (V2 18 0) 0 0 0 NoFlare
-- MuzzleNozzle
-- { _nzPressure = ConstFloat 4
-- , _nzMaxWalkAngle = 0.2
-- , _nzWalkSpeed = 0.01
---- , _nzCurrentWalkAngle = 0
-- }
-- (UseExactly 1)
-- 0
-- ]
& itAmmoSlots .~ singleAmmo GasAmmo
& itType .~ HELD FLAMETHROWER
-- & itUse . heldParams .~ GasSprayParams
+24 -24
View File
@@ -6,11 +6,11 @@ module Dodge.Item.Held.Stick (
smg,
) where
import Dodge.Base
--import Dodge.Base
import Dodge.Data.Item
import Dodge.Default.Item
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Geometry
--import Geometry
import LensHelp
bangStick :: Int -> Item
@@ -19,32 +19,32 @@ bangStick i =
-- & itUse . heldParams . recoil .~ 25
& itType .~ HELD (BANGSTICK i)
& itUse . heldDelay . rateMax .~ 8
& itUse . heldMuzzles
.~ [ Muzzle
(V2 10 0)
a
0.01
0
NoFlare
MuzzleShootBullet
(UseExactly 1)
0
| a <- spreadAroundCenter i baseStickSpread
]
& itUse . heldMuzzles . ix 0 . mzFlareType .~ NoLightFlare
& itUse . heldMuzzles . ix (i `div` 2) . mzFlareType .~ MiniGunFlare
& itUse . heldMuzzles . ix (i-1) . mzFlareType .~ NoLightFlare
-- & itUse . heldMuzzles
-- .~ [ Muzzle
-- (V2 10 0)
-- a
-- 0.01
-- 0
-- NoFlare
-- MuzzleShootBullet
-- (UseExactly 1)
-- 0
-- | a <- spreadAroundCenter i baseStickSpread
-- ]
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ NoLightFlare
-- & itUse . heldMuzzles . ix (i `div` 2) . mzFlareType .~ MiniGunFlare
-- & itUse . heldMuzzles . ix (i-1) . mzFlareType .~ NoLightFlare
baseStickSpread :: Float
baseStickSpread = 0.2
--baseStickSpread :: Float
--baseStickSpread = 0.2
pistol :: Item
pistol =
bangStick 1
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMuzzles . ix 0 . mzPos %~ const (V2 10 0)
& itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
& itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
-- & itUse . heldMuzzles . ix 0 . mzPos %~ const (V2 10 0)
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
-- & itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
& itType .~ HELD PISTOL
autoPistol :: Item
@@ -60,5 +60,5 @@ smg :: Item
smg =
autoPistol
& itType .~ HELD SMG
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
+11 -11
View File
@@ -13,7 +13,7 @@ module Dodge.Item.Held.Utility (
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
import Linear
--import Linear
flatShield :: Item
flatShield =
@@ -28,7 +28,7 @@ torch :: Item
torch =
defaultHeldItem
& itType .~ HELD TORCH
& itUse . heldMuzzles . ix 0 . mzPos . _x .~ 10
-- & itUse . heldMuzzles . ix 0 . mzPos . _x .~ 10
& itAmmoSlots .~ singleAmmo ElectricalAmmo
-- | Sends out pulses that display walls.
@@ -39,8 +39,8 @@ detector dt =
& itUse . heldDelay . rateMax .~ 20
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itType .~ DETECTOR dt
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleDetector
& itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleDetector
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
blinker :: Item
blinker =
@@ -48,31 +48,31 @@ blinker =
& itUseCondition .~ UseableAnytime
& itUse . heldDelay . rateMax .~ 20
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleBlink
& itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 10000000
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleBlink
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 10000000
& itType .~ HELD BLINKER
unsafeBlinker :: Item
unsafeBlinker =
blinker
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleUnsafeBlink
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleUnsafeBlink
& itType .~ HELD BLINKERUNSAFE
rewinder :: Item
rewinder =
blinker
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRewind
& itType .~ HELD REWINDER
& itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100000
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRewind
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100000
timeStopper :: Item
timeStopper =
blinker
& itType .~ HELD TIMESTOPPER
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleStopper
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleStopper
timeScroller :: Item
timeScroller =
timeStopper
& itType .~ HELD TIMESCROLLER
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleScroller
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleScroller
+4 -4
View File
@@ -3,7 +3,7 @@ module Dodge.Item.Held.Weapons where
import Dodge.Default.Item
import Dodge.Data.Item
import Control.Lens
import Linear.V2
--import Linear.V2
shatterGun :: Item
shatterGun =
@@ -11,6 +11,6 @@ shatterGun =
& itType .~ HELD SHATTERGUN
& itUse . heldDelay . rateMax .~ 10
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleShatter
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleShatter