Improve scroll selection/inventory modification

This commit is contained in:
2026-03-24 19:21:04 +00:00
parent 5b297643db
commit 8ff2f37af5
16 changed files with 532 additions and 432 deletions
+22 -15
View File
@@ -92,7 +92,6 @@ placeSpotRoomRand ::
placeSpotRoomRand rid i f plmnt w =
let (ps, g) =
runState
-- (_rmRandPSs (w ^?! genRooms . ix rid) !! i)
(w ^?! genRooms . ix rid . rmRandPSs . ix i)
$ w ^. gwWorld . randGen
in placeSpot rid (w & gwWorld . randGen .~ g) (plmnt & plSpot .~ f ps)
@@ -143,11 +142,11 @@ placeSpotID rid ps pt w = case pt of
PutChasm ps' qs ->
( 0
, placeChasm
w
rid
ps'
(map (map doShift) ps')
(foldMap (loopPairs . map doShift) qs)
w
)
PutLabel{} -> (0, w)
where
@@ -156,13 +155,12 @@ placeSpotID rid ps pt w = case pt of
doShift = shiftPointBy (p, rot)
pashift = compP2A (p, rot)
placeChasm :: GenWorld -> Int -> [[Point2]] -> [[Point2]] -> [(Point2, Point2)] -> GenWorld
placeChasm gw rid ps shiftps cfs =
gw
& gwWorld . cWorld . chasms <>~ shiftps
& gwWorld . cWorld . cliffs <>~ cfs
& genRooms . ix rid . rmPos %~ filter (\rp -> not $ any (pointInPoly (_rpPos rp)) ps)
& gwWorld %~ f
placeChasm :: Int -> [[Point2]] -> [[Point2]] -> [(Point2, Point2)] -> GenWorld -> GenWorld
placeChasm rid ps shiftps cfs =
(gwWorld . cWorld . chasms <>~ shiftps)
. (gwWorld . cWorld . cliffs <>~ cfs)
. (genRooms . ix rid . rmPos %~ filter (\rp -> not $ any (pointInPoly (_rpPos rp)) ps))
. (gwWorld %~ f)
where
-- f w = foldl' g w (loopPairs shiftps)
f w = foldl' g w cfs
@@ -201,9 +199,14 @@ plMachine ::
plMachine wallpoly mc mitm p rot gw =
( mcid
, gw
& tolw . machines . at mcid ?~ themc
& gwWorld %~ placeMachineWalls (_mcMaterial mc) wallpoly mcid wlid
& tolw %~ maybe id placeturretitm mitm
& tolw
. machines
. at mcid
?~ themc
& gwWorld
%~ placeMachineWalls (_mcMaterial mc) wallpoly mcid wlid
& tolw
%~ maybe id placeturretitm mitm
)
where
tolw = gwWorld . cWorld . lWorld
@@ -221,9 +224,13 @@ plMachine wallpoly mc mitm p rot gw =
placeMachineWalls :: Material -> [Point2] -> Int -> Int -> World -> World
placeMachineWalls mat poly mcid = insertStructureWalls MachinePart baseWall poly mcid
where
baseWall = defaultMachineWall
& wlStructure . wsMachine .~ mcid
& wlMaterial .~ mat
baseWall =
defaultMachineWall
& wlStructure
. wsMachine
.~ mcid
& wlMaterial
.~ mat
mvLS :: Point2 -> Float -> LightSource -> LightSource
mvLS x rot = lsParam . lsPos . _xy %~ ((+ x) . rotateV rot)