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
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -18,6 +18,7 @@ data ItemParams
{ _currentArc :: [ArcStep]}
| NozzleAngle {_nzAngle :: Float}
| VolleyUnfiredBarrels {_unfiredBarrels :: [Int]}
| AlteRifleSwitch {_alteRifleSwitch :: Int}
data ShrinkGunStatus = FullSize | Shrunk
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
+1 -1
View File
@@ -32,7 +32,7 @@ import Geometry.Data
data ItemUse
= UseHeld
{ _heldDelay :: UseDelay
, _heldMuzzles :: [Muzzle]
-- , _heldMuzzles :: [Muzzle]
, _heldFrame :: Int
}
| UseEquip {_uequipEffect :: EquipEffect}
-19
View File
@@ -1,19 +0,0 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.MuzzleEffect where
import Control.Lens
--import Data.Aeson
--import Data.Aeson.TH
--import Dodge.Data.Item.Use.Consumption.Ammo
data CumulativeMuzzleEffect = CME
{ _cmeSound :: Bool
}
deriving (Eq, Ord, Show, Read)
makeLenses ''CumulativeMuzzleEffect
+3 -3
View File
@@ -11,7 +11,7 @@ import Control.Lens
import qualified Data.IntMap.Strict as IM
import Dodge.Data.Item
import Dodge.Default.Item.Use
import Geometry.Data
--import Geometry.Data
defaultHeldItem :: Item
defaultHeldItem =
@@ -42,8 +42,8 @@ defaultBulletWeapon :: Item
defaultBulletWeapon =
defaultHeldItem
& itAmmoSlots .~ singleAmmo BulletAmmo
& itUse . heldMuzzles .~
[Muzzle (V2 15 0) 0 0.01 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
-- & itUse . heldMuzzles .~
-- [Muzzle (V2 15 0) 0 0.01 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
defaultItEffect :: ItEffect
defaultItEffect =
+9 -24
View File
@@ -1,35 +1,20 @@
module Dodge.Default.Item.Use (
module Dodge.Default.Item.Use,
module Dodge.Default.Item.Use.AimParams,
module Dodge.Default.Item.Use.Equipment,
) where
--import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.Item.Use
import Dodge.Default.Item.Use.AimParams
import Dodge.Default.Item.Use.Equipment
--defaultLeftUse :: ItemUse
--defaultLeftUse = UseHotkey
-- { _leftUse = LDoNothing
-- , _leftDelay = FixedRate{_rateMax = 8, _rateTime = 0}
-- , _leftHammer = HammerUp
-- , _uequipEffect = defaultEquip
-- , _leftConsumption = defaultLeftLoadable
-- }
defaultEquipUse :: ItemUse
defaultEquipUse = UseEquip
{ _uequipEffect = defaultEquip
}
defaultEquipUse =
UseEquip
{ _uequipEffect = defaultEquip
}
defaultHeldUse :: ItemUse
defaultHeldUse = UseHeld
{ _heldDelay = FixedRate{_rateMax = 8, _rateTimeLastUsed = 0}
, _heldMuzzles = defaultMuzzles
-- , _heldParams = BulletShooterParams
-- { _weaponInvLock = 0
-- }
, _heldFrame = 0
-- , _heldUseEffect = NoHeldUseEffect
}
defaultHeldUse =
UseHeld
{ _heldDelay = FixedRate{_rateMax = 8, _rateTimeLastUsed = 0}
, _heldFrame = 0
}
-20
View File
@@ -1,20 +0,0 @@
module Dodge.Default.Item.Use.AimParams (
defaultMuzzles,
) where
import Dodge.Data.Item.Use
import Linear
defaultMuzzles :: [Muzzle]
defaultMuzzles =
[ Muzzle
{ _mzPos = V2 20 0
, _mzRot = 0
, _mzInaccuracy = 0.05
, _mzAmmoSlot = 0
, _mzFlareType = NoFlare
, _mzEffect = MuzzleShootBullet
, _mzAmmoPerShot = UseExactly 1
, _mzFrame = 0
}
]
+190 -34
View File
@@ -10,17 +10,16 @@ module Dodge.HeldUse (
heldEffectMuzzles,
) where
import Dodge.Base
import Color
import Control.Applicative
import Control.Monad
import qualified Data.IntMap.Strict as IM
import Data.Maybe
import Dodge.Base.Collide
import Dodge.BaseTriggerType
import Dodge.Creature.Action
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Dodge.Data.MuzzleEffect
import Dodge.Data.World
import Dodge.Gas
import Dodge.Inventory.Lock
@@ -102,10 +101,10 @@ hammerCheck f pt it cr
id
| otherwise = f it cr
where
-- g x = (x, WdWdFromItCrixWdWd (upitm x) (_crID cr) ItCrWdItemHeldEffectNoHammer)
-- upitm x =
-- it -- & ldtValue . itUse . heldParams . weaponRepeat .~ []
-- & ldtValue . itUse . heldFrame .~ x
-- g x = (x, WdWdFromItCrixWdWd (upitm x) (_crID cr) ItCrWdItemHeldEffectNoHammer)
-- upitm x =
-- it -- & ldtValue . itUse . heldParams . weaponRepeat .~ []
-- & ldtValue . itUse . heldFrame .~ x
g x = (x, WdWdBurstFireRepetition (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
@@ -136,36 +135,191 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
heldEffectMuzzles t cr w =
doHeldUseEffect t cr .
uncurry (applyCME (_ldtValue t) cr) .
foldl' (useLoadedAmmo t cr) (CME False, w) $ loadedmuzzles
doHeldUseEffect t cr
. uncurry (applyCME (_ldtValue t) cr)
. foldl' (useLoadedAmmo t cr) (False, w)
$ loadedmuzzles
where
-- & doWeaponRepetitions upitm cr
muzzles = t ^. ldtValue . itUse . heldMuzzles
--muzzles = t ^. ldtValue . itUse . heldMuzzles
muzzles = itemMuzzles $ t ^. ldtValue
--(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
(_, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
itemMuzzles :: Item -> [Muzzle]
itemMuzzles itm = case itm ^. itType of
HELD ALTERIFLE -> dbwMuzzles & ix 0 . mzPos .~ V2 25 0
& ix 0 . mzAmmoSlot .~ _alteRifleSwitch (_itParams itm)
HELD hit -> heldItemMuzzles hit
DETECTOR {} -> dbwMuzzles & ix 0 . mzEffect .~ MuzzleDetector
& ix 0 . mzAmmoPerShot .~ UseExactly 100
_ -> []
heldItemMuzzles :: HeldItemType -> [Muzzle]
heldItemMuzzles = \case
BANGSTICK i -> [ Muzzle
(V2 10 0)
a
0.01
0
NoFlare
MuzzleShootBullet
(UseExactly 1)
0
| a <- spreadAroundCenter i baseStickSpread
]
& ix 0 . mzFlareType .~ NoLightFlare
& ix (i `div` 2) . mzFlareType .~ MiniGunFlare
& ix (i-1) . mzFlareType .~ NoLightFlare
PISTOL -> [Muzzle (V2 10 0) 0 0.05 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
AUTOPISTOL -> [Muzzle (V2 20 0) 0 0 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
SMG -> [Muzzle (V2 10 0) 0 0.05 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
RIFLE -> dbwMuzzles & ix 0 . mzPos .~ V2 25 0
BURSTRIFLE -> dbwMuzzles & ix 0 . mzPos .~ V2 25 0
& ix 0 . mzInaccuracy .~ 0.05
MINIGUNX i ->
replicate i
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
BANGROD -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzFlareType .~ HeavySmokeFlare
ELEPHANTGUN -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzFlareType .~ HeavySmokeFlare
& ix 0 . mzInaccuracy .~ 0.05
AMR -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzFlareType .~ HeavySmokeFlare
& ix 0 . mzInaccuracy .~ 0.05
AUTOAMR -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzFlareType .~ HeavySmokeFlare
& ix 0 . mzInaccuracy .~ 0.05
SNIPERRIFLE -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzFlareType .~ HeavySmokeFlare
& ix 0 . mzInaccuracy .~ 0
BANGCONE -> [Muzzle (V2 15 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
BLUNDERBUSS -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
GRAPECANNON _ -> [Muzzle (V2 30 0) 0 0.5 0 BasicFlare MuzzleShootBullet (UseUpTo 15) 0]
TORCH -> dbwMuzzles & ix 0 . mzPos .~ V2 10 0
VOLLEYGUN i -> vgunMuzzles i
FLAMETHROWER -> flameMuzzles
FLAMESPITTER -> flameMuzzles & ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
RLAUNCHER -> dbwMuzzles
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzEffect .~ MuzzleRLauncher
& ix 0 . mzPos .~ V2 20 0
GLAUNCHER -> dbwMuzzles
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzEffect .~ MuzzleGLauncher
& ix 0 . mzPos .~ V2 20 0
RLAUNCHERX i ->
getZipList
( ZipList [Muzzle (V2 20 0) a 0 | a <- take i [0, 2 * pi / fromIntegral i ..]]
<*> ZipList [0 ..]
<*> pure NoFlare
<*> pure MuzzleRLauncher
<*> pure (UseExactly 1)
<*> pure 0
)
LASER -> dbwMuzzles
& ix 0 . mzPos .~ V2 6 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ LasGunFlare
& ix 0 . mzEffect .~ MuzzleLaser
TESLAGUN -> dbwMuzzles
& ix 0 . mzPos .~ V2 10 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ TeslaGunFlare
& ix 0 . mzEffect .~ MuzzleTesla
TRACTORGUN -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ NoFlare
& ix 0 . mzEffect .~ MuzzleTractor
SHATTERGUN -> dbwMuzzles
& ix 0 . mzPos .~ V2 30 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzEffect .~ MuzzleShatter
BLINKER -> dbwMuzzles
& ix 0 . mzEffect .~ MuzzleBlink
& ix 0 . mzAmmoPerShot .~ UseExactly 10000000
BLINKERUNSAFE -> dbwMuzzles
& ix 0 . mzEffect .~ MuzzleUnsafeBlink
& ix 0 . mzAmmoPerShot .~ UseExactly 10000000
REWINDER -> dbwMuzzles
& ix 0 . mzEffect .~ MuzzleRewind
& ix 0 . mzAmmoPerShot .~ UseExactly 100000
TIMESTOPPER -> dbwMuzzles
& ix 0 . mzEffect .~ MuzzleStopper
& ix 0 . mzAmmoPerShot .~ UseExactly 100000
TIMESCROLLER -> dbwMuzzles
& ix 0 . mzEffect .~ MuzzleScroller
& ix 0 . mzAmmoPerShot .~ UseExactly 100000
_ -> [ Muzzle
{ _mzPos = V2 20 0
, _mzRot = 0
, _mzInaccuracy = 0.05
, _mzAmmoSlot = 0
, _mzFlareType = NoFlare
, _mzEffect = MuzzleShootBullet
, _mzAmmoPerShot = UseExactly 1
, _mzFrame = 0
}
]
baseStickSpread :: Float
baseStickSpread = 0.2
dbwMuzzles :: [Muzzle]
dbwMuzzles = [Muzzle (V2 15 0) 0 0.01 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
flameMuzzles :: [Muzzle]
flameMuzzles =
[ Muzzle (V2 18 0) 0 0 0 NoFlare MuzzleNozzle
{ _nzPressure = ConstFloat 4
, _nzMaxWalkAngle = 0.2
, _nzWalkSpeed = 0.01
}
(UseExactly 1)
0
]
vgunMuzzles :: Int -> [Muzzle]
vgunMuzzles i =
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]
)
doHeldUseEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
doHeldUseEffect t cr w = case t ^. ldtValue . itType of
HELD (VOLLEYGUN x) -> fromMaybe w $ do
i <- t ^? ldtValue . itLocation . ilInvID
let g = w ^. randGen
(is, g') = runState (shuffle [0 .. x -1]) g
return $
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
& randGen .~ g'
-- HELD (VOLLEYGUN x) -> fromMaybe w $ do
-- i <- t ^? ldtValue . itLocation . ilInvID
-- let g = w ^. randGen
-- (is, g') = runState (shuffle [0 .. x -1]) g
-- return $
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
-- & randGen .~ g'
HELD ALTERIFLE -> fromMaybe w $ do
i <- t ^? ldtValue . itLocation . ilInvID
return $
w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i
. itUse
. heldMuzzles
. ix 0
. mzAmmoSlot
. itParams . alteRifleSwitch
-- . itUse
-- . heldMuzzles
-- . ix 0
-- . mzAmmoSlot
%~ ((`mod` 2) . (+ 1))
_ -> w
--doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
-- Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
-- i <- t ^? ldtValue . itLocation . ilInvID
@@ -198,9 +352,9 @@ doHeldUseEffect t cr w = case t ^. ldtValue . itType of
-- itm & ldtValue . itUse . heldParams . weaponRepeat .~ []
-- & ldtValue . itUse . heldFrame .~ x
applyCME :: Item -> Creature -> CumulativeMuzzleEffect -> World -> World
applyCME :: Item -> Creature -> Bool -> World -> World
applyCME itm cr cme
| _cmeSound cme =
| cme =
applyInvLock itm cr
. applySoundCME itm cr
. applySidePush spush cr
@@ -258,12 +412,12 @@ itemSidePush = \case
BLINKERUNSAFE -> 0
applyInvLock :: Item -> Creature -> World -> World
applyInvLock itm cr
| i <- itemInvLock itm
, i > 0 =
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv cid))
. lockInv cid
| otherwise = id
applyInvLock itm cr = case itemInvLock itm of
i
| i > 0 ->
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv cid))
. lockInv cid
_ -> id
where
cid = _crID cr
@@ -445,7 +599,7 @@ heldTorqueAmount = \case
FLAMEWALL -> 0
BLOWTORCH -> 0
SPARKGUN -> 0
TESLAGUN -> 0
TESLAGUN -> 0.01
LASER -> 0
TRACTORGUN -> 0
RLAUNCHER -> 0
@@ -557,11 +711,11 @@ isAmmoIntLink _ _ = False
useLoadedAmmo ::
LabelDoubleTree ComposeLinkType Item ->
Creature ->
(CumulativeMuzzleEffect, World) ->
(Bool, World) ->
Maybe (Muzzle, Int, LabelDoubleTree ComposeLinkType Item) ->
(CumulativeMuzzleEffect, World)
(Bool, World)
useLoadedAmmo _ _ (cme, w) Nothing = (cme, w)
useLoadedAmmo itmtree cr (cme, w) (Just (mz, x, magtree)) = (,) (cme & cmeSound .~ True) $
useLoadedAmmo itmtree cr (_, w) (Just (mz, x, magtree)) = (,) True $
removeAmmoFromMag x mid cr . makeMuzzleFlare mz itmtree cr $ case _mzEffect mz of
MuzzleShootBullet -> shootBullet itmtree cr (mz, x, magtree) w
MuzzleLaser -> creatureShootLaser itmtree cr mz w
@@ -622,7 +776,9 @@ walkNozzle mz itm cr w = fromMaybe w $ do
w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv
. ix invid
. itParams . nzAngle %~ f
. itParams
. nzAngle
%~ f
& randGen .~ g
where
nz = _mzEffect mz
+1 -1
View File
@@ -118,7 +118,7 @@ bgateCalc x l r = (x `div` ((2::Int) ^ ((2::Int)*f l + f r))) `mod` 2
itemScrollDisplay :: Item -> Maybe String
itemScrollDisplay itm
| HELD ALTERIFLE <- itm ^. itType = Just $
case itm ^? itUse . heldMuzzles . ix 0 . mzAmmoSlot of
case itm ^? itParams . alteRifleSwitch of
Just 0 -> "L"
_ -> "R"
| UseScope OpticScope{_opticZoom = x} <- itm ^. itUse = Just $ shortShow x
+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
+2 -1
View File
@@ -56,7 +56,8 @@ itemScroll yi invid itm w
| HELD ALTERIFLE <- itm ^. itType
, yi /= 0 =
w
& itmlens . itUse . heldMuzzles . ix 0 . mzAmmoSlot
-- & itmlens . itUse . heldMuzzles . ix 0 . mzAmmoSlot
& itmlens . itParams . alteRifleSwitch
%~ ((`mod` 2) . (+ 1))
| isJust $ itm ^? itScroll . itsInt = w & itmlens . itScroll . itsInt +~ yi
| Just y <- itm ^? itScroll . itsMax = w & itmlens . itScroll . itsRangeInt