Start to add respawn points, re-fix semi-auto triggers

This commit is contained in:
2025-08-11 00:00:32 +01:00
parent 38e8f91346
commit dd1f3b2ef5
10 changed files with 116 additions and 113 deletions
+2 -2
View File
@@ -15,13 +15,13 @@ import Dodge.Data.TriggerType
itemTriggerType :: LocationDT OItem -> TriggerType
itemTriggerType loc
| isPulseLaser loc = SemiAutoTrigger 9
| isPulseLaser loc = AutoTrigger 9
| otherwise = baseItemTriggerType $ loc ^. locDT . dtValue . _1
baseItemTriggerType :: Item -> TriggerType
baseItemTriggerType itm = case itm ^. itType of
HELD hit -> heldTriggerType hit
ATTACH CAPACITOR -> SemiAutoTrigger 10
ATTACH CAPACITOR -> AutoTrigger 10
_ -> NoTrigger
heldTriggerType :: HeldItemType -> TriggerType
+1
View File
@@ -151,6 +151,7 @@ data LWorld = LWorld
, _imHotkeys :: NewIntMap ItmInt Hotkey
, _lAimPos :: Point2
, _lInvLock :: Bool
, _respawnPos :: Point2
}
--data WorldBeams = WorldBeams
+2 -2
View File
@@ -56,8 +56,8 @@ data World = World
}
data TimeFlowStatus
= DeathTime
{_deathDelay :: Int}
= RespawnDelay
{_respawnDelay :: Int}
| NormalTimeFlow
| ItemScrollTimeFlow
{ _scrollSmoothing :: Int
+1
View File
@@ -156,6 +156,7 @@ defaultLWorld =
, _imHotkeys = mempty
, _lAimPos = 0
, _lInvLock = False
, _respawnPos = 0
}
defaultHUD :: HUD
+1 -2
View File
@@ -105,8 +105,7 @@ hammerCheck f pt loc cr w = case itemTriggerType loc of
HammerTrigger t | timetest t , pt == 0 -> f loc cr w
SemiAutoTrigger t
| timetest t
, isJust (find ((== MakeAutoSF) . (^. dtValue . _2)) (loc ^. locDT . dtRight))
|| pt == 0 ->
, pt < w ^. cWorld . lWorld . lClock - timelastused ->
f loc cr w
AutoTrigger t | timetest t -> f loc cr w
NoTrigger -> f loc cr w
+8 -8
View File
@@ -1,12 +1,11 @@
module Dodge.Initialisation where
module Dodge.Initialisation (initialWorld, splashScreen) where
import Control.Lens
import Dodge.Creature
import Dodge.Data.World
import Dodge.Default.World
import Dodge.SoundLogic
import Geometry.Data
import qualified IntMapHelp as IM
import Dodge.SpawnAt
splashScreen :: World
splashScreen =
@@ -15,8 +14,9 @@ splashScreen =
initialWorld :: World
initialWorld =
defaultWorld
& wCam . camZoom .~ 10
& cWorld . lWorld . creatures .~ IM.fromList [(0, startCr)]
& cWorld . lWorld . worldEvents .~ SoundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing :
[MakeStartCloudAt (V3 x y 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
defaultWorld & spawnAt 0
-- & wCam . camZoom .~ 10
-- & cWorld . lWorld . creatures .~ IM.fromList [(0, startCr)]
-- & cWorld . lWorld . worldEvents .~ SoundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing :
-- [MakeStartCloudAt (V3 x y 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
+3 -5
View File
@@ -28,10 +28,8 @@ import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M
testStringInit :: Universe -> [String]
testStringInit u =
map show (take 20 $ u ^.. uvWorld . cWorld . lWorld . energyBalls . each . ebPos . _z)
<>
map show (take 20 $ u ^.. uvWorld . cWorld . lWorld . shockwaves . each . swPos . _z)
testStringInit u = [show $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crHP
, show $ u ^? uvWorld . timeFlow . respawnDelay]
-- map shortShow (u ^.. uvWorld . cWorld . lWorld . debris . each . to g)
-- where
-- g db = (pz,z,norm v)
@@ -89,7 +87,7 @@ showManObj (SelCloseButton x) = "CloseButton " ++ show x
showTimeFlow :: TimeFlowStatus -> String
showTimeFlow tfs = case tfs of
DeathTime i -> "DeathTime"++show i
RespawnDelay i -> "Respawndelay"++show i
NormalTimeFlow -> "NormalTimeFlow"
ItemScrollTimeFlow {_reverseAmount = ra } -> "ItemScrollTimeFlow" ++ show ra
CameraScrollTimeFlow {_reverseAmount = ra } -> "CameraScrollTimeFlow" ++ show ra
+9 -6
View File
@@ -7,6 +7,7 @@ Description : Simulation update
-}
module Dodge.Update (updateUniverse) where
import Dodge.SpawnAt
import Dodge.Prop.Moving
import Dodge.WorldEvent.Explosion
import Dodge.Data.Object
@@ -39,7 +40,7 @@ import Dodge.Laser.Update
import Dodge.LinearShockwave.Update
import Dodge.ListDisplayParams
import Dodge.Machine.Update
import Dodge.Menu
--import Dodge.Menu
import Dodge.ModificationEffect
import Dodge.PressPlate
import Dodge.Projectile.Update
@@ -185,7 +186,7 @@ timeFlowUpdate u = case u ^. uvWorld . timeFlow of
CameraScrollTimeFlow{} -> u
RewindLeftClick 0 _ -> u & uvWorld . timeFlow .~ NormalTimeFlow
RewindLeftClick _ _ -> over uvWorld scrollTimeBack u -- & uvWorld . cWorld . timeFlow .~ NormalTimeFlow
DeathTime{} -> u
RespawnDelay{} -> functionalUpdate u
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
pauseTime :: NewInt ItmInt -> World -> World
@@ -798,10 +799,12 @@ ppEvents w = IM.foldl' (flip $ \pp -> doPressPlateEvent (_ppEvent pp) pp) w $ w
--markSeen wl = wl{_wlSeen = True}
checkEndGame :: Universe -> Universe
checkEndGame uv = case w ^? timeFlow . deathDelay of
Just x | x < 0 -> uv & uvScreenLayers .~ [gameOverMenu uv]
Just _ -> uv & uvWorld . timeFlow . deathDelay -~ 1
_ | _crHP (you w) < 1 -> uv & uvWorld . timeFlow .~ DeathTime 50
checkEndGame uv = case w ^? timeFlow . respawnDelay of
Just x | x < 0 -> uv -- & uvScreenLayers .~ [gameOverMenu uv]
& uvWorld . timeFlow .~ NormalTimeFlow
& uvWorld %~ spawnAt (w ^. cWorld . lWorld . respawnPos)
Just _ -> uv & uvWorld . timeFlow . respawnDelay -~ 1
_ | _crHP (you w) < 1 -> uv & uvWorld . timeFlow .~ RespawnDelay 50
_ -> uv
where
w = _uvWorld uv