Refactor floor items, removing ids (not fully checked)
This commit is contained in:
@@ -66,9 +66,9 @@ destroyItem itid w = case w ^? cWorld . lWorld . itemLocations . ix itid of
|
||||
Nothing -> error $ "Tried to destroy item that does not exist; item id: " ++ show itid
|
||||
Just InInv{_ilCrID = cid, _ilInvID = invid} -> destroyInvItem cid invid w
|
||||
Just OnTurret{} -> error "need to write code for destroying items on turrets"
|
||||
Just (OnFloor (NInt i)) ->
|
||||
Just OnFloor ->
|
||||
w & cWorld . lWorld . itemLocations . at itid .~ Nothing
|
||||
& cWorld . lWorld . floorItems . unNIntMap . at i .~ Nothing
|
||||
& cWorld . lWorld . floorItems . at itid .~ Nothing
|
||||
Just InVoid -> w & cWorld . lWorld . itemLocations . at itid .~ Nothing
|
||||
|
||||
-- note rmInvItem does not fully destroy the item, other updates to the item
|
||||
@@ -125,7 +125,7 @@ updateCloseObjects w =
|
||||
g oldbts = intersect oldbts cbts `union` cbts
|
||||
f olditems = intersect olditems citems `union` citems
|
||||
lw = w ^. cWorld . lWorld
|
||||
citems = lw^..floorItems . unNIntMap . each . filtered (isclose . _flItPos) . to _flItID
|
||||
citems = lw^..floorItems . each . filtered (isclose . _flItPos) . to (_itID . _flIt)
|
||||
isclose x = dist y x < 40 && hasButtonLOS y x w
|
||||
y = _crPos $ you w
|
||||
cbts = lw^..buttons . each . filtered canpress . filtered (isclose . _btPos) . to _btID
|
||||
|
||||
Reference in New Issue
Block a user