Remove _crInvEquipped
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -50,7 +50,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
|||||||
PutOnEquipment{_allocNewPos = newp} ->
|
PutOnEquipment{_allocNewPos = newp} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
& crpoint %~ assignNewHotkey invid
|
& crpoint %~ assignNewHotkey invid
|
||||||
@@ -58,22 +58,22 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
|||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crEquipment . at oldp .~ Nothing
|
& crpoint . crEquipment . at oldp .~ Nothing
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crEquipment . at oldp ?~ sid
|
& crpoint . crEquipment . at oldp ?~ sid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& crpoint . crInvEquipped . at sid ?~ oldp
|
-- & crpoint . crInvEquipped . at sid ?~ oldp
|
||||||
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
|
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
|
||||||
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& crpoint . crInvEquipped . at rid .~ Nothing
|
-- & crpoint . crInvEquipped . at rid .~ Nothing
|
||||||
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
|
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
|
||||||
& onremove (itmat rid) cr
|
& onremove (itmat rid) cr
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
@@ -82,7 +82,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
|||||||
RemoveEquipment{_allocOldPos = oldp} ->
|
RemoveEquipment{_allocOldPos = oldp} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at oldp .~ Nothing
|
& crpoint . crEquipment . at oldp .~ Nothing
|
||||||
& crpoint . crInvEquipped . at invid .~ Nothing
|
-- & crpoint . crInvEquipped . at invid .~ Nothing
|
||||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
|
||||||
& onremove itm cr
|
& onremove itm cr
|
||||||
& crpoint %~ removeHotkey invid
|
& crpoint %~ removeHotkey invid
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ data Creature = Creature
|
|||||||
, _crManipulation :: Manipulation
|
, _crManipulation :: Manipulation
|
||||||
, _crInvCapacity :: Int
|
, _crInvCapacity :: Int
|
||||||
, _crInvLock :: Bool
|
, _crInvLock :: Bool
|
||||||
, _crInvEquipped :: IM.IntMap EquipPosition
|
-- , _crInvEquipped :: IM.IntMap EquipPosition
|
||||||
, _crEquipment :: M.Map EquipPosition Int
|
, _crEquipment :: M.Map EquipPosition Int
|
||||||
, _crInvHotkeys :: IM.IntMap Hotkey
|
, _crInvHotkeys :: IM.IntMap Hotkey
|
||||||
, _crHotkeys :: M.Map Hotkey Int
|
, _crHotkeys :: M.Map Hotkey Int
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ defaultCreature =
|
|||||||
, _crCorpse = MakeDefaultCorpse
|
, _crCorpse = MakeDefaultCorpse
|
||||||
, _crMaterial = Flesh
|
, _crMaterial = Flesh
|
||||||
, _crPastDamage = 0
|
, _crPastDamage = 0
|
||||||
, _crInvEquipped = mempty
|
-- , _crInvEquipped = mempty
|
||||||
, _crEquipment = M.empty
|
, _crEquipment = M.empty
|
||||||
, _crInvHotkeys = mempty
|
, _crInvHotkeys = mempty
|
||||||
, _crHotkeys = M.empty
|
, _crHotkeys = M.empty
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ module Dodge.Hotkey (
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.List
|
import Data.List
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import qualified IntMapHelp as IM
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ rmInvItem cid invid w =
|
|||||||
& pointcid . crInv %~ f -- important
|
& pointcid . crInv %~ f -- important
|
||||||
& removeAnySlotEquipment
|
& removeAnySlotEquipment
|
||||||
& pointcid . crEquipment . each %~ g
|
& pointcid . crEquipment . each %~ g
|
||||||
& pointcid . crInvEquipped %~ IM.delete invid
|
-- & pointcid . crInvEquipped %~ IM.delete invid
|
||||||
& pointcid . crInvEquipped %~ IM.mapKeys g
|
-- & pointcid . crInvEquipped %~ IM.mapKeys g
|
||||||
& removeanyactivation
|
& removeanyactivation
|
||||||
& pointcid . crHotkeys . each %~ g
|
& pointcid . crHotkeys . each %~ g
|
||||||
& pointcid . crInvHotkeys %~ IM.delete invid
|
& pointcid . crInvHotkeys %~ IM.delete invid
|
||||||
@@ -95,7 +95,9 @@ rmInvItem cid invid w =
|
|||||||
rmf <- itm ^? itEffect . ieOnDrop
|
rmf <- itm ^? itEffect . ieOnDrop
|
||||||
return $ doInvEffect rmf itm cr
|
return $ doInvEffect rmf itm cr
|
||||||
removeAnySlotEquipment = fromMaybe id $ do
|
removeAnySlotEquipment = fromMaybe id $ do
|
||||||
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
--epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
||||||
|
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInv . ix invid
|
||||||
|
. itLocation . ilEquipPosition . _Just
|
||||||
return $ pointcid . crEquipment . at epos .~ Nothing
|
return $ pointcid . crEquipment . at epos .~ Nothing
|
||||||
removeanyactivation = fromMaybe id $ do
|
removeanyactivation = fromMaybe id $ do
|
||||||
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvHotkeys . ix invid
|
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvHotkeys . ix invid
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ crUpdateInvidLocations mo crid lw invid itm =
|
|||||||
, _ilIsRoot = Just invid == mo ^? imRootSelectedItem
|
, _ilIsRoot = Just invid == mo ^? imRootSelectedItem
|
||||||
, _ilIsSelected = Just invid == mo ^? imSelectedItem
|
, _ilIsSelected = Just invid == mo ^? imSelectedItem
|
||||||
, _ilIsAttached = invid `IS.member` (mo ^. imAttachedItems)
|
, _ilIsAttached = invid `IS.member` (mo ^. imAttachedItems)
|
||||||
, _ilEquipPosition = lw ^? creatures . ix crid . crInvEquipped . ix invid
|
--, _ilEquipPosition = lw ^? creatures . ix crid . crInvEquipped . ix invid
|
||||||
|
, _ilEquipPosition = lw ^? creatures . ix crid . crInv . ix invid
|
||||||
|
. itLocation . ilEquipPosition . _Just
|
||||||
}
|
}
|
||||||
|
|
||||||
-- this should be looked at, as it is sometimes used in functions that need not
|
-- this should be looked at, as it is sometimes used in functions that need not
|
||||||
|
|||||||
@@ -54,14 +54,15 @@ swapInvItems f i w = fromMaybe w $ do
|
|||||||
updatecreature k =
|
updatecreature k =
|
||||||
(crInv %~ IM.safeSwapKeys i k)
|
(crInv %~ IM.safeSwapKeys i k)
|
||||||
. (crManipulation . manObject . imSelectedItem .~ k)
|
. (crManipulation . manObject . imSelectedItem .~ k)
|
||||||
. (crInvEquipped %~ IM.safeSwapKeys i k)
|
-- . (crInvEquipped %~ IM.safeSwapKeys i k)
|
||||||
. swapSite i k
|
. swapSite i k
|
||||||
. swapSite k i
|
. swapSite k i
|
||||||
. (crInvHotkeys %~ IM.safeSwapKeys i k)
|
. (crInvHotkeys %~ IM.safeSwapKeys i k)
|
||||||
. swapSite' i k
|
. swapSite' i k
|
||||||
. swapSite' k i
|
. swapSite' k i
|
||||||
cr = you w
|
cr = you w
|
||||||
swapSite a b = case cr ^? crInvEquipped . ix a of
|
--swapSite a b = case cr ^? crInvEquipped . ix a of
|
||||||
|
swapSite a b = case cr ^? crInv . ix a . itLocation . ilEquipPosition . _Just of
|
||||||
Just epos -> crEquipment . ix epos .~ b
|
Just epos -> crEquipment . ix epos .~ b
|
||||||
Nothing -> id
|
Nothing -> id
|
||||||
swapSite' a b = case cr ^? crInvHotkeys . ix a of
|
swapSite' a b = case cr ^? crInvHotkeys . ix a of
|
||||||
|
|||||||
Reference in New Issue
Block a user