Add led/battery to tutorial

This commit is contained in:
2025-10-07 11:30:59 +01:00
parent e9178f9643
commit 709195ed6a
3 changed files with 50 additions and 53 deletions
+1
View File
@@ -2,6 +2,7 @@
module Dodge.Layout (
generateLevelFromRoomList,
tilesFromRooms,
shuffleRoomPos,
) where
import Dodge.Path.Translate
+15 -20
View File
@@ -1,5 +1,6 @@
module Dodge.Room.Tutorial where
import Dodge.Layout
import Dodge.Item.Held.Utility
import Control.Monad
import qualified Data.IntMap.Strict as IM
@@ -36,28 +37,11 @@ import RandomHelp
import ShortShow
import TreeHelp
--import Data.List (intersperse)
testf = PSPos (\x _ -> f x) (\_ -> id) Nothing
where
f x = case _rpType x of
NotLink{} -> Just (PS (_rpPos x) (_rpDir x), x)
_ -> Nothing
tutAnoTree :: State LayoutVars MTRS
tutAnoTree = do
foldMTRS
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
, corDoor
, tToBTree "test" . return . cleatOnward <$> (roomRectAutoLinks 100 100
<&> rmPmnts <>~
[sps0 $ PutChasm $ rectNSWE 70 30 30 70
, Placement testf (PutFlIt led) Nothing Nothing (const $ const Nothing)
]
<&> rmPos .~[RoomPos 35 0 mempty (NotLink False) mempty]
-- <&> rmPos .~[]
)
, corDoor
, tutHub
, tutLight
, tutDrop
@@ -211,18 +195,29 @@ chasmSimpleMaze =
tutLight :: State LayoutVars (MetaTree Room String)
tutLight = do
x <- chasmSimpleMaze
x <- shuffleRoomPos =<< chasmSimpleMaze
y <- chasmSimpleMaze
return $
tToBTree "TutLight" $
treePost
[ x -- & rmPmnts <>~ [sps (PS 0 0) (PutFlIt torch)]
[ x & rmPmnts <>~
[sps g (PutFlIt led)
,sps g (PutFlIt battery)
]
, corridor & rmPmnts .~ mempty
, removeLights y
, corridor & rmPmnts .~ mempty
, removeLights y
, cleatOnward corridor & rmPmnts .~ mempty
]
where
g = PSPos (\x _ -> f x) (\_ -> id) Nothing
where
f x = case _rpType x of
NotLink{} | null (x ^. rpPlacementUse . at UsedPosFloor)
-> Just (PS (_rpPos x) (_rpDir x)
, x & rpPlacementUse . at UsedPosFloor ?~ ())
_ -> Nothing
removeLights :: Room -> Room
removeLights = rmPmnts %~ mapMaybe f
@@ -257,7 +252,7 @@ tutHub = do
return $
tToBTree "DoorTest" $
Node
(x & rmPmnts .:~ sps0 (PutFlIt led))
x
[ treeFromPost [triggerDoorRoom i] r1
, treeFromPost [triggerDoorRoom j] r2
, (rmClusterStatus . csLinks . at OnwardCluster .~ Nothing)