Work on press-continue terminal prompts
This commit is contained in:
+41
-34
@@ -7,10 +7,6 @@ Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.SpawnAt
|
||||
import Dodge.Prop.Moving
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Data.Object
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -27,6 +23,7 @@ import Dodge.Creature.Radius
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Damage
|
||||
import Dodge.Data.CrWlID
|
||||
import Dodge.Data.Object
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Debug
|
||||
import Dodge.DisplayInventory
|
||||
@@ -44,6 +41,7 @@ import Dodge.Machine.Update
|
||||
import Dodge.ModificationEffect
|
||||
import Dodge.PressPlate
|
||||
import Dodge.Projectile.Update
|
||||
import Dodge.Prop.Moving
|
||||
import Dodge.Prop.Update
|
||||
import Dodge.RadarBlip
|
||||
import Dodge.RadarSweep
|
||||
@@ -54,6 +52,7 @@ import Dodge.Shockwave.Update
|
||||
import Dodge.SmoothScroll
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Spark
|
||||
import Dodge.SpawnAt
|
||||
import Dodge.Terminal.Type
|
||||
import Dodge.TractorBeam.Update
|
||||
import Dodge.Update.Camera
|
||||
@@ -64,6 +63,7 @@ import Dodge.Update.Scroll
|
||||
import Dodge.Update.WallDamage
|
||||
import Dodge.WallCreatureCollisions
|
||||
import Dodge.WorldEffect
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.WorldEvent.ThingsHit
|
||||
import Dodge.Zoning.Cloud
|
||||
import Dodge.Zoning.Creature
|
||||
@@ -467,27 +467,27 @@ updatePulseLasers w = f w & cWorld . lWorld . pulseLasers .~ pzs
|
||||
updatePulseBall :: PulseBall -> World -> World
|
||||
updatePulseBall pb w
|
||||
| Just (_, ecrwl) <- thit =
|
||||
w & cWorld . lWorld . pulseBalls . at (pb ^. pbID) .~ Nothing
|
||||
w & cWorld . lWorld . pulseBalls . at (pb ^. pbID) .~ Nothing
|
||||
& cWorld . lWorld %~ dodam ecrwl
|
||||
| pb ^. pbTimer <= 0 =
|
||||
w & cWorld . lWorld . pulseBalls . at (pb ^. pbID) .~ Nothing
|
||||
w & cWorld . lWorld . pulseBalls . at (pb ^. pbID) .~ Nothing
|
||||
| otherwise =
|
||||
w & cWorld . lWorld . pulseBalls . ix (pb ^. pbID) . pbTimer -~ 1
|
||||
w & cWorld . lWorld . pulseBalls . ix (pb ^. pbID) . pbTimer -~ 1
|
||||
& cWorld . lWorld . pulseBalls . ix (pb ^. pbID) . pbPos .~ ep
|
||||
& pbFlicker pb
|
||||
where
|
||||
dodam = \case
|
||||
Left cr -> creatures . ix (_crID cr) . crDamage .:~ thedam
|
||||
Right wl -> wallDamages . at (_wlID wl) . non mempty .:~ thedam
|
||||
thedam = Lasering 100 ep (pb ^. pbVel)
|
||||
thedam = Lasering 100 ep (pb ^. pbVel)
|
||||
sp = pb ^. pbPos
|
||||
ep = sp + pb ^. pbVel
|
||||
thit = thingHit sp ep w
|
||||
|
||||
pbFlicker :: PulseBall -> World -> World
|
||||
pbFlicker pt =
|
||||
cWorld . lWorld . lights
|
||||
.:~ LSParam (addZ 5 $ _pbPos pt) d (0.5 * xyzV4 chartreuse)
|
||||
cWorld . lWorld . lights
|
||||
.:~ LSParam (addZ 5 $ _pbPos pt) d (0.5 * xyzV4 chartreuse)
|
||||
where
|
||||
d = 4 * fromIntegral (10 + abs ((_pbTimer pt `mod` 20) - 10))
|
||||
|
||||
@@ -501,20 +501,23 @@ displayTerminalLineString :: TerminalLineString -> (String, Color)
|
||||
displayTerminalLineString (TerminalLineConst str col) = (str, col)
|
||||
|
||||
tmUpdate :: Terminal -> World -> World
|
||||
tmUpdate tm w = case w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines . ix 0 of
|
||||
Nothing -> w
|
||||
Just tl | _tlPause tl > 0 -> w & pointTermParams . tmFutureLines . ix 0 . tlPause -~ 1
|
||||
Just (TLine _ tls g) ->
|
||||
w & pointTermParams
|
||||
%~ ( (tmFutureLines %~ tail)
|
||||
. (tmDisplayedLines %~ (map displayTerminalLineString tls ++))
|
||||
)
|
||||
& doTmWdWd g tm
|
||||
-- Just (TerminalLineEffect _ eff) ->
|
||||
-- w
|
||||
-- & pointTermParams . tmFutureLines %~ tail
|
||||
-- & doTmWdWd eff tm
|
||||
tmUpdate tm w = fromMaybe w $ do
|
||||
guard $ tm ^. tmStatus == TerminalLineRead
|
||||
tl <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines . ix 0
|
||||
return $ case tl of
|
||||
_ | _tlPause tl > 0 -> w & pointTermParams . tmFutureLines . ix 0 . tlPause -~ 1
|
||||
(TLine _ tls g) ->
|
||||
w & pointTermParams
|
||||
%~ ( (tmFutureLines %~ tail)
|
||||
. (tmDisplayedLines %~ (map displayTerminalLineString tls ++))
|
||||
)
|
||||
& doTmWdWd g tm
|
||||
where
|
||||
-- Just (TerminalLineEffect _ eff) ->
|
||||
-- w
|
||||
-- & pointTermParams . tmFutureLines %~ tail
|
||||
-- & doTmWdWd eff tm
|
||||
|
||||
pointTermParams = cWorld . lWorld . terminals . ix (_tmID tm)
|
||||
|
||||
setOldPos :: Creature -> Creature
|
||||
@@ -641,22 +644,24 @@ updatePulseLaser pz = case pz ^. pzTimer of
|
||||
5 -> (Endo f, [pz & pzTimer -~ 1])
|
||||
_ -> (Endo g, [pz & pzTimer -~ 1])
|
||||
where
|
||||
f w = dodam thHit
|
||||
f w =
|
||||
dodam
|
||||
thHit
|
||||
w
|
||||
& cWorld . lWorld . flares <>~ drawLaser cyan (sp : ps)
|
||||
where
|
||||
(thHit, ps) = reflectPulseLaserAlong phasev sp xp w
|
||||
dodam thit = case thit of
|
||||
((p, OCreature cr):_) ->
|
||||
cWorld . lWorld . creatures . ix (_crID cr) . crDamage
|
||||
((p, OCreature cr) : _) ->
|
||||
cWorld . lWorld . creatures . ix (_crID cr) . crDamage
|
||||
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
|
||||
((p, OWall wl):_) ->
|
||||
((p, OWall wl) : _) ->
|
||||
cWorld . lWorld . wallDamages . at (_wlID wl) . non mempty
|
||||
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
|
||||
((_, OPulseBall pb):xs) -> dodam xs
|
||||
.
|
||||
(cWorld . lWorld . pulseBalls . ix (_pbID pb) . pbTimer .~ 0)
|
||||
. makeExplosionAt (_pbPos pb `v2z` 20) 0
|
||||
((_, OPulseBall pb) : xs) ->
|
||||
dodam xs
|
||||
. (cWorld . lWorld . pulseBalls . ix (_pbID pb) . pbTimer .~ 0)
|
||||
. makeExplosionAt (_pbPos pb `v2z` 20) 0
|
||||
_ -> id
|
||||
phasev = _pzPhaseV pz
|
||||
sp = _pzPos pz
|
||||
@@ -796,9 +801,11 @@ ppEvents w = IM.foldl' (flip $ \pp -> doPressPlateEvent (_ppEvent pp) pp) w $ w
|
||||
|
||||
checkEndGame :: Universe -> Universe
|
||||
checkEndGame uv = case w ^? timeFlow . respawnDelay of
|
||||
Just x | x < 0 -> uv -- & uvScreenLayers .~ [gameOverMenu uv]
|
||||
& uvWorld . timeFlow .~ NormalTimeFlow
|
||||
& uvWorld %~ respawn
|
||||
Just x
|
||||
| x < 0 ->
|
||||
uv -- & uvScreenLayers .~ [gameOverMenu uv]
|
||||
& uvWorld . timeFlow .~ NormalTimeFlow
|
||||
& uvWorld %~ respawn
|
||||
Just _ -> uv & uvWorld . timeFlow . respawnDelay -~ 1
|
||||
_ | _crHP (you w) < 1 -> uv & uvWorld . timeFlow .~ RespawnDelay 50
|
||||
_ -> uv
|
||||
|
||||
Reference in New Issue
Block a user