Implement working no-item-airlock zone

This commit is contained in:
2025-09-18 15:23:51 +01:00
parent 4494e47b43
commit e017a92892
7 changed files with 55 additions and 51 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
"_graphics_cloud_shadows": true, "_graphics_cloud_shadows": true,
"_graphics_distortion_resolution": "FullRes", "_graphics_distortion_resolution": "FullRes",
"_graphics_distortions": true, "_graphics_distortions": true,
"_graphics_downsize_resolution": "EighthRes", "_graphics_downsize_resolution": "QuarterRes",
"_graphics_num_shadow_casters": "NumShadowCasters20", "_graphics_num_shadow_casters": "NumShadowCasters20",
"_graphics_shadow_rendering": "GeoObjShads", "_graphics_shadow_rendering": "GeoObjShads",
"_graphics_shadow_size": "Typical", "_graphics_shadow_size": "Typical",
@@ -16,7 +16,7 @@
"_volume_master": 1, "_volume_master": 1,
"_volume_music": 0, "_volume_music": 0,
"_volume_sound": 1, "_volume_sound": 1,
"_windowPosX": 800, "_windowPosX": 0,
"_windowPosY": 29, "_windowPosY": 29,
"_windowX": 800, "_windowX": 800,
"_windowY": 835 "_windowY": 835
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+22 -26
View File
@@ -43,13 +43,6 @@ terminalScreenGlow mc w = fromMaybe w $ do
w & cWorld . lWorld . lights w & cWorld . lWorld . lights
.:~ LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z) .:~ LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
-- w & cWorld . lWorld . tempLightSources
-- .:~ TLS
-- { _tlsParam = LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
-- , _tlsUpdate = TimerTLS
-- , _tlsTime = 1
-- }
updateTurret :: Float -> Machine -> World -> World updateTurret :: Float -> Machine -> World -> World
updateTurret rotSpeed mc w = updateTurret rotSpeed mc w =
w w
@@ -73,12 +66,17 @@ updateTurret rotSpeed mc w =
dam = sum $ map _dmAmount dams dam = sum $ map _dmAmount dams
elecDam = sum $ map _dmAmount elecDams elecDam = sum $ map _dmAmount elecDams
doTurn doTurn
| seesYou = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuDir %~ turnTo rotSpeed mcpos ypos | seesYou =
cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuDir
%~ turnTo rotSpeed mcpos ypos
| otherwise = id | otherwise = id
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1 closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
updateFiringStatus updateFiringStatus
| closeFireAngle = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime .~ 20 | closeFireAngle =
| otherwise = cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime %~ (max 0 . subtract 1) cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime .~ 20
| otherwise =
cWorld . lWorld . machines . ix mcid . mcType . _McTurret . tuFireTime
%~ (max 0 . subtract 1)
isElectrical :: Damage -> Bool isElectrical :: Damage -> Bool
isElectrical dm = case dm of isElectrical dm = case dm of
@@ -128,7 +126,7 @@ mcPlaySound mc w = case _mcType mc of
mcApplyDamage :: [Damage] -> Machine -> World -> World mcApplyDamage :: [Damage] -> Machine -> World -> World
mcApplyDamage ds mc = case mc ^? mcType . _McDamSensor of mcApplyDamage ds mc = case mc ^? mcType . _McDamSensor of
Nothing -> mcpointer %~ ((mcDamage .~ []) . (mcHP -~ sum (map _dmAmount ds))) Nothing -> mcpointer %~ ((mcDamage .~ []) . (mcHP -~ sum (map _dmAmount ds)))
_ -> mcpointer %~ (mcDamage .~ []) _ -> mcpointer . mcDamage .~ []
where where
mcpointer = cWorld . lWorld . machines . ix (_mcID mc) mcpointer = cWorld . lWorld . machines . ix (_mcID mc)
@@ -154,10 +152,12 @@ mcNoItemsTest mc ps w
where where
truetog = mc ^? mcType . _McProxSensor . proxToggle . _Just == Just True truetog = mc ^? mcType . _McProxSensor . proxToggle . _Just == Just True
falsetog = mc ^? mcType . _McProxSensor . proxToggle . _Just == Just False falsetog = mc ^? mcType . _McProxSensor . proxToggle . _Just == Just False
notog = null (mc ^? mcType . _McProxSensor . proxToggle . _Just) notog =
&& pointInPoly (cr ^. crPos) qs null (mc ^? mcType . _McProxSensor . proxToggle . _Just)
t = ((cr ^. crInv == mempty) || not (pointInPoly (cr ^. crPos) qs)) && pointInPoly (cr ^. crPos) qs
&& not (any ((`pointInPoly` qs) . _flItPos) (w ^. cWorld . lWorld . floorItems)) t =
((cr ^. crInv == mempty) || not (pointInPoly (cr ^. crPos) qs))
&& not (any ((`pointInPoly` qs) . _flItPos) (w ^. cWorld . lWorld . floorItems))
cr = w ^?! cWorld . lWorld . creatures . ix 0 cr = w ^?! cWorld . lWorld . creatures . ix 0
mcsenslens = cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McProxSensor mcsenslens = cWorld . lWorld . machines . ix (_mcID mc) . mcType . _McProxSensor
mctermlens = cWorld . lWorld . terminals . ix (mc ^?! mcMounts . ix OTTerminal) mctermlens = cWorld . lWorld . terminals . ix (mc ^?! mcMounts . ix OTTerminal)
@@ -165,23 +165,23 @@ mcNoItemsTest mc ps w
qs = f ps qs = f ps
f = fmap ((+ _mcPos mc) . rotateV (_mcDir mc)) f = fmap ((+ _mcPos mc) . rotateV (_mcDir mc))
mcProximitySensorUpdate mcProximitySensorUpdate ::
:: Machine -> ProximitySensor -> ProximityRequirement -> World -> World Machine -> ProximitySensor -> ProximityRequirement -> World -> World
mcProximitySensorUpdate mc sens pr w mcProximitySensorUpdate mc sens pr w
| truetog || dist (_crPos ycr) (_mcPos mc) > 40 = w | truetog || dist (_crPos ycr) (_mcPos mc) > 40 = w
| mcProxTest w pr = | mcProxTest w pr =
w w
& mcsenslens . proxToggle ?~ True & mcsenslens . proxToggle ?~ True
& playsound dedaS & playsound dedaS
& mctermlens . tmFutureLines <>~ & mctermlens . tmFutureLines
[makeTermLine "SENSOR SUCCESS, DEACTIVATED" ] <>~ [makeTermLine "SENSOR SUCCESS, DEACTIVATED"]
<> tlSetStatus (TerminalPressTo "QUIT") <> tlSetStatus (TerminalPressTo "QUIT")
<> tlDoEffect TmWdWdLeaveTerminal <> tlDoEffect TmWdWdLeaveTerminal
| notog = | notog =
w & playsound dedumS w & playsound dedumS
& mcsenslens . proxToggle ?~ False & mcsenslens . proxToggle ?~ False
& mctermlens . tmFutureLines & mctermlens . tmFutureLines
.:~ makeTermLine ( "SENSOR FAIL: REQUIRES " ++ sensorReqToString pr) .:~ makeTermLine ("SENSOR FAIL: REQUIRES " ++ sensorReqToString pr)
| otherwise = w | otherwise = w
where where
truetog = sens ^? proxToggle . _Just == Just True truetog = sens ^? proxToggle . _Just == Just True
@@ -211,7 +211,8 @@ senseDamage threshold dt mc =
(cWorld . lWorld . machines . ix mcid %~ upmc) (cWorld . lWorld . machines . ix mcid %~ upmc)
. updatels . updatels
where where
upmc = mcType . _McDamSensor . sensAmount %~ min (100 * threshold) . max 0 . (+ newsense) upmc = mcType . _McDamSensor . sensAmount
%~ min (100 * threshold) . max 0 . (+ newsense)
mcid = _mcID mc mcid = _mcID mc
newsense newsense
| x > 0 = x | x > 0 = x
@@ -243,8 +244,3 @@ sensorTypeDamages = \case
Crushing{} -> True Crushing{} -> True
Explosive{} -> True Explosive{} -> True
_ -> False _ -> False
--damageUsing :: DamageType -> Damage -> Either Int Int
--damageUsing dt dm
-- | _dmType dm == dt = Left $ _dmAmount dm
-- | otherwise = Right 0
+2 -1
View File
@@ -11,7 +11,8 @@ analyser :: ProximitySensorType -> PlacementSpot -> PlacementSpot -> Placement
analyser pst pslight psmc = extTrigLitPos pslight $ \tp -> analyser pst pslight psmc = extTrigLitPos pslight $ \tp ->
Just $ Just $
plSpot .~ psmc $ plSpot .~ psmc $
putTerminal (dark magenta) putTerminal
(dark magenta)
(themachine & mcMounts . at OTTrigger .~ _plMID tp) (themachine & mcMounts . at OTTrigger .~ _plMID tp)
tparams tparams
where where
+25 -19
View File
@@ -5,7 +5,7 @@ module Dodge.Room.Airlock where
import Control.Lens import Control.Lens
import Control.Monad import Control.Monad
import Dodge.Annotation.Data --import Dodge.Annotation.Data
import Dodge.Data.GenWorld import Dodge.Data.GenWorld
import Dodge.Default.Door import Dodge.Default.Door
import Dodge.Default.Room import Dodge.Default.Room
@@ -25,25 +25,31 @@ airlock =
join $ join $
takeOne [return airlock0, return airlock90, return airlockCrystal, airlockZ] takeOne [return airlock0, return airlock90, return airlockCrystal, airlockZ]
--airlock = takeOne [airlockCrystal] decontamRoom :: Int -> Room
decontamRoom :: State LayoutVars Room decontamRoom i =
decontamRoom = do defaultRoom
return $ & rmPolys .~ cutps
defaultRoom & rmLinks .~ muout lnks ++ muin [last lnks]
& rmPolys .~ cutps & rmPath .~ foldMap doublePairSet [(V2 20 95, V2 20 45), (V2 20 45, V2 20 5)]
& rmLinks .~ muout lnks ++ muin [last lnks] & rmPmnts
& rmPath .~ foldMap doublePairSet [(V2 20 95, V2 20 45), (V2 20 45, V2 20 5)] .~ [ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
& rmPmnts \btid -> Just $
.~ [ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $ putDoubleDoorThen DoorObstacle thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\btid -> Just $ \_ _ -> Just $ putDoubleDoor DoorObstacle thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
putDoubleDoorThen DoorObstacle thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $ , invisibleWall $ rectNSWE 60 40 (-40) (-30)
\_ _ -> Just $ putDoubleDoor DoorObstacle thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2 , spanLightI (V2 (-20) 30) (V2 (-20) 70)
, invisibleWall $ rectNSWE 60 40 (-40) (-30) ]
, spanLightI (V2 (-2) 30) (V2 (-2) 70) & rmOutPmnt . at i ?~
, analyser (NoItemZone ps) (PS 50 0) (PS mcpos 0) analyser (NoItemZone ps) (PS 50 0) (PS mcpos 0)
] & rmInPmnt .~ [InPlacement f i]
& rmBound .~ [rectNSWE 75 15 0 40, switchcut] & rmBound .~ [rectNSWE 75 15 0 40, switchcut]
where where
f _ (pmnt : _) = putDoubleDoor DoorObstacle (switchWallCol red) (cond pmnt)
(V2 (-10) 35)
(V2 (-10) 65)
2
f _ _ = error "tried to put a door using an empty placement list"
cond pmnt = WdTrig $ pmnt ^?! plMID . _Just
mcpos = V2 70 50 mcpos = V2 70 50
cutps = [rectNSWE 100 0 0 40, switchcut] cutps = [rectNSWE 100 0 0 40, switchcut]
ps = (\p -> p - mcpos) <$> orderPolygon (concat cutps) ps = (\p -> p - mcpos) <$> orderPolygon (concat cutps)
+2 -1
View File
@@ -56,7 +56,8 @@ tutAnoTree =
tutDrop :: State LayoutVars (MetaTree Room String) tutDrop :: State LayoutVars (MetaTree Room String)
tutDrop = do tutDrop = do
x <- shuffleLinks =<< roomNgon 6 100 x <- shuffleLinks =<< roomNgon 6 100
y <- decontamRoom i <- nextLayoutInt
let y = decontamRoom i
rm <- roomRectAutoLinks 40 100 rm <- roomRectAutoLinks 40 100
return $ tToBTree "TutDrop" $ treePost [x,y,cleatOnward rm] return $ tToBTree "TutDrop" $ treePost [x,y,cleatOnward rm]