Refactor floor items to use centralised items intmap

This commit is contained in:
2025-08-24 13:14:49 +01:00
parent c38d03165f
commit 22b4be440a
14 changed files with 170 additions and 152 deletions
+4 -3
View File
@@ -112,7 +112,8 @@ placeSpotID' ps pt w = case pt of
PutFlIt itm -> let i = IM.newKey (w ^. cWorld . lWorld . itemLocations)
in (i, w & cWorld . lWorld . itemLocations . at i ?~ OnFloor
& cWorld . lWorld . floorItems . at i ?~ createFlIt p rot
(itm & itID .~ NInt i)
& cWorld . lWorld . items . at i ?~ (itm & itID .~ NInt i
& itLocation .~ OnFloor)
)
-- plNewUpID
-- (cWorld . lWorld . floorItems . unNIntMap)
@@ -181,8 +182,8 @@ mvButton :: Point2 -> Float -> Button -> Button
mvButton p a = (btRot +~ a) . (btPos %~ ((p +.+) . rotateV a))
{- Creates a floor item at a given point.-}
createFlIt :: Point2 -> Float -> Item -> FloorItem
createFlIt p rot itm = FlIt{_flItPos = p, _flItRot = rot, _flIt = itm}
createFlIt :: Point2 -> Float -> FloorItem
createFlIt p rot = FlIt{_flItPos = p, _flItRot = rot}
mvPP :: Point2 -> Float -> PressPlate -> PressPlate
mvPP p rot pp = pp{_ppPos = p, _ppRot = rot}