Improve low level flamer

This commit is contained in:
2022-03-15 08:54:23 +00:00
parent 4c116a82c9
commit b71579441e
10 changed files with 78 additions and 47 deletions
+3 -3
View File
@@ -59,9 +59,9 @@ itemCombinations =
, p [p 2 TUBE,o LAUNCHER] (launcherX 2) , p [p 2 TUBE,o LAUNCHER] (launcherX 2)
] ++ [ p [p 2 TUBE,o $ LAUNCHERX i] (launcherX (i+1)) | i <- [2..9]] ] ++ [ p [p 2 TUBE,o $ LAUNCHERX i] (launcherX (i+1)) | i <- [2..9]]
++ ++
[ po [LIGHTER,PUMP,CAN] flameStick [ po [LIGHTER,PUMP,CAN] flameSpitter
, po [FLAMESTICK,CAN,PUMP] blowTorch , po [FLAMESPITTER,CAN,PUMP] blowTorch
, po [FLAMESTICK,DRUM] flameThrower , po [FLAMESPITTER,DRUM] flameThrower
, po [FLAMETHROWER,DRUM] flameWall , po [FLAMETHROWER,DRUM] flameWall
, po [FLAMETHROWER,PUMP] flameTorrent , po [FLAMETHROWER,PUMP] flameTorrent
+1 -1
View File
@@ -38,7 +38,7 @@ data CombineType
| AUTOAMR | AUTOAMR
| SNIPERRIFLE | SNIPERRIFLE
| MACHINEGUN | MACHINEGUN
| FLAMESTICK | FLAMESPITTER
| FLAMETHROWER | FLAMETHROWER
| FLAMETORRENT | FLAMETORRENT
| FLAMEWALL | FLAMEWALL
+7 -7
View File
@@ -169,18 +169,18 @@ testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE [ makeTypeCraftNum 9 PIPE
, incendiaryModule , incendiaryModule
, bounceModule , bounceModule
, medkit 50 -- , medkit 50
, teleportModule -- , teleportModule
, makeTypeCraftNum 1 LIGHTER , makeTypeCraftNum 1 LIGHTER
, makeTypeCraftNum 5 TUBE , makeTypeCraftNum 15 TUBE
-- , makeTypeCraftNum 5 CREATURESENSOR -- , makeTypeCraftNum 5 CREATURESENSOR
, makeTypeCraftNum 3 PRISM , makeTypeCraftNum 3 PRISM
-- , makeTypeCraftNum 3 DRUM -- , makeTypeCraftNum 3 DRUM
-- , makeTypeCraftNum 3 PUMP , makeTypeCraftNum 3 PUMP
-- , makeTypeCraftNum 1 MAGNET -- , makeTypeCraftNum 1 MAGNET
, makeTypeCraftNum 1 TRANSMITTER , makeTypeCraftNum 1 TRANSMITTER
, makeTypeCraftNum 5 HARDWARE , makeTypeCraftNum 1 HARDWARE
, makeTypeCraftNum 3 SPRING -- , makeTypeCraftNum 3 SPRING
, makeTypeCraftNum 10 CAN , makeTypeCraftNum 10 CAN
, makeTypeCraftNum 3 TIN , makeTypeCraftNum 3 TIN
, makeTypeCraftNum 3 PLANK , makeTypeCraftNum 3 PLANK
@@ -191,7 +191,7 @@ testInventory = IM.fromList $ zip [0..]
stackedInventory :: IM.IntMap Item stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..] stackedInventory = IM.fromList $ zip [0..]
[sonicGun [sonicGun
,spreadGun ,burstRifle
, pipe , pipe
,rewindGun ,rewindGun
,tractorGun ,tractorGun
+21 -5
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Weapon.SprayGuns module Dodge.Item.Weapon.SprayGuns
( poisonSprayer ( poisonSprayer
, flameStick , flameSpitter
, blowTorch , blowTorch
, flameThrower , flameThrower
, flameTorrent , flameTorrent
@@ -33,6 +33,7 @@ import LensHelp
import Data.Traversable import Data.Traversable
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
import Control.Monad.State
--import Data.Function --import Data.Function
import System.Random import System.Random
poisonSprayer :: Item poisonSprayer :: Item
@@ -64,14 +65,29 @@ flamerPic it =
tz = 3 tz = 3
r = 5 r = 5
am = fractionLoadedAmmo2 it am = fractionLoadedAmmo2 it
flameStick :: Item flameSpitter :: Item
flameStick = flameThrower flameSpitter = flameThrower
& itName .~ "FLAMESTICK" & itName .~ "FLAMESPITTER"
& itType .~ FLAMESTICK & itType .~ FLAMESPITTER
& itConsumption . ammoBaseMax .~ 10 & itConsumption . ammoBaseMax .~ 10
& itConsumption . reloadTime .~ 20 & itConsumption . reloadTime .~ 20
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4 & itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . useAim . aimStance .~ OneHand & itUse . useAim . aimStance .~ OneHand
& itUse . useDelay .~ FixedRate {_rateMax =12,_rateTime = 0}
& itUse . useMods .~
[ ammoCheckI
, useTimeCheck
, lockInvFor 10
, repeatOnFrames [1..9]
, withRandomItemParams f
, useAmmoAmount 1
, withSidePushI 5
, withSidePushAfterI 20
]
where
f = do
nzpres <- state $ randomR (3,4)
return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
flameTorrent :: Item flameTorrent :: Item
flameTorrent = flameThrower flameTorrent = flameThrower
+5
View File
@@ -249,6 +249,11 @@ ps0jPushPS :: PSType -> Placement -> Placement
ps0jPushPS pst plmnt = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing ps0jPushPS pst plmnt = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing
$ \p -> Just $ plmnt & plSpot .~ _plSpot p $ \p -> Just $ plmnt & plSpot .~ _plSpot p
-- the NoShiftCont is necessary when shifting then combining rooms
ps0PushPS :: PSType -> (Placement -> Maybe Placement) -> Placement
ps0PushPS pst f = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing
$ \pl -> f pl & _Just . plSpot %~ const (_plSpot pl)
addPlmnt :: Placement -> Placement -> Placement addPlmnt :: Placement -> Placement -> Placement
addPlmnt pl pl2 = case pl2 of addPlmnt pl pl2 = case pl2 of
(PlacementUsingPos p f) -> PlacementUsingPos p (fmap (addPlmnt pl) f) (PlacementUsingPos p f) -> PlacementUsingPos p (fmap (addPlmnt pl) f)
+9 -9
View File
@@ -14,14 +14,14 @@ import Control.Monad.State
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ] lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ]
lockRoomKeyItems = lockRoomKeyItems =
--[(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] ) [(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] )
--,(sensorRoomRunPast Electrical, return SPARKGUN ) ,(sensorRoomRunPast Electrical, return SPARKGUN )
[(sensorRoomRunPast Flaming, return FLAMESTICK ) ,(sensorRoomRunPast Flaming, return FLAMESPITTER )
-- ,(sensorRoomRunPast Lasering, return LASGUN ) ,(sensorRoomRunPast Lasering, return LASGUN )
-- ,(const slowDoorRoomRunPast, return MINIGUN) ,(const slowDoorRoomRunPast, return MINIGUN)
-- ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD]) ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD])
-- ,(const glassLessonRunPast, takeOne [LASGUN]) ,(const glassLessonRunPast, takeOne [LASGUN])
-- ,(const $ lasTunnelRunPast 400, return FLATSHIELD) ,(const $ lasTunnelRunPast 400, return FLATSHIELD)
] ]
itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))] itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))]
@@ -40,7 +40,7 @@ itemRooms =
[rc $ map makeTypeCraft [TRANSFORMER,CAN,CAN] [rc $ map makeTypeCraft [TRANSFORMER,CAN,CAN]
] ]
) )
, (FLAMESTICK , join $ takeOne , (FLAMESPITTER , join $ takeOne
[rc $ map makeTypeCraft [LIGHTER,PUMP,CAN] [rc $ map makeTypeCraft [LIGHTER,PUMP,CAN]
] ]
) )
+13 -4
View File
@@ -1,8 +1,12 @@
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
module Dodge.Placement.Instance.Terminal where module Dodge.Placement.Instance.Terminal
( putTerminal
) where
import Dodge.Data import Dodge.Data
import Dodge.LevelGen.Data import Dodge.LevelGen.Data
import Dodge.Default import Dodge.Default
import Dodge.Machine
import Dodge.WorldEvent.Explosion
import Color import Color
import Geometry import Geometry
import ShapePicture import ShapePicture
@@ -12,10 +16,12 @@ import Shape
import Data.Maybe import Data.Maybe
putTerminal :: (GenParams -> TerminalParams) -> Placement putTerminal :: (GenParams -> TerminalParams) -> Placement
putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton) putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton $ thebutton)
$ pt0 (PutMachine (dark magenta) (reverse $ square 10) defaultMachine $ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine
{ _mcDraw = drawTerminal { _mcDraw = drawTerminal
, _mcHP = 100 , _mcHP = 100
, _mcUpdate = machineUpdateDeathEff $ \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing)
. makeExplosionAt (_mcPos mc)
}) })
$ const Nothing $ const Nothing
where where
@@ -31,8 +37,11 @@ putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton)
, _btTerminalParams = TerminalParams [] [] 10 , _btTerminalParams = TerminalParams [] [] 10
} }
terminalColor :: Color
terminalColor = dark magenta
drawTerminal :: Machine -> SPic drawTerminal :: Machine -> SPic
drawTerminal _ = noPic $ colorSH (dark green) $ upperPrismPoly 15 $ square 10 drawTerminal _ = noPic $ colorSH terminalColor $ upperPrismPoly 15 $ square 10
displayTerminalMessage :: Int -> World -> World displayTerminalMessage :: Int -> World -> World
displayTerminalMessage btid w = w & hud . hudElement .~ DisplayInventory DisplayTerminal displayTerminalMessage btid w = w & hud . hudElement .~ DisplayInventory DisplayTerminal
+16 -13
View File
@@ -20,13 +20,12 @@ import Dodge.WorldEvent.Shockwave
import Geometry import Geometry
--import Geometry.Vector3D --import Geometry.Vector3D
import Picture import Picture
import LensHelp
import Control.Monad.State import Control.Monad.State
import Data.List import Data.List
--import Data.Maybe --import Data.Maybe
import System.Random import System.Random
--import qualified Data.IntMap.Strict as IM
import Control.Lens
makePoisonExplosionAt makePoisonExplosionAt
:: Point2 -- ^ Position :: Point2 -- ^ Position
@@ -71,24 +70,28 @@ makeFlameExplosionAt p w
-- particle passes through for the first frame of its existence -- particle passes through for the first frame of its existence
makeExplosionAt :: Point2 -> World -> World makeExplosionAt :: Point2 -> World -> World
makeExplosionAt p w makeExplosionAt p w = w
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing & soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
. addFlames & addFlames
-- . explosionFlashAt p & tempLightSources .:~ theTLS
. over tempLightSources (theTLS :) & makeShockwaveAt [] p 50 50 1 white
$ makeShockwaveAt [] p 50 50 1 white w
where where
theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p) theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p)
fVs = replicateM 15 (randInCirc 1) & evalState $ _randGen w fVs = replicateM 100 (randInCirc 1) & evalState $ _randGen w
fPs'' = replicateM 15 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w --fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
fPs'' = replicateM 100 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
(fPs',zs) = let (a,b,c) = unzip3 $ map fromV3 fPs'' (fPs',zs) = let (a,b,c) = unzip3 $ map fromV3 fPs''
in (zipWith V2 a b, c) in (zipWith V2 a b, c)
fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs' --fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs'
fPs = map (pushAgainstWalls . (+.+) p) fPs'
inversePushOut v = (15 - magV v) * 0.01 *.* v inversePushOut v = (15 - magV v) * 0.01 *.* v
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs' fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2,9) $ _randGen w sizes = randomRs (2,9) $ _randGen w
times = randomRs (20,25) $ _randGen w --times = randomRs (20,25) $ _randGen w
times = randomRs (15,20) $ _randGen w
mF q z v size time = makeFlamelet q z v Nothing size time mF q z v size time = makeFlamelet q z v Nothing size time
newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times
addFlames w' = foldr ($) w' newFs addFlames w' = foldr ($) w' newFs
pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q $ wallsNearPoint q w --pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q wls
pushAgainstWalls q = maybe q fst $ reflectPointWalls p q wls
wls = wallsNearPoint p w
+2 -4
View File
@@ -63,8 +63,6 @@ explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc
flameFlicker :: Particle -> World -> World flameFlicker :: Particle -> World -> World
flameFlicker pt flameFlicker pt
| _ptTimer pt `mod` 5 == 0 = tempLightSources | _ptTimer pt `mod` 7 == 0 = tempLightSources
.:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (V3 x y 10) .:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (addZ 10 $ _ptPos pt)
| otherwise = id | otherwise = id
where
V2 x y = _ptPos pt
+1 -1
View File
@@ -80,7 +80,7 @@ moveFlame rotd w pt
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing) | time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
| otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of | otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of
((_,Left _):_) -> (doSound $ damwls damcrs , mvPt 0.7) ((_,Left _):_) -> (doSound $ damwls damcrs , mvPt 0.7)
(th@(p,Right wl):_) -> (doSound . fst $ hiteff [th] damcrs , rfl wl p) ((p,Right wl):_) -> (doSound $ damwls damcrs , rfl wl p)
_ -> (flameFlicker pt . damwls $ doSound damcrs , mvPt 0.98) _ -> (flameFlicker pt . damwls $ doSound damcrs , mvPt 0.98)
where where
time = _ptTimer pt time = _ptTimer pt