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 $ LAUNCHERX i] (launcherX (i+1)) | i <- [2..9]]
++
[ po [LIGHTER,PUMP,CAN] flameStick
, po [FLAMESTICK,CAN,PUMP] blowTorch
, po [FLAMESTICK,DRUM] flameThrower
[ po [LIGHTER,PUMP,CAN] flameSpitter
, po [FLAMESPITTER,CAN,PUMP] blowTorch
, po [FLAMESPITTER,DRUM] flameThrower
, po [FLAMETHROWER,DRUM] flameWall
, po [FLAMETHROWER,PUMP] flameTorrent
+1 -1
View File
@@ -38,7 +38,7 @@ data CombineType
| AUTOAMR
| SNIPERRIFLE
| MACHINEGUN
| FLAMESTICK
| FLAMESPITTER
| FLAMETHROWER
| FLAMETORRENT
| FLAMEWALL
+7 -7
View File
@@ -169,18 +169,18 @@ testInventory = IM.fromList $ zip [0..]
[ makeTypeCraftNum 9 PIPE
, incendiaryModule
, bounceModule
, medkit 50
, teleportModule
-- , medkit 50
-- , teleportModule
, makeTypeCraftNum 1 LIGHTER
, makeTypeCraftNum 5 TUBE
, makeTypeCraftNum 15 TUBE
-- , makeTypeCraftNum 5 CREATURESENSOR
, makeTypeCraftNum 3 PRISM
-- , makeTypeCraftNum 3 DRUM
-- , makeTypeCraftNum 3 PUMP
, makeTypeCraftNum 3 PUMP
-- , makeTypeCraftNum 1 MAGNET
, makeTypeCraftNum 1 TRANSMITTER
, makeTypeCraftNum 5 HARDWARE
, makeTypeCraftNum 3 SPRING
, makeTypeCraftNum 1 HARDWARE
-- , makeTypeCraftNum 3 SPRING
, makeTypeCraftNum 10 CAN
, makeTypeCraftNum 3 TIN
, makeTypeCraftNum 3 PLANK
@@ -191,7 +191,7 @@ testInventory = IM.fromList $ zip [0..]
stackedInventory :: IM.IntMap Item
stackedInventory = IM.fromList $ zip [0..]
[sonicGun
,spreadGun
,burstRifle
, pipe
,rewindGun
,tractorGun
+21 -5
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Weapon.SprayGuns
( poisonSprayer
, flameStick
, flameSpitter
, blowTorch
, flameThrower
, flameTorrent
@@ -33,6 +33,7 @@ import LensHelp
import Data.Traversable
import qualified Data.IntMap.Strict as IM
import Control.Monad.State
--import Data.Function
import System.Random
poisonSprayer :: Item
@@ -64,14 +65,29 @@ flamerPic it =
tz = 3
r = 5
am = fractionLoadedAmmo2 it
flameStick :: Item
flameStick = flameThrower
& itName .~ "FLAMESTICK"
& itType .~ FLAMESTICK
flameSpitter :: Item
flameSpitter = flameThrower
& itName .~ "FLAMESPITTER"
& itType .~ FLAMESPITTER
& itConsumption . ammoBaseMax .~ 10
& itConsumption . reloadTime .~ 20
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& 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 = flameThrower
+5
View File
@@ -249,6 +249,11 @@ ps0jPushPS :: PSType -> Placement -> Placement
ps0jPushPS pst plmnt = Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing
$ \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 pl pl2 = case pl2 of
(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 =
--[(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] )
--,(sensorRoomRunPast Electrical, return SPARKGUN )
[(sensorRoomRunPast Flaming, return FLAMESTICK )
-- ,(sensorRoomRunPast Lasering, return LASGUN )
-- ,(const slowDoorRoomRunPast, return MINIGUN)
-- ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD])
-- ,(const glassLessonRunPast, takeOne [LASGUN])
-- ,(const $ lasTunnelRunPast 400, return FLATSHIELD)
[(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] )
,(sensorRoomRunPast Electrical, return SPARKGUN )
,(sensorRoomRunPast Flaming, return FLAMESPITTER )
,(sensorRoomRunPast Lasering, return LASGUN )
,(const slowDoorRoomRunPast, return MINIGUN)
,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD])
,(const glassLessonRunPast, takeOne [LASGUN])
,(const $ lasTunnelRunPast 400, return FLATSHIELD)
]
itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))]
@@ -40,7 +40,7 @@ itemRooms =
[rc $ map makeTypeCraft [TRANSFORMER,CAN,CAN]
]
)
, (FLAMESTICK , join $ takeOne
, (FLAMESPITTER , join $ takeOne
[rc $ map makeTypeCraft [LIGHTER,PUMP,CAN]
]
)
+13 -4
View File
@@ -1,8 +1,12 @@
{-# LANGUAGE TupleSections #-}
module Dodge.Placement.Instance.Terminal where
module Dodge.Placement.Instance.Terminal
( putTerminal
) where
import Dodge.Data
import Dodge.LevelGen.Data
import Dodge.Default
import Dodge.Machine
import Dodge.WorldEvent.Explosion
import Color
import Geometry
import ShapePicture
@@ -12,10 +16,12 @@ import Shape
import Data.Maybe
putTerminal :: (GenParams -> TerminalParams) -> Placement
putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton)
$ pt0 (PutMachine (dark magenta) (reverse $ square 10) defaultMachine
putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton $ thebutton)
$ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine
{ _mcDraw = drawTerminal
, _mcHP = 100
, _mcUpdate = machineUpdateDeathEff $ \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing)
. makeExplosionAt (_mcPos mc)
})
$ const Nothing
where
@@ -31,8 +37,11 @@ putTerminal f = PlacementGenUpdate g $ ps0jPushPS (PutButton $ thebutton)
, _btTerminalParams = TerminalParams [] [] 10
}
terminalColor :: Color
terminalColor = dark magenta
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 btid w = w & hud . hudElement .~ DisplayInventory DisplayTerminal
+16 -13
View File
@@ -20,13 +20,12 @@ import Dodge.WorldEvent.Shockwave
import Geometry
--import Geometry.Vector3D
import Picture
import LensHelp
import Control.Monad.State
import Data.List
--import Data.Maybe
import System.Random
--import qualified Data.IntMap.Strict as IM
import Control.Lens
makePoisonExplosionAt
:: Point2 -- ^ Position
@@ -71,24 +70,28 @@ makeFlameExplosionAt p w
-- particle passes through for the first frame of its existence
makeExplosionAt :: Point2 -> World -> World
makeExplosionAt p w
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
. addFlames
-- . explosionFlashAt p
. over tempLightSources (theTLS :)
$ makeShockwaveAt [] p 50 50 1 white w
makeExplosionAt p w = w
& soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
& addFlames
& tempLightSources .:~ theTLS
& makeShockwaveAt [] p 50 50 1 white
where
theTLS = tlsTimeRadColPos 20 150 (V3 1 0.5 0) (addZ 20 p)
fVs = replicateM 15 (randInCirc 1) & evalState $ _randGen w
fPs'' = replicateM 15 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
fVs = replicateM 100 (randInCirc 1) & 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''
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
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
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
newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times
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 pt
| _ptTimer pt `mod` 5 == 0 = tempLightSources
.:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (V3 x y 10)
| _ptTimer pt `mod` 7 == 0 = tempLightSources
.:~ tlsTimeRadColPos 1 70 (V3 0.5 0 0) (addZ 10 $ _ptPos pt)
| 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)
| otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of
((_,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)
where
time = _ptTimer pt