Remove Annotation datatype

This commit is contained in:
2025-09-24 10:39:34 +01:00
parent 96b95907f2
commit eb068f5335
12 changed files with 256 additions and 314 deletions
+34 -27
View File
@@ -4,10 +4,10 @@ module Dodge.Floor (
tutRoomTree,
) where
import Dodge.Data.MTRS
import Data.Maybe
import Dodge.Room.Tutorial
import Dodge.Annotation.Data
import Data.List (intersperse)
import Dodge.Annotation
import Dodge.Cleat
import Dodge.Creature
import Dodge.Data.GenWorld
@@ -21,26 +21,18 @@ import RandomHelp
tutRoomTree :: State LayoutVars (MetaTree Room String)
tutRoomTree = tutAnoTree
--startWorldTreeTest :: Annotation
--startWorldTreeTest =
-- OnwardList $
-- [ IntAnno $ AnTree . startRoom
-- ]
initialRoomTree :: State LayoutVars MTRS
initialRoomTree =
annoToRoomTree $
OnwardList $
foldMTRS $
intersperse
(AnTree $ zoom lyGen corDoor)
[ AnTree $ intAnno startRoom
, --IntAnno $
PassthroughLockKeyLists
(zoom lyGen corDoor)
[ intAnno startRoom
, passthroughLockKeyLists
[(sensorRoomRunPast ElectricSensor, takeOne
[-- CRAFT (ENERGYBALLCRAFT TeslaBall) ,
HELD SPARKGUN])]
itemRooms
, AnTree $ intAnno lasSensorTurretTest
, intAnno lasSensorTurretTest
, -- , AnRoom $ tanksRoom [] [] <&> rmPmnts .~ []
-- , AnRoom $ tanksRoom [] []
-- , AnRoom $ roomCCrits 0
@@ -59,21 +51,20 @@ initialRoomTree =
-- , AnTree $ tToBTree "spawners" <$> spawnerRoom
-- , AnRoom pistolerRoom
-- , AnRoom doubleCorridorBarrels
PassthroughLockKeyLists keyCardRunPastRand itemRooms
, AnTree . intAnno $ warningRooms "INVISIBLE CREATURE AHEAD"
, AnTree $
rToOnward "chaseCrit+armourChaseCrit rectRoom" .
passthroughLockKeyLists keyCardRunPastRand itemRooms
, intAnno $ warningRooms "INVISIBLE CREATURE AHEAD"
, rToOnward "chaseCrit+armourChaseCrit rectRoom" .
return . cleatOnward =<<
(roomRectAutoLinks 400 400 <&> rmPmnts
.++~ [ psPtPl anyUnusedSpot (PutCrit invisibleChaseCrit)
, psPtPl anyUnusedSpot (PutCrit armourChaseCrit)
])
, AnTree . intAnno $ fmap (tToBTree "healthTest") . healthTest
, AnTree . zoom lyGen $
, intAnno $ fmap (tToBTree "healthTest") . healthTest
, zoom lyGen $
(tanksRoom [] [] >>= rToOnward "empty tanksRoom" . pure . cleatOnward)
, PassthroughLockKeyLists lockRoomKeyItems itemRooms
, AnTree randomChallenges
, AnTree $ intAnno lasSensorTurretTest
, passthroughLockKeyLists lockRoomKeyItems itemRooms
, randomChallenges
, intAnno lasSensorTurretTest
, -- ,[AnTree $ fmap pure roomCCrits]
-- ,[AirlockAno]
-- ,[Corridor]
@@ -114,7 +105,7 @@ initialRoomTree =
-- ,[Corridor]
-- ,[TreasureAno [addArmour autoCrit,addArmour autoCrit] [launcher]]
-- ,[Corridor]
AnTree $ randomFourCornerRoom [] >>= rToOnward "randomFourCornerRoom" . pure . cleatOnward
randomFourCornerRoom [] >>= rToOnward "randomFourCornerRoom" . pure . cleatOnward
]
intAnno :: (Int -> State StdGen MTRS) -> State LayoutVars MTRS
@@ -123,5 +114,21 @@ intAnno f = do
put $ LayVars g (i+1)
zoom lyGen (f i)
anRoom :: State StdGen Room -> Annotation
anRoom t = AnTree $ zoom lyGen (tToBTree "anRoom" . return . cleatOnward <$> t)
anRoom :: State StdGen Room -> State LayoutVars MTRS
anRoom t = zoom lyGen (tToBTree "anRoom" . return . cleatOnward <$> t)
passthroughLockKeyLists ::
[(Int -> State LayoutVars (MetaTree Room String), State LayoutVars ItemType)]
-> [(ItemType, State LayoutVars (MetaTree Room String))]
-> State LayoutVars (MetaTree Room String)
passthroughLockKeyLists ls ks = do
i <- nextLayoutInt
(functionlockroom, randomitemidentity) <- takeOne ls
lr <- functionlockroom i
ii <- randomitemidentity
keyroom <- fromJust $ lookup ii ks
return $
MTree
("PassthroughLockKeyLists-" ++ show ii)
(NodeMTree $ MTree "RassThroughLockKeyLists" (NodeMTree lr) [MBranch (toLabel i) keyroom])
[]