Commit before tweaking item id/locations
This commit is contained in:
@@ -62,6 +62,7 @@ rmInvItem cid invid w = w
|
||||
& updateselection
|
||||
& pointcid %~ updateRootItemID
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& updateCreatureItemLocations cid
|
||||
where
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
@@ -94,6 +95,15 @@ rmInvItem cid invid w = w
|
||||
| x > invid || Just x == maxk = max 0 $ x - 1
|
||||
| otherwise = x
|
||||
|
||||
updateCreatureItemLocations :: Int -> World -> World
|
||||
updateCreatureItemLocations crid w = fromMaybe w $ do
|
||||
inv <- w ^? cWorld . lWorld . creatures . ix crid . crInv
|
||||
return $ foldl' updateItemLocation w inv
|
||||
|
||||
updateItemLocation :: World -> Item -> World
|
||||
updateItemLocation w itm = w
|
||||
& cWorld . lWorld . itemLocations . ix (itm ^. itID) .~ itm ^. itLocation
|
||||
|
||||
---- | after this the item at the inventory position will no longer exist
|
||||
--rmInvItem ::
|
||||
-- -- | Creature id
|
||||
|
||||
Reference in New Issue
Block a user