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