Allow for pump attachment to flamethrower

This commit is contained in:
2026-03-17 15:16:24 +00:00
parent 902d8e0c00
commit 4cacb45252
18 changed files with 384 additions and 323 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ itemTriggerType loc
baseItemTriggerType :: Item -> TriggerType
baseItemTriggerType itm = case itm ^. itType of
HELD hit -> heldTriggerType hit
ATTACH CAPACITOR -> AutoTrigger 10
ATTACH CAPACITOR -> AutoTrigger 0
-- ATTACH CAPACITOR -> AutoTrigger 10
_ -> NoTrigger
heldTriggerType :: HeldItemType -> TriggerType
+1
View File
@@ -114,6 +114,7 @@ inventoryX c = case c of
[introScan t | t <- [minBound..maxBound]] <>
[ flameThrower
, chemFuelPouch
, makeTypeCraft PUMP
, fuelPack
, copier ABSOLUTE
, nulgate
+1
View File
@@ -53,6 +53,7 @@ useItemLoc cr loc pt w
| LaserWeaponSF <- sf = True
| HeldPlatformSF <- sf = True
| PulseBallSF <- sf = True
| PlasmaSF <- sf = True
| UnderBarrelPlatformSF <- sf = True
| otherwise = False
sf = loc ^. locDT . dtValue . _2
+2
View File
@@ -42,7 +42,9 @@ data ItemSF -- Structural Function
| CapacitorSF
| TransformerSF
| PulseBallSF
| PlasmaSF
| TorchSF
| PumpSF
deriving (Eq, Ord, Show, Read)
type CItem = (Item, ItemSF)
+1
View File
@@ -100,6 +100,7 @@ data AttachType
| HOMINGMODULE
| SHELLPAYLOAD {_shellPayload :: Payload}
| CAPACITOR
| COMPRESSOR
deriving (Eq, Ord, Show, Read)
data AmmoMagType
+1
View File
@@ -40,6 +40,7 @@ data MuzzleEffect
| MuzzleLaser
| MuzzlePulseLaser
| MuzzlePulseBall
| MuzzlePlasmaBall
| MuzzleTesla
| MuzzleTractor
| MuzzleRLauncher
+1 -2
View File
@@ -4,7 +4,6 @@ module Dodge.Debug (debugEvents, drawDebug) where
import Geometry.Data
import Dodge.Render.Label
import Dodge.Data.DoubleTree
import Dodge.HeldUse
import Dodge.DoubleTree
import Dodge.Item.Grammar
@@ -260,7 +259,7 @@ showMuzzlePositions u = fold $ do
^? ix invid . _2
return . color red $ setLayer DebugLayer $ reduceLocDT (f cr) loc
where
f cr loc = foldMap (g . muzzlePos loc cr) (itemMuzzles $ loc ^. locDT . dtValue . _1)
f cr loc = foldMap (g . muzzlePos loc cr) (itemMuzzles $ loc)
where
g :: Point3Q -> Picture
g pq = translate3 (pq ^. _1) $ crossPic 5
+34 -7
View File
@@ -50,6 +50,7 @@ gadgetEffect :: Int -> LocationDT OItem -> Creature -> World -> World
gadgetEffect pt loc
| UseHeld{} <- loc ^. locDT . dtValue . _1 . itUse = heldEffect pt loc
| PulseBallSF <- loc ^. locDT . dtValue . _2 = heldEffect pt loc
| PlasmaSF <- loc ^. locDT . dtValue . _2 = heldEffect pt loc
| DROPPER x <- loc ^. locDT . dtValue . _1 . itType
, Just i <- loc ^? locDT . dtValue . _1 . itUse . uInt
, pt == 0 =
@@ -153,17 +154,24 @@ locMuzzles loc
& ix 0 . mzFlareType .~ TeslaGunFlare
& ix 0 . mzEffect .~ MuzzlePulseLaser
& ix 0 . mzAmmoSlot .~ CapacitorBelow (UseExactly 200)
| PlasmaSF <- loc ^. locDT . dtValue . _2 =
dbwMuzzles
& ix 0 . mzEffect .~ MuzzlePlasmaBall
& ix 0 . mzAmmoSlot .~ CapacitorSelf (UseExactly 1)
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ TeslaGunFlare
| PulseBallSF <- loc ^. locDT . dtValue . _2 =
dbwMuzzles
& ix 0 . mzEffect .~ MuzzlePulseBall
& ix 0 . mzAmmoSlot .~ CapacitorSelf (UseExactly 200)
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ TeslaGunFlare
| otherwise = itemMuzzles $ loc ^. locDT . dtValue . _1
-- | otherwise = itemMuzzles $ loc ^. locDT . dtValue . _1
| otherwise = itemMuzzles $ loc
itemMuzzles :: Item -> [Muzzle]
itemMuzzles itm = case itm ^. itType of
HELD hit -> heldItemMuzzles itm hit
itemMuzzles :: LocationDT OItem -> [Muzzle]
itemMuzzles loc = case itm ^. itType of
HELD hit -> heldItemMuzzles loc hit
DETECTOR{} ->
dbwMuzzles & ix 0 . mzEffect .~ MuzzleDetector
& ix 0 . mzAmmoSlot . aps .~ UseExactly 100
@@ -174,9 +182,11 @@ itemMuzzles itm = case itm ^. itType of
& ix 0 . mzFlareType .~ LasGunFlare
& ix 0 . mzEffect .~ MuzzleLaser
_ -> []
where
itm = loc ^. locDT . dtValue . _1
heldItemMuzzles :: Item -> HeldItemType -> [Muzzle]
heldItemMuzzles itm = \case
heldItemMuzzles :: LocationDT OItem -> HeldItemType -> [Muzzle]
heldItemMuzzles loc = \case
ALTERIFLE ->
dbwMuzzles & ix 0 . mzPos .~ V2 25 0
& ix 0 . mzAmmoSlot .~ MagBelow (_alteRifleSwitch (_itParams itm)) (UseExactly 1)
@@ -246,6 +256,8 @@ heldItemMuzzles itm = \case
BLUNDERBUSS -> [Muzzle (V2 30 0) 0 0.5 magupto15 BasicFlare MuzzleShootBullet 12]
GRAPECANNON i -> [Muzzle (V2 30 0) 0 0.5 magupto15 BasicFlare MuzzleShootBullet (12 + 4 * fromIntegral i)]
LED -> dbwMuzzles & ix 0 . mzPos .~ V2 10 0
FLAMETHROWER | Just PumpSF <- loc ^? locDT. dtRight . ix 0 . dtValue ._2
-> flameMuzzles & ix 0 . mzEffect . nzPressure .~ UniRandFloat 2 8
FLAMETHROWER -> flameMuzzles
FLAMESPITTER -> flameMuzzles & ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
RLAUNCHER ->
@@ -318,6 +330,7 @@ heldItemMuzzles itm = \case
where
maguse1 = MagBelow 0 (UseExactly 1)
magupto15 = MagBelow 0 (UseUpTo 15)
itm = loc ^. locDT . dtValue . _1
baseStickSpread :: Float
baseStickSpread = 0.2
@@ -334,7 +347,8 @@ flameMuzzles =
(MagBelow 0 (UseExactly 1))
NoFlare
MuzzleNozzle
{ _nzPressure = ConstFloat 4
--{ _nzPressure = ConstFloat 4
{ _nzPressure = UniRandFloat 3.5 4
, _nzMaxWalkAngle = 0.2
, _nzWalkSpeed = 0.01
}
@@ -728,6 +742,7 @@ useLoadedAmmo loc cr mz m w =
MuzzleLaser -> creatureShootLaser pq' loc (w & randGen .~ g)
MuzzlePulseLaser -> creatureShootPulseLaser pq' cr (w & randGen .~ g)
MuzzlePulseBall -> shootPulseBall pq' (w & randGen .~ g)
MuzzlePlasmaBall -> shootPlasmaBall pq' (w & randGen .~ g)
MuzzleTesla -> shootTeslaArc pq' loc (w & randGen .~ g)
MuzzleTractor -> shootTractorBeam cr w
MuzzleRLauncher -> createProjectileR pq loc magtree cr w
@@ -888,6 +903,18 @@ shootPulseLaser so p dir w =
}
& soundStart so p lasPulseS Nothing
shootPlasmaBall :: Point3Q -> World -> World
shootPlasmaBall (p, q) w =
w
& cWorld . lWorld . plasmaBalls .:~
PBall
{ _pbPos = p ^. _xy
, _pbVel = 6 * unitVectorAtAngle (Q.qToAng q)
, _pbType = DefaultPlasma
}
-- & soundStart (PBSound i) (p ^. _xy) energyReleaseS Nothing
shootPulseBall :: Point3Q -> World -> World
shootPulseBall (p, q) w =
w
+1
View File
@@ -62,6 +62,7 @@ itemFromAttachType = \case
HOMINGMODULE -> homingModule
SHELLPAYLOAD p -> shellModule p
CAPACITOR -> capacitor
COMPRESSOR -> compressor
itemFromEquipType :: EquipItemType -> Item
itemFromEquipType et = case et of
+8
View File
@@ -11,6 +11,7 @@ module Dodge.Item.Ammo (
megaTinMag,
megaBattery,
capacitor,
compressor,
) where
import Control.Lens
@@ -70,6 +71,13 @@ capacitor =
& itUse .~ UseNothing
& itConsumables ?~ 0
compressor :: Item
compressor =
defHeldItem
& itType .~ ATTACH COMPRESSOR
& itUse .~ UseNothing
& itConsumables ?~ 0
chemFuelPouch :: Item
chemFuelPouch =
defHeldItem
+1
View File
@@ -103,6 +103,7 @@ showAttachItem = \case
GIMBAL -> "GIMBAL"
GYROSCOPE -> "GYROSCOPE"
CAPACITOR -> "CAPACITOR"
COMPRESSOR -> "COMPRESSOR"
showEquipItem :: EquipItemType -> String
showEquipItem eit = case eit of
+8 -4
View File
@@ -36,16 +36,19 @@ tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
itemAboveAttachables :: CItem -> [ItemSF]
itemAboveAttachables (itm,sf) = case (itm ^. itType, sf) of
(_, HeldPlatformSF) ->
[WeaponTargetingSF, WeaponScopeSF,TorchSF]
<> getAutoSpringLinks itm
<> extraWeaponLinks itm
(HELD FLAMETHROWER,_) -> PumpSF:helddefaults
(_, HeldPlatformSF) -> helddefaults
(DETECTOR {}, _) -> [ARHUDSF,TriggerSF,MapperSF]
--(CRAFT TRANSFORMER, _) -> [LaserWeaponSF]
(LASER, _) -> [TransformerSF]
(MAPPER, _) -> [ARHUDSF]
(_, GadgetPlatformSF) -> [TriggerSF, WeaponTargetingSF, WeaponScopeSF]
_ -> []
where
helddefaults =
[WeaponTargetingSF, WeaponScopeSF,TorchSF]
<> getAutoSpringLinks itm
<> extraWeaponLinks itm
itemBelowAttachables :: CItem -> [ItemSF]
itemBelowAttachables (itm,sf) = case (itm ^. itType, sf) of
@@ -138,6 +141,7 @@ itemToFunction itm = case itm ^. itType of
CLICKER{} -> GadgetPlatformSF
ATTACH CAPACITOR -> CapacitorSF
CRAFT TRANSFORMER -> TransformerSF
CRAFT PUMP -> PumpSF
_ -> NoSF
treeToPotentialFunction :: DTree CItem -> S.Set ItemSF
+2
View File
@@ -42,7 +42,9 @@ sfInvColor = \case
PulseLaserSF -> white
CapacitorSF -> yellow
PulseBallSF -> white
PlasmaSF -> white
TransformerSF -> yellow
PumpSF -> yellow
TorchSF{} -> green
--ammoTypeColor :: AmmoType -> Color
+3 -2
View File
@@ -30,8 +30,9 @@ damMatSideEffect dm = \case
defDamageMaterial :: Damage -> ECW -> World -> (Int,World)
defDamageMaterial dm _ = (dm ^. dmAmount,)
laserSpark x y -- = makeSpark FireSpark x y
= id
laserSpark :: Point2 -> Float -> World -> World
--laserSpark x y = makeSpark FireSpark x y
laserSpark = makeSpark FireSpark
damageStone :: Damage -> ECW -> World -> (Int,World)
damageStone dm ecw w = case dm of
+5 -1
View File
@@ -13,8 +13,10 @@ module Dodge.Room.LasTurret (
lasCenRunClose',
lasCenRunClose1,
lasCenRunCloseLongCor,
lasRunRand,
) where
import Control.Monad
import Data.Foldable (fold)
import Dodge.Room.Path
import Dodge.Room.Procedural
@@ -314,7 +316,6 @@ lasCenRunCloseLongCor = do
llinks = memtest (FromEdge South 1) (OnEdge West)
rlinks = memtest (FromEdge South 1) (OnEdge East)
awall x v = heightWallPS (PS x 0) 30 v
etest f g x = f x || g x
memtest a b x = let y = _rlType x
in a `S.member` y && b `S.member` y
@@ -370,6 +371,9 @@ lasCenRunClose1 = do
memtest a b x = let y = _rlType x
in a `S.member` y && b `S.member` y
lasRunRand :: (RandomGen g) => State g (MetaTree Room String)
lasRunRand = join $ takeOne [lasCenRunClose2,lasCenRunClose1]
lasCenRunClose2 :: (RandomGen g) => State g (MetaTree Room String)
lasCenRunClose2 = do
(alinks,blinks) <- shufflePair (bllinks,trlinks)
+1 -1
View File
@@ -55,7 +55,7 @@ tutAnoTree = do
-- , return . tToBTree "door" $ treePost [corridor, cleatOnward door]
, corDoor
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, lasRunYinYang
, lasRunRand
-- , passthroughLockKeyLists lockRoomKeyItems itemRooms
, tToBTree "door" . return <$> return (cleatOnward door)
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
+1 -2
View File
@@ -6,7 +6,6 @@ module Dodge.Update (updateUniverse) where
import Data.Function (on)
import Dodge.Zoning.Wall
import Bound
import Dodge.Data.DoubleTree
import Dodge.HeldUse
import Dodge.DoubleTree
import Dodge.Item.Grammar
@@ -337,7 +336,7 @@ muzzleWallCheck w cr = fromMaybe cr $ do
else let v = minimumBy (compare `on` norm) vs
in cr & crPos . _xy +~ normalize v
where
f loc = map (muzzlePos loc cr) (itemMuzzles $ loc ^. locDT . dtValue . _1)
f loc = map (muzzlePos loc cr) (itemMuzzles $ loc)
g cp wls p = case collidePoint cp p wls of
(ep,Just _) -> Just (ep - p)
_ -> Nothing