Commit before only putting item locations in single itemLocations intmap
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Inventory (
|
||||
checkInvSlotsYou,
|
||||
rmSelectedInvItem,
|
||||
rmInvItem,
|
||||
destroyInvItem,
|
||||
updateCloseObjects,
|
||||
changeSwapSel,
|
||||
scrollAugInvSel,
|
||||
@@ -35,6 +36,20 @@ import ListHelp
|
||||
|
||||
-- TODO check what happens to selection index when dropping non-selected items
|
||||
|
||||
-- should consider never fully destroying items, but assigning a flag saying how
|
||||
-- they were moved from play
|
||||
destroyInvItem ::
|
||||
Int ->
|
||||
-- | Inventory position
|
||||
Int ->
|
||||
World ->
|
||||
World
|
||||
destroyInvItem cid invid w = rmInvItem cid invid w & removeitloc
|
||||
where
|
||||
removeitloc = fromMaybe id $ do
|
||||
itid <- w ^? cWorld . lWorld . creatures . ix cid . crInv . ix invid . itID
|
||||
return $ cWorld . lWorld . itemLocations . at itid .~ Nothing
|
||||
|
||||
-- | after this the item at the inventory position will no longer exist
|
||||
rmInvItem ::
|
||||
-- | Creature id
|
||||
|
||||
Reference in New Issue
Block a user