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
+2 -6
View File
@@ -24,18 +24,14 @@ copyItemToFloorID pos it w =
w'
& cWorld . lWorld . floorItems %~ IM.insert (_unNInt $ _itID it) theflit
& cWorld . lWorld . itemLocations %~ IM.insert (_unNInt $ _itID it) OnFloor
& cWorld . lWorld . items . ix (_unNInt $ _itID it) . itLocation .~ OnFloor
& hud . closeItems %~ (_itID it:)
-- & hud . hudElement . diSections . ix 3 . ssOffset .~ 0
-- ensures dropped item is at the top of the close item selection list
where
(p', w') = findWallFreeDropPoint (_dimRad $ itDim it) pos w
rot = fst . randomR (- pi, pi) $ _randGen w
theflit =
FlIt
{ _flIt = it & itLocation .~ OnFloor
, _flItPos = p'
, _flItRot = rot
}
theflit = FlIt { _flItPos = p' , _flItRot = rot }
cardinalVectors :: [Point2]
cardinalVectors =