Start move towards using assignable hotkeys for active equipment
This commit is contained in:
@@ -111,7 +111,7 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
|
|||||||
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
|
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
|
||||||
itmat i = _crInv cr IM.! i
|
itmat i = _crInv cr IM.! i
|
||||||
itm = itmat itRef
|
itm = itmat itRef
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change?
|
||||||
onequip itm' = useE ((_eeOnEquip . _equipEffect . _itUse) itm') itm'
|
onequip itm' = useE ((_eeOnEquip . _equipEffect . _itUse) itm') itm'
|
||||||
onremove itm' = useE ((_eeOnRemove . _equipEffect . _itUse) itm') itm'
|
onremove itm' = useE ((_eeOnRemove . _equipEffect . _itUse) itm') itm'
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import Dodge.Data.Item
|
|||||||
import Dodge.Data.Material
|
import Dodge.Data.Material
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
|
|
||||||
--import MaybeHelp
|
--import MaybeHelp
|
||||||
|
|
||||||
data Creature = Creature
|
data Creature = Creature
|
||||||
@@ -56,6 +57,8 @@ data Creature = Creature
|
|||||||
, _crInvEquipped :: IM.IntMap EquipPosition
|
, _crInvEquipped :: IM.IntMap EquipPosition
|
||||||
, _crEquipment :: M.Map EquipPosition Int
|
, _crEquipment :: M.Map EquipPosition Int
|
||||||
, _crLeftInvSel :: LeftInvSel
|
, _crLeftInvSel :: LeftInvSel
|
||||||
|
, _crInvHotkeys :: IM.IntMap Hotkey
|
||||||
|
, _crHotkeys :: M.Map Hotkey Int
|
||||||
, _crState :: CreatureState
|
, _crState :: CreatureState
|
||||||
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
||||||
, _crMaterial :: Material
|
, _crMaterial :: Material
|
||||||
|
|||||||
@@ -27,10 +27,19 @@ data EquipPosition
|
|||||||
| OnSpecial
|
| OnSpecial
|
||||||
deriving (Eq, Ord)
|
deriving (Eq, Ord)
|
||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
data Hotkey = HotkeyQ
|
||||||
|
| HotkeyE
|
||||||
|
| Hotkey1
|
||||||
|
| Hotkey2
|
||||||
|
| Hotkey3
|
||||||
|
| Hotkey4
|
||||||
|
deriving (Eq, Show, Read, Ord, Bounded, Enum) --Generic, Flat)
|
||||||
|
|
||||||
|
|
||||||
deriveJSON defaultOptions ''EquipSite
|
deriveJSON defaultOptions ''EquipSite
|
||||||
deriveJSON defaultOptions ''EquipPosition
|
deriveJSON defaultOptions ''EquipPosition
|
||||||
|
deriveJSON defaultOptions ''Hotkey
|
||||||
instance ToJSONKey EquipPosition
|
instance ToJSONKey EquipPosition
|
||||||
|
|
||||||
instance FromJSONKey EquipPosition
|
instance FromJSONKey EquipPosition
|
||||||
|
instance ToJSONKey Hotkey
|
||||||
|
instance FromJSONKey Hotkey
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ data InvSelAction
|
|||||||
|
|
||||||
data LeftInvSel = LeftInvSel
|
data LeftInvSel = LeftInvSel
|
||||||
{ _lisMPos :: Maybe Int
|
{ _lisMPos :: Maybe Int
|
||||||
, _lisActive :: Bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
makeLenses ''LoadAction
|
makeLenses ''LoadAction
|
||||||
|
|||||||
@@ -30,13 +30,15 @@ defaultCreature =
|
|||||||
, _crManipulation = Manipulator SelNothing
|
, _crManipulation = Manipulator SelNothing
|
||||||
, _crInvCapacity = 25
|
, _crInvCapacity = 25
|
||||||
, _crInvLock = False
|
, _crInvLock = False
|
||||||
, _crInvEquipped = mempty
|
, _crLeftInvSel = LeftInvSel Nothing
|
||||||
, _crLeftInvSel = LeftInvSel Nothing False
|
|
||||||
, _crState = defaultState
|
, _crState = defaultState
|
||||||
, _crCorpse = MakeDefaultCorpse
|
, _crCorpse = MakeDefaultCorpse
|
||||||
, _crMaterial = Flesh
|
, _crMaterial = Flesh
|
||||||
, _crPastDamage = 0
|
, _crPastDamage = 0
|
||||||
|
, _crInvEquipped = mempty
|
||||||
, _crEquipment = M.empty
|
, _crEquipment = M.empty
|
||||||
|
, _crInvHotkeys = mempty
|
||||||
|
, _crHotkeys = M.empty
|
||||||
, _crStance =
|
, _crStance =
|
||||||
Stance
|
Stance
|
||||||
{ _carriage = Walking 0 WasLeftForward
|
{ _carriage = Walking 0 WasLeftForward
|
||||||
|
|||||||
Reference in New Issue
Block a user