Improve debris slightly

This commit is contained in:
2026-03-31 21:57:15 +01:00
parent 5701261ace
commit 074d354970
8 changed files with 227 additions and 210 deletions
+6 -21
View File
@@ -110,23 +110,13 @@ placeSpotID rid ps pt w = case pt of
let i = IM.newKey (w ^. gwWorld . cWorld . lWorld . items)
in ( i
, w
& gwWorld
. cWorld
. lWorld
. floorItems
. at i
?~ FlIt p rot
& gwWorld
. cWorld
. lWorld
. items
. at i
?~ (itm & itID .~ NInt i & itLocation .~ OnFloor)
& gwWorld . cWorld . lWorld . floorItems . at i ?~ FlIt p rot
& gwWorld . cWorld . lWorld . items . at i ?~ (itm & itID .~ NInt i & itLocation .~ OnFloor)
)
PutCrit cr -> plNewUpID (gwWorld . cWorld . lWorld . creatures) crID (mvCr p rot cr) w
PutForeground fs ->
(0, w & gwWorld . cWorld . lWorld . foreShapes .:~ mvFS p rot fs)
PutMachine mc mitm -> plMachine mc mitm p rot w
PutMachine mc mitm -> plMachine (mc & mcPos .~ p & mcDir .~ rot) mitm w
PutLS ls -> plNewUpID (gwWorld . cWorld . lWorld . lightSources) lsID (mvLS p rot ls) w
RandPS _ -> error "RandPS should not be reachable here" -- evaluateRandPS rid rgn ps w
PutDoor dr wl -> plDoor (dr & drZeroPos %~ pashift & drOnePos %~ pashift) wl w
@@ -161,7 +151,6 @@ placeChasm rid ps shiftps 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
g w (x, y) = obstructPathsCrossing (S.singleton ChasmObstacle) x y w
@@ -188,22 +177,20 @@ mvFS :: Point2 -> Float -> ForegroundShape -> ForegroundShape
mvFS p a = (fsDir +~ a) . (fsPos %~ ((p +) . rotateV a))
plMachine ::
-- [Point2] ->
Machine ->
Maybe Item ->
Point2 ->
Float ->
GenWorld ->
(Int, GenWorld)
plMachine mc mitm p rot gw =
plMachine mc mitm gw =
( mcid
, gw
& tolw . machines . at mcid ?~ themc
& tolw %~ maybe id placeturretitm mitm
& gwWorld %~ addwalls
-- & gwWorld %~ placeMachineWalls (_mcSkin mc) wallpoly mcid wlid
)
where
p = mc ^. mcPos
rot = mc ^. mcDir
addwalls =
insertStructureWalls
MachinePart
@@ -220,8 +207,6 @@ plMachine mc mitm p rot gw =
mcid = IM.newKey $ gw ^. gwWorld . cWorld . lWorld . machines
wlid = IM.newKey $ gw ^. gwWorld . cWorld . lWorld . walls
themc = mc
& mcPos .~ p
& mcDir .~ rot
& mcID .~ mcid
& mcFootPrint .~ IM.fromDistinctAscList (zip [wlid..] pps)
placeturretitm itm =