Commit before partial cleanup, continue weapon effect refactor

This commit is contained in:
2024-09-21 16:04:23 +01:00
parent bb18831393
commit 9dff2fcd7a
37 changed files with 817 additions and 856 deletions
+1 -78
View File
@@ -1,78 +1 @@
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:(45,25)-(323,30): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative:
Patterns not matched:
FlameSpitterMod
FlameSpitterRepeatMod
|
45 | heldEffect effecttype = case effecttype of
| ^^^^^^^^^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:503:1-10: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
walkNozzle :: Muzzle -> p1 -> p2 -> World -> World
|
503 | walkNozzle mz itm cr w = w
| ^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:503:15-17: warning: [-Wunused-matches]
Defined but not used: itm
|
503 | walkNozzle mz itm cr w = w
| ^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:503:19-20: warning: [-Wunused-matches]
Defined but not used: cr
|
503 | walkNozzle mz itm cr w = w
| ^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:507:6-15: warning: [-Wunused-local-binds]
Defined but not used: walkamount
|
507 | (walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
| ^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:509:5-8: warning: [-Wunused-local-binds]
Defined but not used: maxa
|
509 | maxa = _nzMaxWalkAngle nz
| ^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:510:5-6: warning: [-Wunused-local-binds]
Defined but not used: wa
|
510 | wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
| ^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:552:1-17: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
|
552 | removeAmmoFromMag x mid cr = fromMaybe id $ do
| ^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:565:5-7: warning: [-Wunused-local-binds]
Defined but not used: cid
|
565 | cid = _crID cr
| ^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:(608,13)-(830,9): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative:
Patterns not matched:
FlameSpitterMod
FlameSpitterRepeatMod
|
608 | useMod hm = case hm of
| ^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:(936,14)-(952,85): warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative:
Patterns not matched: HeldOverNozzlesUseGasParams
|
936 | useHeld hu = case hu of
| ^^^^^^^^^^...
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:1045:1-10: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
doGenFloat :: RandomGen g => GenFloat -> g -> (Float, g)
|
1045 | doGenFloat (ConstFloat x) g = (x,g)
| ^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:1106:21-22: warning: [-Wunused-matches]
Defined but not used: mz
|
1106 | shootTeslaArc it cr mz w =
| ^^
All good (617 modules, at 16:01:23)
+76 -107
View File
@@ -56,54 +56,48 @@ digraph {
70 [shape=box
,label="HELD {_ibtHeld = AUTOAMR}"];
72 [shape=box
,label="HELD {_ibtHeld = MACHINEGUN}"];
74 [shape=box
,label="HELD {_ibtHeld = LAUNCHER}"];
77 [shape=box
75 [shape=box
,label="HELD {_ibtHeld = LAUNCHERX {_xNum = 2}}"];
81 [shape=box
79 [shape=box
,label="HELD {_ibtHeld = FLAMESPITTER}"];
85 [shape=box
83 [shape=box
,label="HELD {_ibtHeld = BLOWTORCH}"];
87 [shape=box
85 [shape=box
,label="HELD {_ibtHeld = FLAMETHROWER}"];
89 [shape=box
87 [shape=box
,label="HELD {_ibtHeld = FLAMEWALL}"];
91 [shape=box
89 [shape=box
,label="HELD {_ibtHeld = FLAMETORRENT}"];
93 [shape=box
91 [shape=box
,label="HELD {_ibtHeld = LASGUN}"];
95 [shape=box
,label="HELD {_ibtHeld = SPARKGUN}"];
97 [shape=box
,label="HELD {_ibtHeld = DUALBEAM}"];
,label="HELD {_ibtHeld = TESLAGUN}"];
99 [shape=box
,label="HELD {_ibtHeld = LASWIDE {_xNum = 2}}"];
101 [shape=box
,label="HELD {_ibtHeld = SPARKGUN}"];
103 [shape=box
,label="HELD {_ibtHeld = TESLAGUN}"];
105 [shape=box
,label="LEFT {_ibtLeft = BLINKER}"];
108 [shape=box
,label="LEFT {_ibtLeft = BLINKER}"];
102 [shape=box
,label="LEFT {_ibtLeft = BLINKERUNSAFE}"];
110 [shape=box
104 [shape=box
,label="EQUIP {_ibtEquip = MAGSHIELD}"];
113 [shape=box
107 [shape=box
,label="EQUIP {_ibtEquip = POWERLEGS}"];
119 [shape=box
113 [shape=box
,label="HELD {_ibtHeld = FLATSHIELD}"];
129 [shape=box
123 [shape=box
,label="EQUIP {_ibtEquip = AUTODETECTOR ITEMDETECTOR}"];
132 [shape=box
126 [shape=box
,label="EQUIP {_ibtEquip = AUTODETECTOR WALLDETECTOR}"];
134 [shape=box
128 [shape=box
,label="EQUIP {_ibtEquip = AUTODETECTOR CREATUREDETECTOR}"];
136 [shape=box
130 [shape=box
,label="HELD {_ibtHeld = TORCH}"];
137 [shape=box
131 [shape=box
,label="AMMOMAG {_ibtAmmoMag = BATTERY}"];
140 [shape=box
134 [shape=box
,label="EQUIP {_ibtEquip = HEADLAMP}"];
148 [shape=box
140 [shape=box
,label="HELD {_ibtHeld = BANGSTICK {_xNum = 2}}"];
}
subgraph 2 {
@@ -134,43 +128,39 @@ digraph {
68 [shape=point];
69 [shape=point];
71 [shape=point];
73 [shape=point];
74 [shape=point];
76 [shape=point];
78 [shape=point];
80 [shape=point];
82 [shape=point];
84 [shape=point];
86 [shape=point];
88 [shape=point];
90 [shape=point];
92 [shape=point];
94 [shape=point];
96 [shape=point];
98 [shape=point];
100 [shape=point];
102 [shape=point];
104 [shape=point];
107 [shape=point];
101 [shape=point];
103 [shape=point];
106 [shape=point];
109 [shape=point];
110 [shape=point];
111 [shape=point];
112 [shape=point];
115 [shape=point];
114 [shape=point];
116 [shape=point];
117 [shape=point];
118 [shape=point];
120 [shape=point];
119 [shape=point];
122 [shape=point];
125 [shape=point];
128 [shape=point];
131 [shape=point];
127 [shape=point];
129 [shape=point];
133 [shape=point];
135 [shape=point];
137 [shape=point];
139 [shape=point];
141 [shape=point];
143 [shape=point];
145 [shape=point];
147 [shape=point];
149 [shape=point];
151 [shape=point];
153 [shape=point];
155 [shape=point];
}
0 -> 1 [xlabel="",tailport=e];
2 -> 0 [xlabel=1
@@ -198,7 +188,7 @@ digraph {
16 -> 27 [xlabel=1
,arrowhead=onone
,headport=w];
16 -> 139 [xlabel=1
16 -> 133 [xlabel=1
,arrowhead=onone
,headport=w];
18 -> 19 [xlabel="",tailport=e];
@@ -222,13 +212,13 @@ digraph {
35 -> 56 [xlabel=1
,arrowhead=onone
,headport=w];
35 -> 147 [xlabel=1
35 -> 139 [xlabel=1
,arrowhead=onone
,headport=w];
35 -> 151 [xlabel=1
35 -> 143 [xlabel=1
,arrowhead=onone
,headport=w];
35 -> 153 [xlabel=1
35 -> 145 [xlabel=1
,arrowhead=onone
,headport=w];
38 -> 39 [xlabel="",tailport=e];
@@ -253,7 +243,7 @@ digraph {
,arrowhead=onone
,headport=w];
52 -> 53 [xlabel="",tailport=e];
53 -> 155 [xlabel=1
53 -> 147 [xlabel=1
,arrowhead=onone
,headport=w];
54 -> 55 [xlabel="",tailport=e];
@@ -270,13 +260,13 @@ digraph {
57 -> 62 [xlabel=1
,arrowhead=onone
,headport=w];
57 -> 151 [xlabel=1
57 -> 143 [xlabel=1
,arrowhead=onone
,headport=w];
58 -> 59 [xlabel="",tailport=e];
60 -> 61 [xlabel="",tailport=e];
62 -> 63 [xlabel="",tailport=e];
63 -> 153 [xlabel=1
63 -> 145 [xlabel=1
,arrowhead=onone
,headport=w];
65 -> 66 [xlabel="",tailport=e];
@@ -286,94 +276,73 @@ digraph {
67 -> 69 [xlabel=1
,arrowhead=onone
,headport=w];
67 -> 71 [xlabel=1
,arrowhead=onone
,headport=w];
68 -> 67 [xlabel="",tailport=e];
69 -> 70 [xlabel="",tailport=e];
71 -> 72 [xlabel="",tailport=e];
73 -> 74 [xlabel="",tailport=e];
74 -> 76 [xlabel=1
72 -> 74 [xlabel=1
,arrowhead=onone
,headport=w];
76 -> 77 [xlabel="",tailport=e];
77 -> 78 [xlabel=1
74 -> 75 [xlabel="",tailport=e];
75 -> 76 [xlabel=1
,arrowhead=onone
,headport=w];
80 -> 81 [xlabel="",tailport=e];
81 -> 84 [xlabel=1
78 -> 79 [xlabel="",tailport=e];
79 -> 82 [xlabel=1
,arrowhead=onone
,headport=w];
81 -> 86 [xlabel=1
79 -> 84 [xlabel=1
,arrowhead=onone
,headport=w];
82 -> 83 [xlabel="",tailport=e];
84 -> 85 [xlabel="",tailport=e];
85 -> 86 [xlabel=1
,arrowhead=onone
,headport=w];
85 -> 88 [xlabel=1
,arrowhead=onone
,headport=w];
86 -> 87 [xlabel="",tailport=e];
87 -> 88 [xlabel=1
,arrowhead=onone
,headport=w];
87 -> 90 [xlabel=1
,arrowhead=onone
,headport=w];
88 -> 89 [xlabel="",tailport=e];
90 -> 91 [xlabel="",tailport=e];
92 -> 93 [xlabel="",tailport=e];
93 -> 96 [xlabel=1
,arrowhead=onone
,headport=w];
93 -> 96 [xlabel=1
,arrowhead=onone
,headport=w];
93 -> 98 [xlabel=1
94 -> 95 [xlabel="",tailport=e];
95 -> 96 [xlabel=1
,arrowhead=onone
,headport=w];
96 -> 97 [xlabel="",tailport=e];
98 -> 99 [xlabel="",tailport=e];
99 -> 145 [xlabel=1
99 -> 101 [xlabel=1
,arrowhead=onone
,headport=w];
100 -> 101 [xlabel=""
101 -> 102 [xlabel=""
,tailport=e];
101 -> 102 [xlabel=1
,arrowhead=onone
,headport=w];
102 -> 103 [xlabel=""
103 -> 104 [xlabel=""
,tailport=e];
104 -> 105 [xlabel=""
,tailport=e];
105 -> 107 [xlabel=1
,arrowhead=onone
,headport=w];
107 -> 108 [xlabel=""
,tailport=e];
109 -> 110 [xlabel=""
106 -> 107 [xlabel=""
,tailport=e];
112 -> 113 [xlabel=""
,tailport=e];
118 -> 119 [xlabel=""
122 -> 123 [xlabel=""
,tailport=e];
128 -> 129 [xlabel=""
125 -> 126 [xlabel=""
,tailport=e];
131 -> 132 [xlabel=""
127 -> 128 [xlabel=""
,tailport=e];
129 -> 130 [xlabel=""
,tailport=e];
130 -> 133 [xlabel=1
,arrowhead=onone
,headport=w];
131 -> 129 [xlabel=1
,arrowhead=onone
,headport=w];
131 -> 137 [xlabel=1
,arrowhead=onone
,headport=w];
133 -> 134 [xlabel=""
,tailport=e];
135 -> 136 [xlabel=""
,tailport=e];
136 -> 139 [xlabel=1
,arrowhead=onone
,headport=w];
137 -> 135 [xlabel=1
,arrowhead=onone
,headport=w];
137 -> 143 [xlabel=1
,arrowhead=onone
,headport=w];
139 -> 140 [xlabel=""
,tailport=e];
147 -> 148 [xlabel=""
,tailport=e];
148 -> 149 [xlabel=1
140 -> 141 [xlabel=1
,arrowhead=onone
,headport=w];
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -6
View File
@@ -76,7 +76,7 @@ itemCombinations =
++ [ po [HELD AMR, cr PIPE] sniperRifle
, po [HELD RIFLE, cr PIPE] amr
, po [HELD AMR, cr SPRING] autoAmr
, po [HELD AMR, cr MOTOR] machineGun
-- , po [HELD AMR, cr MOTOR] machineGun
, p [p 2 $ cr TUBE, o $ cr HARDWARE] launcher
, p [p 2 $ cr TUBE, o $ HELD LAUNCHER] (launcherX 2)
]
@@ -87,8 +87,8 @@ itemCombinations =
, po [HELD FLAMETHROWER, cr STEELDRUM] flameWall
, po [HELD FLAMETHROWER, cr PUMP] flameTorrent
, p [o $ cr PRISM, o $ cr TRANSFORMER, o $ cr PIPE] lasGun
, po [HELD LASGUN, HELD LASGUN, cr HARDWARE] dualBeam
, po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
-- , po [HELD LASGUN, HELD LASGUN, cr HARDWARE] dualBeam
-- , po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
-- , po [HELD LASGUN, HELD LASGUN, HELD LASGUN, cr HARDWARE] lasCircle
, p [o $ cr TRANSFORMER, p 2 $ cr CAN] sparkGun
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
@@ -111,7 +111,7 @@ itemCombinations =
, po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
, po [cr TRANSFORMER, AMMOMAG BATTERY, cr MICROCHIP] (energyBallCraft TeslaBall)
]
++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
-- ++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
++ map (\i -> po [hd (VOLLEYGUN i), HELD (BANGSTICK 1)] $ volleyGun (i + 1)) [3 .. 5]
++ map (\i -> po [hd (MINIGUNX i), HELD (BANGSTICK 1)] $ miniGunX (i + 1)) [3 .. 15]
@@ -194,7 +194,8 @@ moduleCombinations =
)
,
( ModDualBeam
, [dualBeam]
,[]
-- , [dualBeam]
,
[ amod [cr (ENERGYBALLCRAFT IncBall)] INCENDLAS
, amod [cr TRANSFORMER] SPLITLAS
@@ -260,7 +261,7 @@ bulletWeapons =
, burstRifle
, bangCone
, blunderbuss
, machineGun
-- , machineGun
, elephantGun
, sniperRifle
, amr
+1 -1
View File
@@ -48,7 +48,7 @@ maxShowX bt = case bt of
HELD (MINIGUNX _) -> Just 3
HELD (GRAPECANNON _) -> Just 1
HELD (LAUNCHERX _) -> Just 2
HELD (LASWIDE _) -> Just 2
-- HELD (LASWIDE _) -> Just 2
-- LASGUNFOCUS _ -> Just 2
_ -> Nothing
+7 -7
View File
@@ -204,7 +204,7 @@ inventoryX c = case c of
'J' ->
[ lasGun
, lasGun
, dualBeam
--, dualBeam
] <> makeTypeCraftNum 10 TRANSFORMER
'K' ->
[ autoRifle
@@ -268,17 +268,17 @@ testInventory =
stackedInventory :: [Item]
stackedInventory =
[ burstRifle
, poisonSprayer
, chemFuelPouch
[ targetingScope TARGETLASER
, zoomScope
, burstRifle
, megaTinMag
, teslaGun
, lasGun
, tractorGun
, megaBattery
, bulletSynthesizer
, drumMag
, launcher
, rocketRemoteScreen
, megaShellMag
, launcherX 3
, megaShellMag
, megaShellMag
@@ -301,7 +301,7 @@ stackedInventory =
, flatShield
, spawnGun (lamp 5)
, lasGun
, lasWide 20
-- , lasWide 20
, poisonSprayer
, bulletBeltPack
, bulletBeltBracer
+6
View File
@@ -62,9 +62,13 @@ stateUpdate f =
, updateInv -- upInv must be called before invSideEff 22.05.23
, invSideEff
, equipmentEffects
, heldItemEffects
, heldAimEffects
]
heldItemEffects :: Creature -> World -> World
heldItemEffects _ = id
heldAimEffects :: Creature -> World -> World
heldAimEffects cr = fromMaybe id $ do
guard (crIsAiming cr)
@@ -270,6 +274,8 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of
| l < m -> it & itUse . leftConsumption . arProgress -~ 1
_ -> it
--itemGetTargeting :: LabelDoubleTree ComposeLinkType Item
-- I feel like there should be a centralised function that supersumes this
-- i.e. a function that deals with all states that depend upon item positioning
-- in the inventory
+5
View File
@@ -13,13 +13,18 @@ import Dodge.Data.Item.Use.Consumption.Ammo
data ComposeLinkType
= AmmoInLink Int AmmoType
| AmmoModLink
| WeaponScopeLink
| WeaponTargetingLink
| RocketRemoteScreenLink
deriving (Eq,Ord,Show,Read)
data ComposedItem = WeaponCI
| WeaponScopeCI
| WeaponTargetingCI
| AmmoModifierCI AmmoType
| AmmoCI AmmoType
| UncomposableCI
| RocketRemoteScreenCI
deriving (Eq,Ord,Show,Read)
makeLenses ''ComposedItem
+5 -3
View File
@@ -98,6 +98,8 @@ data AttachType
= SCROLLATTACH ScrollAttachType
| TARGETATTACH {_ibtAttachTarget :: TargetType}
| BULLETSYNTHESIZER
| ROCKETHOMER
| ROCKETREMOTESCREEN
-- | BULPAYLOADATTACH
-- | BULTRAJECTORYATTACH
deriving (Eq, Ord, Show, Read)
@@ -178,7 +180,7 @@ data HeldItemType
| AMR
| AUTOAMR
| SNIPERRIFLE
| MACHINEGUN
-- | MACHINEGUN
| FLAMESPITTER
| FLAMETHROWER
| FLAMETORRENT
@@ -188,8 +190,8 @@ data HeldItemType
| TESLAGUN
| LASGUN
-- | LASCIRCLE
| DUALBEAM
| LASWIDE {_xNum :: Int}
-- | DUALBEAM
-- | LASWIDE {_xNum :: Int}
| TRACTORGUN
| LAUNCHER
| LAUNCHERX {_xNum :: Int}
+11 -6
View File
@@ -16,17 +16,22 @@ data UseDelay -- should just be Delay
{ _rateMax :: Int
, _rateTime :: Int
}
| VariableRate
{ _rateMax :: Int
, _rateTime :: Int
, _rateMaxMax :: Int
, _rateMinMax :: Int
}
-- | VariableRate
-- { _rateMax :: Int
-- , _rateTime :: Int
-- , _rateMaxMax :: Int
-- , _rateMinMax :: Int
-- }
| WarmUpNoDelay
{ _warmTime :: Int
, _warmMax :: Int
, _warmSound :: SoundID
}
-- | ChargingRate
-- { _chargeTime :: Int
-- , _chargeMax :: Int
-- , _chargeSound :: Maybe SoundID
-- }
deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''UseDelay
+10 -10
View File
@@ -15,14 +15,14 @@ import Control.Lens
data Huse
= HeldDoNothing
-- | HeldUseAmmoParams
| HeldOverNozzlesUseGasParams
| HeldPJCreation
| HeldPJCreationX Int
-- | HeldOverNozzlesUseGasParams
-- | HeldPJCreation
-- | HeldPJCreationX Int
| HeldFireRemoteShell
| HeldExplodeRemoteShell Int Int
| HeldDetectorEffect Detector
-- | HeldTeslaArc
| HeldLaser
-- | HeldLaser
| HeldCircleLaser
| HeldDualLaser
| HeldTractor
@@ -68,17 +68,17 @@ data Luse
data HeldMod
= PistolMod
-- | PoisonSprayerMod
| FlameSpitterMod
| FlameSpitterRepeatMod
-- | FlameSpitterMod
-- | FlameSpitterRepeatMod
-- | FlameThrowerMod
-- | LauncherMod
-- | TeslaMod
-- | CircleLaserMod
| LasWideMod Int
| DualBeamMod
-- | LasWideMod Int
-- | DualBeamMod
-- | LasMod
-- | LauncherXMod Int
| ShatterMod
-- | ShatterMod
-- | AmmoCheckMod
-- | AmmoUseCheckMod
-- | AmmoHammerTimeUseOneMod
@@ -103,7 +103,7 @@ data HeldMod
| FireRemoteShellMod
| ExplodeRemoteShellMod
| DoNothingMod
| ForceFieldMod
-- | ForceFieldMod
| DetectorMod Detector
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+6
View File
@@ -39,6 +39,7 @@ data ItemUse
, _heldAmmoTypes :: IM.IntMap AmmoType
, _heldParams :: HeldParams
, _heldTriggerType :: TriggerType
, _heldUsageTime :: Int -- this is not yet implemented
-- , _useTargeting :: Maybe TargetType
}
| LeftUse
@@ -163,6 +164,9 @@ data MuzzleEffect
, _nzCurrentWalkAngle :: Float
, _nzWalkSpeed :: Float
}
| MuzzleShatter
| MuzzleForceField
| MuzzleDetector
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Muzzle = Muzzle
@@ -172,6 +176,7 @@ data Muzzle = Muzzle
, _mzAmmoSlot :: Int
, _mzFlareType :: FlareType
, _mzEffect :: MuzzleEffect
, _mzChargeRequirement :: Maybe Int
-- , _mzRecoil :: Float
-- , _mzTorque :: Float
-- , _mzSidePush :: Float
@@ -208,6 +213,7 @@ makeLenses ''HeldParams
makeLenses ''AttachParams
makeLenses ''ScrollAttachParams
makeLenses ''AmmoParams
makeLenses ''MuzzleEffect
deriveJSON defaultOptions ''MuzzleEffect
deriveJSON defaultOptions ''FlareType
deriveJSON defaultOptions ''TriggerType
+1 -1
View File
@@ -52,7 +52,7 @@ defaultBulletWeapon =
& itUse . heldAmmoTypes .~ singleAmmo BulletAmmo
-- & itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet Nothing]
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
+1
View File
@@ -47,4 +47,5 @@ defaultHeldUse =
, _weaponRepeat = []
}
, _heldTriggerType = HammerTrigger
, _heldUsageTime = 0
}
+1
View File
@@ -25,6 +25,7 @@ defaultMuzzle = Muzzle
, _mzAmmoSlot = 0
, _mzFlareType = DefaultFlareType
, _mzEffect = MuzzleShootBullet
, _mzChargeRequirement = Nothing
}
+97 -85
View File
@@ -86,27 +86,27 @@ heldEffect effecttype = case effecttype of
-- , withTempLight 1 100 (V3 0 0 1)
-- , ammoCheckI
-- ]
LasWideMod n -> foldl' (&) (shootLaser . _ldtValue)
[ useAmmoAmount 1
, withItem $ \it ->
duplicateNumBarrels
-- ( min
-- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
(it ^?! itParams . lasCycle `div` lasWideRate)
-- )
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItemUpdateFirst (increasecycleLasWide n)
, ammoCheckI
]
DualBeamMod -> foldl' (&) (shootDualLaser . _ldtValue)
[ useAmmoAmount 1
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, ammoCheckI
]
-- LasWideMod n -> foldl' (&) (shootLaser . _ldtValue)
-- [ useAmmoAmount 1
-- , withItem $ \it ->
-- duplicateNumBarrels
---- ( min
---- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
-- (it ^?! itParams . lasCycle `div` lasWideRate)
---- )
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , withSoundForI tone440sawtoothquietS 2
-- , withItemUpdateFirst (increasecycleLasWide n)
-- , ammoCheckI
-- ]
-- DualBeamMod -> foldl' (&) (shootDualLaser . _ldtValue)
-- [ useAmmoAmount 1
-- , withSoundForI tone440sawtoothquietS 2
-- , withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
-- , withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , ammoCheckI
-- ]
-- LasMod -> foldl' (&) (shootLaser . _ldtValue)
-- [ useAmmoAmount 1
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
@@ -122,13 +122,13 @@ heldEffect effecttype = case effecttype of
-- --, ammoCheckI
-- , blCheck
-- ]
ShatterMod -> foldl' (&) (shootShatter . _ldtValue)
[ useAmmoAmount 1
, -- , withSoundStart tap3S
useTimeCheck
, ammoCheckI
, blCheck
]
-- ShatterMod -> foldl' (&) (shootShatter . _ldtValue)
-- [ useAmmoAmount 1
-- , -- , withSoundStart tap3S
-- useTimeCheck
-- , ammoCheckI
-- , blCheck
-- ]
-- BangCaneMod -> bulletGunEffect
-- [ withFlare
-- , withSmoke 1 black 20 200 5
@@ -319,16 +319,16 @@ heldEffect effecttype = case effecttype of
FireRemoteShellMod -> undefined
ExplodeRemoteShellMod -> undefined
DoNothingMod -> const $ const id
ForceFieldMod -> undefined
-- ForceFieldMod -> undefined
DetectorMod _ -> undefined
where
-- f = do
-- nzpres <- state $ randomR (3, 4)
-- return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
increasecycleLasWide n it = case _heldHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
thegapDualBeam = _dbGap . _itParams
-- increasecycleLasWide n it = case _heldHammer (_itUse it) of
-- HammerUp -> it & itParams . lasCycle .~ 1
-- _ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
-- thegapDualBeam = _dbGap . _itParams
--directedTelPos _ cr w = (p, a)
-- where
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
@@ -499,15 +499,24 @@ useLoadedAmmo itm cr (cme,w) (mz,x,mid) = (,) (cme & cmeSound .~ True) $
MuzzleTractor -> shootTractorBeam itm cr w
MuzzleLauncher -> createProjectile' mid mz itm cr w
MuzzleNozzle {} -> useGasParams mid mz itm cr $ walkNozzle mz itm cr w
MuzzleShatter -> shootShatter itm cr w
MuzzleForceField -> useForceFieldGun itm cr w
MuzzleDetector -> itemDetectorEffect itm cr w
walkNozzle mz itm cr w = w
& randGen .~ g
where
nz = _mzEffect mz
(walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
aspeed = _nzWalkSpeed nz
maxa = _nzMaxWalkAngle nz
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
itemDetectorEffect :: Item -> Creature -> World -> World
itemDetectorEffect itm cr w = fromMaybe w $ do
HELDDETECTOR dt <- itm ^? itType . iyBase . ibtHeld
return $ detectorEffect dt itm cr w
walkNozzle :: Muzzle -> Item -> Creature -> World -> World
walkNozzle _ _ _ w = w
-- & randGen .~ g
-- where
-- nz = _mzEffect mz
-- (walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
-- aspeed = _nzWalkSpeed nz
-- maxa = _nzMaxWalkAngle nz
-- wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
shootTractorBeam :: Item -> Creature -> World -> World
@@ -549,6 +558,7 @@ shootLaser' itm cr mz w = w
inacc = _mzInaccuracy mz
dir = _crDir cr + _mzRot mz + a
removeAmmoFromMag :: Int -> Maybe Int -> Creature -> World -> World
removeAmmoFromMag x mid cr = fromMaybe id $ do
magid <- mid
return $ cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix magid . itUse . amagLoadStatus . iaLoaded -~ x
@@ -559,10 +569,10 @@ shootBullet itm cr w (mz,x,mid) = fromMaybe w $ do
-- should be able to pass the magazine in from elsewhere?
thebullet <- cr ^? crInv . ix magid . itUse . amagParams . ampBullet
return $ w & flip (foldl' (&)) (replicate x (makeBullet thebullet itm cr mz))
& makeMuzzleFlare mz itm cr
& makeMuzzleSmoke mz itm cr
where
cid = _crID cr
-- & makeMuzzleFlare mz itm cr
-- & makeMuzzleSmoke mz itm cr
-- where
-- cid = _crID cr
-- the random generator is not updated here, not sure if that is a problem
makeBullet :: Bullet -> Item -> Creature -> Muzzle -> World -> World
@@ -610,7 +620,7 @@ useMod hm = case hm of
FireRemoteShellMod -> undefined
ExplodeRemoteShellMod -> undefined
DoNothingMod -> undefined
ForceFieldMod -> undefined
-- ForceFieldMod -> undefined
DetectorMod _ -> undefined
-- HeldModNothing -> []
-- PoisonSprayerMod ->
@@ -664,27 +674,27 @@ useMod hm = case hm of
-- , withItemUpdateFirst increasecycleLasCircle
-- , ammoCheckI
-- ]
LasWideMod n ->
[ useAmmoAmount 1
, withItem $ \it ->
duplicateNumBarrels
-- ( min
-- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
(it ^?! itParams . lasCycle `div` lasWideRate)
-- )
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
, withItemUpdateFirst (increasecycleLasWide n)
, ammoCheckI
]
DualBeamMod ->
[ useAmmoAmount 1
, withSoundForI tone440sawtoothquietS 2
, withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
, withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, ammoCheckI
]
-- LasWideMod n ->
-- [ useAmmoAmount 1
-- , withItem $ \it ->
-- duplicateNumBarrels
---- ( min
---- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
-- (it ^?! itParams . lasCycle `div` lasWideRate)
---- )
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , withSoundForI tone440sawtoothquietS 2
-- , withItemUpdateFirst (increasecycleLasWide n)
-- , ammoCheckI
-- ]
-- DualBeamMod ->
-- [ useAmmoAmount 1
-- , withSoundForI tone440sawtoothquietS 2
-- , withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
-- , withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , ammoCheckI
-- ]
-- LasMod ->
-- [ useAmmoAmount 1
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
@@ -700,13 +710,13 @@ useMod hm = case hm of
-- --, ammoCheckI
-- , blCheck
-- ]
ShatterMod ->
[ useAmmoAmount 1
, -- , withSoundStart tap3S
useTimeCheck
, ammoCheckI
, blCheck
]
-- ShatterMod ->
-- [ useAmmoAmount 1
-- , -- , withSoundStart tap3S
-- useTimeCheck
-- , ammoCheckI
-- , blCheck
-- ]
-- AmmoCheckMod -> [ammoCheckI]
-- AmmoUseCheckMod -> [useAmmoAmount 1, useTimeCheck, ammoCheckI]
-- AmmoHammerTimeUseOneMod ->
@@ -910,10 +920,10 @@ useMod hm = case hm of
--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 _heldHammer (_itUse it) of
HammerUp -> it & itParams . lasCycle .~ 1
_ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
thegapDualBeam = _dbGap . _itParams
-- increasecycleLasWide n it = case _heldHammer (_itUse it) of
-- HammerUp -> it & itParams . lasCycle .~ 1
-- _ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
-- thegapDualBeam = _dbGap . _itParams
--directedTelPos _ cr w = (p, a)
-- where
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
@@ -937,12 +947,12 @@ useHeld hu = case hu of
HeldDoNothing -> const $ const id
-- HeldUseAmmoParams -> shootBullet
-- HeldOverNozzlesUseGasParams -> overNozzles useGasParams
HeldPJCreation -> usePjCreation
HeldPJCreationX _ -> usePjCreationX
-- HeldPJCreation -> usePjCreation
-- HeldPJCreationX _ -> usePjCreationX
HeldFireRemoteShell -> fireRemoteShell
HeldDetectorEffect dt -> detectorEffect dt . _ldtValue
-- HeldTeslaArc -> shootTeslaArc . _ldtValue
HeldLaser -> shootLaser . _ldtValue
-- HeldLaser -> shootLaser . _ldtValue
HeldCircleLaser -> circleLaser . _ldtValue
HeldDualLaser -> shootDualLaser . _ldtValue
HeldTractor -> aTractorBeam . _ldtValue
@@ -1042,6 +1052,8 @@ useGasParams mmagid mz itm cr w =
gasCreate :: GasFuel -> GasCreate -> GasCreate
gasCreate = flip const
doGenFloat :: RandomGen g => GenFloat -> g -> (Float, g)
doGenFloat (ConstFloat x) g = (x,g)
doGenFloat (UniRandFloat x y) g = randomR (x,y) g
@@ -1103,14 +1115,14 @@ mcShootLaser it mc = cWorld . lWorld . lasers .:~ lasRayAt (_lasColor $ _itParam
-- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> Muzzle -> World -> World
shootTeslaArc it cr mz w =
shootTeslaArc itm cr mz w =
w'
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itParams .~ ip
where
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
(w', ip) = makeTeslaArc (_itParams it) pos dir w
pos = _crPos cr +.+ aimingMuzzleLength cr it *.* unitVectorAtAngle dir
dir = _crDir cr
(w', ip) = makeTeslaArc (_itParams itm) pos dir w
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing
+2
View File
@@ -41,6 +41,8 @@ itemFromAttachType at = case at of
SCROLLATTACH ZOOMSCOPE -> zoomScope
TARGETATTACH tt -> targetingScope tt
BULLETSYNTHESIZER -> bulletSynthesizer
ROCKETREMOTESCREEN -> rocketRemoteScreen
ROCKETHOMER -> rocketHomer
itemFromConsumableType :: ConsumableItemType -> Item
+5
View File
@@ -105,3 +105,8 @@ bulletSynthesizer :: Item
bulletSynthesizer = defaultHeldItem
& itType . iyBase .~ ATTACH BULLETSYNTHESIZER
& itUse .~ AttachUse NoAttachParams
rocketHomer :: Item
rocketHomer = defaultHeldItem
& itType . iyBase .~ ATTACH ROCKETHOMER
& itUse .~ AttachUse NoAttachParams
+8 -5
View File
@@ -51,7 +51,8 @@ basicItemDisplay :: Item -> [String]
basicItemDisplay itm =
Prelude.take (itSlotsTaken itm) $
itemBaseName itm :
catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
catMaybes [maybeWarmupStatus itm]
++ moduleStrings itm
++ repeat "*"
@@ -75,6 +76,8 @@ showAttachItem t = case t of
SCROLLATTACH x -> show x
TARGETATTACH x -> show x
BULLETSYNTHESIZER -> "BSYNTH"
ROCKETREMOTESCREEN -> "REMOTE SCREEN"
ROCKETHOMER -> "HOMING MOD"
showEquipItem :: EquipItemType -> String
showEquipItem eit = case eit of
@@ -182,7 +185,7 @@ maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
let n = show x
in Just $ Prelude.take (5 - Prelude.length n) "*WARM" ++ n
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))
--maybeRateStatus :: Item -> Maybe String
--maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
-- Nothing -> Nothing
-- _ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))
+16 -16
View File
@@ -177,7 +177,7 @@ heldItemSPic ht it = case ht of
AMR -> noPic $ baseAMRShape <> addTinClip it
AUTOAMR -> noPic $ baseAMRShape <> addTinClip it
SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it
MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
-- MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
FLAMESPITTER -> flamerPic it
FLAMETHROWER -> flamerPic it
FLAMETORRENT -> flamerPic it
@@ -187,8 +187,8 @@ heldItemSPic ht it = case ht of
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
-- LASCIRCLE -> lasGunPic it
DUALBEAM -> dualBeamPic it
LASWIDE _ -> lasGunPic it
-- DUALBEAM -> dualBeamPic it
-- LASWIDE _ -> lasGunPic it
--SONICGUN -> noPic baseSonicShape
TRACTORGUN -> tractorGunPic it
LAUNCHER -> launcherPic it
@@ -468,19 +468,19 @@ lasGunPic _ =
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
dualBeamPic :: Item -> SPic
dualBeamPic it =
( colorSH blue $
upperBoxST 4 (rectNESW gap 3 (- gap) 1)
<> upperBoxSU 4 (rectNESW gap (-1) (- gap) (-3))
<> upperBoxSU 1 (rectNESW gap 3 (- gap) (-3))
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
)
where
--amFrac = fractionLoadedAmmo it
amFrac = 0.5
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
gap = _dbGap (_itParams it) - 3
--dualBeamPic :: Item -> SPic
--dualBeamPic it =
-- ( colorSH blue $
-- upperBoxST 4 (rectNESW gap 3 (- gap) 1)
-- <> upperBoxSU 4 (rectNESW gap (-1) (- gap) (-3))
-- <> upperBoxSU 1 (rectNESW gap 3 (- gap) (-3))
-- , setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
-- )
-- where
-- --amFrac = fractionLoadedAmmo it
-- amFrac = 0.5
-- col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
-- gap = _dbGap (_itParams it) - 3
tractorGunPic :: Item -> SPic
tractorGunPic = lasGunPic
+9 -3
View File
@@ -30,13 +30,19 @@ singleLDT x = LDT x [] []
baseComposedItem :: ItemBaseType -> Item -> CIL
baseComposedItem ibt itm = case ibt of
HELD _ -> heldComposedItem itm
HELD hit -> heldComposedItem itm hit
AMMOMAG _ -> ammoComposedItem itm
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
ATTACH (TARGETATTACH{}) -> (WeaponTargetingCI, [], [])
ATTACH (SCROLLATTACH ZOOMSCOPE) -> (WeaponScopeCI, [], [])
ATTACH ROCKETHOMER -> (AmmoModifierCI ProjectileAmmo, [], [])
ATTACH ROCKETREMOTESCREEN -> (AmmoModifierCI ProjectileAmmo, [], [])
_ -> (UncomposableCI, [], [])
heldComposedItem :: Item -> CIL
heldComposedItem itm = (WeaponCI, map f ats, [])
heldComposedItem :: Item -> HeldItemType -> CIL
heldComposedItem itm hit = case hit of
_ -> (WeaponCI, map f ats,
[(WeaponTargetingLink,WeaponTargetingCI),(WeaponScopeLink,WeaponScopeCI)])
where
ats = maybe [] IM.toList $ itm ^? itUse . heldAmmoTypes
f (i,atype) = (AmmoInLink i atype,AmmoCI atype)
+3 -3
View File
@@ -46,7 +46,7 @@ itemFromHeldType ht = case ht of
AMR -> amr
AUTOAMR -> autoAmr
SNIPERRIFLE -> sniperRifle
MACHINEGUN -> machineGun
-- MACHINEGUN -> machineGun
FLAMESPITTER -> flameSpitter
FLAMETHROWER -> flameThrower
FLAMETORRENT -> flameTorrent
@@ -56,8 +56,8 @@ itemFromHeldType ht = case ht of
TESLAGUN -> teslaGun
LASGUN -> lasGun
-- LASCIRCLE -> lasCircle
DUALBEAM -> dualBeam
LASWIDE i -> lasWide i
-- DUALBEAM -> dualBeam
-- LASWIDE i -> lasWide i
TRACTORGUN -> tractorGun
LAUNCHER -> launcher
LAUNCHERX i -> launcherX i
+38 -37
View File
@@ -2,8 +2,8 @@ module Dodge.Item.Held.BatteryGuns where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Default.Item
import Dodge.Base
import Dodge.Data.Beam
--import Dodge.Base
--import Dodge.Data.Beam
import Color
import Control.Lens
import qualified Data.Map.Strict as M
@@ -32,7 +32,7 @@ teslaGun =
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
-- & itUse . heldAim . aimMuzPos .~ 4
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 TeslaGunFlare MuzzleTesla]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 TeslaGunFlare MuzzleTesla Nothing]
& itType . iyBase .~ HELD TESLAGUN
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldTriggerType .~ AutoTrigger
@@ -46,7 +46,7 @@ lasGun =
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser Nothing]
& itParams
.~ Refracting
{ _phaseV = 1
@@ -91,7 +91,8 @@ tractorGun =
-- & itUse . heldMods .~ TractorMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleTractor]
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ DefaultFlareType
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTractor
& itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
@@ -102,15 +103,15 @@ tractorGunTweak =
, _tweakMax = 4
}
lasWide :: Int -> Item
lasWide n =
lasGun
& itType . iyBase .~ HELD (LASWIDE n)
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n
& itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser | y <- spreadFromCenter n 1]
--lasWide :: Int -> Item
--lasWide n =
-- lasGun
-- & itType . iyBase .~ HELD (LASWIDE n)
-- & itParams . lasColor .~ yellow
-- & itParams . lasDamage .~ 2
-- & itUse . heldMods .~ LasWideMod n
-- & itUse . heldAim . aimMuzzles
-- .~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser Nothing | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item
defaultBatteryGun =
@@ -136,26 +137,26 @@ batteryModules =
-- & itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimRange .~ 1
dualBeam :: Item
dualBeam =
lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser]
& itParams
.~ DualBeam
{ _phaseV = 1
, _lasColor = red
, _lasColor2 = green
, _lasCycle = 0
, _lasDamage = 11
, _lasBeam = BeamCombine LasBeamCombine
, _subParams = Nothing
, _dbGap = 20
}
-- & itUse . heldUse .~ HeldDualLaser --shootDualLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ DualBeamMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
--dualBeam :: Item
--dualBeam =
-- lasGun
-- & itType . iyBase .~ HELD DUALBEAM
-- & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser Nothing]
-- & itParams
-- .~ DualBeam
-- { _phaseV = 1
-- , _lasColor = red
-- , _lasColor2 = green
-- , _lasCycle = 0
-- , _lasDamage = 11
-- , _lasBeam = BeamCombine LasBeamCombine
-- , _subParams = Nothing
-- , _dbGap = 20
-- }
---- & itUse . heldUse .~ HeldDualLaser --shootDualLaser
-- & itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ DualBeamMod
-- & itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimRange .~ 1
-- & itUse . heldAim . aimStance .~ TwoHandFlat
-- & itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
+2 -2
View File
@@ -28,7 +28,6 @@ defaultBangCane =
-- & itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
volleyGun :: Int -> Item
volleyGun i =
@@ -43,6 +42,7 @@ volleyGun i =
<*> ZipList [0..i-1]
<*> pure PistolFlare
<*> pure MuzzleShootBullet
<*> pure Nothing
)
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
@@ -97,7 +97,7 @@ miniGunX i =
& itUse . heldParams . bulGunSound ?~ (mini1S,2)
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet Nothing)
& itUse . heldParams . recoil .~ 10 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
+1 -1
View File
@@ -17,7 +17,7 @@ bangCone =
& itUse . heldMods .~ PistolMod
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet)
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet Nothing)
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
& itUse . heldParams . recoil .~ 150
+3 -1
View File
@@ -34,7 +34,8 @@ launcher =
& itUse . heldAim . aimStance .~ TwoHandOver
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType MuzzleLauncher]
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleLauncher
& itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
@@ -55,6 +56,7 @@ launcherX i =
<*> ZipList [0..]
<*> pure DefaultFlareType
<*> pure MuzzleLauncher
<*> pure Nothing
)
& itUse . heldAmmoTypes .~ IM.fromList [(j,ProjectileAmmo) | j <- [0..i-1]]
where
+18 -17
View File
@@ -4,7 +4,7 @@ module Dodge.Item.Held.Rod (
amr,
autoAmr,
sniperRifle,
machineGun,
-- machineGun,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
@@ -31,7 +31,8 @@ bangRod =
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare MuzzleShootBullet]
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ HeavySmokeFlare
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item
@@ -59,18 +60,18 @@ sniperRifle =
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
machineGun :: Item
machineGun =
bangRod
& itType . iyBase .~ HELD MACHINEGUN
-- & itUse . heldMods .~ MachineGunMod
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldDelay .~ VariableRate
{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itInvSize .~ 3
& itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
& itUse . heldTriggerType .~ AutoTrigger
--machineGun :: Item
--machineGun =
-- bangRod
-- & itType . iyBase .~ HELD MACHINEGUN
---- & itUse . heldMods .~ MachineGunMod
-- & itUse . heldMods .~ PistolMod
-- & itUse . heldAim . aimWeight .~ 8
-- & itUse . heldAim . aimRange .~ 1
-- & itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldDelay .~ VariableRate
-- {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
-- & itInvSize .~ 3
-- & itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
-- & itUse . heldTriggerType .~ AutoTrigger
+7 -2
View File
@@ -33,8 +33,12 @@ flameSpitter =
& itType . iyBase .~ HELD FLAMESPITTER
-- & itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
& itUse . heldMods .~ FlameSpitterMod
& itUse . heldDelay .~ FixedRate{_rateMax = 3, _rateTime = 0}
-- & itUse . heldMods .~ FlameSpitterMod
& itUse . heldParams . weaponInvLock .~ 10
& itUse . heldParams . weaponRepeat .~ [1..9]
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
& itUse . heldTriggerType .~ HammerTrigger
flameTorrent :: Item
flameTorrent =
@@ -88,6 +92,7 @@ flameThrower =
, _nzWalkSpeed = 0.01
, _nzCurrentWalkAngle = 0
}
Nothing
]
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo
& itType . iyBase .~ HELD FLAMETHROWER
+1 -1
View File
@@ -27,7 +27,7 @@ bangStick i =
-- & itUse . heldMods .~ BangStickMod
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet | a <- spreadAroundCenter i baseStickSpread]
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet Nothing | a <- spreadAroundCenter i baseStickSpread]
baseStickSpread :: Float
baseStickSpread = 0.2
+4 -2
View File
@@ -40,11 +40,12 @@ forceFieldGun =
-- & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
& itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- & itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleForceField
{- |
Sends out pulses that display walls.
@@ -55,7 +56,8 @@ clickDetector dt =
& itUse . heldDelay . rateMax .~ 20
-- & itUse . heldUse .~ HeldDetectorEffect dt --detectorEffect dt
-- & itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldMods .~ DetectorMod dt --detectorEffect dt
-- & itUse . heldMods .~ DetectorMod dt --detectorEffect dt
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itType . iyBase .~ HELD (HELDDETECTOR dt)
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
+6 -1
View File
@@ -3,12 +3,17 @@ module Dodge.Item.Held.Weapons where
import Dodge.Default.Item
import Dodge.Data.Item
import Control.Lens
import Linear.V2
shatterGun :: Item
shatterGun =
defaultHeldItem
& itType . iyBase .~ HELD SHATTERGUN
& itUse . heldDelay . rateMax .~ 10
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleShatter
-- & itUse . heldUse .~ HeldShatter --shootShatter
& itUse . heldMods .~ ShatterMod
-- & itUse . heldMods .~ ShatterMod
& itUse . heldAim . aimStance .~ TwoHandFlat
+3 -3
View File
@@ -81,7 +81,7 @@ heldInfo hit = case hit of
AMR -> "An antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
AUTOAMR -> "An automatic antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
SNIPERRIFLE -> "A firearm designed with long range capability in mind. Its long barrel requires reloading after each shot."
MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
-- MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
FLAMESPITTER -> "A weapon that globs out burning fuel."
FLAMETHROWER -> "A weapon that squirts out burning fuel."
FLAMETORRENT -> "A weapon that streams out burning fuel in a torrent."
@@ -91,8 +91,8 @@ heldInfo hit = case hit of
TESLAGUN -> "A weapon that discharges a sustained arc of electricity. The arc will attempt to discharge at a nearby object."
LASGUN -> "A weapon that continuously emits photons in a narrow beam."
-- LASCIRCLE -> "A extensive configuration of prisms and mirrors that produces multiple laser beams around its user."
DUALBEAM -> "A weapon that emits two beams that converge at a selectable point in front of the user."
LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
-- DUALBEAM -> "A weapon that emits two beams that converge at a selectable point in front of the user."
-- LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
TRACTORGUN -> "An item that produces a beam of gravitons."
LAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin."
LAUNCHERX i -> over _head toUpper (showInt i) ++ " tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle."
+3 -3
View File
@@ -45,7 +45,7 @@ heldBounds hit = case hit of
AMR -> amrs
AUTOAMR -> amrs
SNIPERRIFLE -> amrs
MACHINEGUN -> amrs
-- MACHINEGUN -> amrs
FLAMESPITTER -> fs
FLAMETHROWER -> fs
FLAMETORRENT -> fs
@@ -55,8 +55,8 @@ heldBounds hit = case hit of
TESLAGUN -> ts
LASGUN -> ls
-- LASCIRCLE -> ls
DUALBEAM -> ls
LASWIDE _ -> ls
-- DUALBEAM -> ls
--LASWIDE _ -> ls
TRACTORGUN -> ls
LAUNCHER -> launchs
LAUNCHERX _ -> launchs
+7
View File
@@ -1,6 +1,7 @@
module Dodge.Item.Scope (
zoomScope,
targetingScope,
rocketRemoteScreen,
) where
import Control.Lens
@@ -18,3 +19,9 @@ targetingScope tt =
defaultHeldItem
& itType . iyBase .~ ATTACH (TARGETATTACH tt)
& itUse .~ AttachUse TargetAttachParams
rocketRemoteScreen :: Item
rocketRemoteScreen =
defaultHeldItem
& itType . iyBase .~ ATTACH ROCKETREMOTESCREEN
& itUse .~ AttachUse NoAttachParams
+43 -42
View File
@@ -18,7 +18,7 @@ module Dodge.Item.Weapon.TriggerType (
withItem,
withItemUpdate,
withItemUpdateFirst,
rateIncAB,
-- rateIncAB,
torqueBefore,
torqueBeforeAtLeast,
withTorqueAfter,
@@ -161,44 +161,44 @@ itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
--itUseAmmo :: Int -> Item -> Item
--itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
{- | Fires at an increasing rate.
Has different effect after first fire.
Applies ammo check and use cooldown check.
-}
rateIncAB ::
-- | Extra effect on first fire
ChainEffect ->
-- | Extra effect on continued fire
ChainEffect ->
ChainEffect
rateIncAB exeffFirst exeffCont eff item cr w
| repeatFire =
w
& pointItem
%~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
-- . itUseAmmo 1
. (itUse . heldDelay . rateTime .~ currentRate)
)
& exeffCont eff item cr
| firstFire =
w
& pointItem
%~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
-- . itUseAmmo 1
. (itUse . heldDelay . rateTime .~ startRate)
)
& exeffFirst eff item cr
| otherwise = w
where
item' = _ldtValue item
fastRate = _rateMinMax . _heldDelay $ _itUse item'
startRate = _rateMaxMax . _heldDelay $ _itUse item'
cid = _crID cr
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
pointItem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef
currentRate = _rateMax (_heldDelay (_itUse item'))
repeatFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 1
firstFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 0
--{- | Fires at an increasing rate.
--Has different effect after first fire.
--Applies ammo check and use cooldown check.
---}
--rateIncAB ::
-- -- | Extra effect on first fire
-- ChainEffect ->
-- -- | Extra effect on continued fire
-- ChainEffect ->
-- ChainEffect
--rateIncAB exeffFirst exeffCont eff item cr w
-- | repeatFire =
-- w
-- & pointItem
-- %~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
---- . itUseAmmo 1
-- . (itUse . heldDelay . rateTime .~ currentRate)
-- )
-- & exeffCont eff item cr
-- | firstFire =
-- w
-- & pointItem
-- %~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
---- . itUseAmmo 1
-- . (itUse . heldDelay . rateTime .~ startRate)
-- )
-- & exeffFirst eff item cr
-- | otherwise = w
-- where
-- item' = _ldtValue item
-- fastRate = _rateMinMax . _heldDelay $ _itUse item'
-- startRate = _rateMaxMax . _heldDelay $ _itUse item'
-- cid = _crID cr
-- itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
-- pointItem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef
-- currentRate = _rateMax (_heldDelay (_itUse item'))
-- repeatFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 1
-- firstFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 0
-- | Apply effect after a warm up.
@@ -377,7 +377,7 @@ Applies a world effect after an item use cooldown check.
-}
useTimeCheck :: ChainEffect
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just (FixedRate _ 0) -> f item cr $ setUseTime w
Just (FixedRate _ 0) -> f item cr $ setUseRate w
Just (FixedRate _ _) -> w
Just (WarmUpNoDelay wt wm ws) | wt < wm -> w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) ws (Just 2)
@@ -385,10 +385,11 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just (WarmUpNoDelay _ wm _) -> f item cr w
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime .~ (wm+1)
Just NoDelay -> f item cr w
_ -> w
-- Just (VariableRate rmax rtime rmaxmax rminmax) -> undefined
Nothing -> w
where
cid = _crID cr
setUseTime = cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . rateTime
setUseRate = cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . rateTime
+~ userate
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax
+1 -1
View File
@@ -21,7 +21,7 @@ updateTargeting tu = case tu of
Nothing -> clearTargeting
Just TARGETLASER -> targetLaserUpdate'
Just TargetRBPress -> upCT (flip targetRBPressUpdate . _crTargeting)
Just TargetRBLine -> upCT (flip targetRBPressUpdate . _crTargeting)
Just TargetRBLine -> upCT (flip targetRBPressUpdate . _crTargeting)
Just TargetRBCreature -> upCT targetRBCreatureUp
Just TargetCursor -> upCT (flip targetCursorUpdate . _crTargeting)
+401 -411
View File
File diff suppressed because it is too large Load Diff