Cleanup
This commit is contained in:
@@ -45,45 +45,34 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
PutOnEquipment{_allocNewPos = newp} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
|
||||
& onequip itm cr
|
||||
-- & crpoint %~ assignNewHotkey invid
|
||||
& cWorld . lWorld %~ assignNewHotkey invid
|
||||
MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crEquipment . at oldp .~ Nothing
|
||||
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
|
||||
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crEquipment . at oldp ?~ sid
|
||||
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
-- & crpoint . crInvEquipped . at sid ?~ oldp
|
||||
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
|
||||
& crpoint . crInv . ix sid . itLocation . ilEquipSite ?~ oldp
|
||||
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
-- & crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
-- & crpoint . crInvEquipped . at rid .~ Nothing
|
||||
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
|
||||
& crpoint . crInv . ix rid . itLocation . ilEquipSite .~ Nothing
|
||||
& onremove (itmat rid) cr
|
||||
& onequip itm cr
|
||||
-- & crpoint %~ removeHotkey rid
|
||||
-- & crpoint %~ assignNewHotkey invid
|
||||
& cWorld . lWorld %~ removeHotkey rid
|
||||
& cWorld . lWorld %~ assignNewHotkey invid
|
||||
RemoveEquipment{_allocOldPos = oldp} ->
|
||||
w
|
||||
& crpoint . crEquipment . at oldp .~ Nothing
|
||||
-- & crpoint . crInvEquipped . at invid .~ Nothing
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipSite .~ Nothing
|
||||
& onremove itm cr
|
||||
-- & crpoint %~ removeHotkey invid
|
||||
& cWorld . lWorld %~ removeHotkey invid
|
||||
where
|
||||
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
|
||||
|
||||
@@ -178,7 +178,7 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
|
||||
itm = loc ^. locLDT . ldtValue . _1
|
||||
|
||||
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipPosition . _Just of
|
||||
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
||||
Just _ -> useE loc cr
|
||||
_ -> id
|
||||
where
|
||||
|
||||
@@ -24,7 +24,7 @@ equipmentStrValue itm = case _itType itm of
|
||||
_ -> 0
|
||||
|
||||
crCurrentEquipment :: Creature -> IM.IntMap Item
|
||||
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipPosition . _Just)) . _crInv
|
||||
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipSite . _Just)) . _crInv
|
||||
|
||||
strFromHeldItem :: Creature -> Int
|
||||
strFromHeldItem cr
|
||||
|
||||
@@ -54,7 +54,7 @@ data Creature = Creature
|
||||
, _crManipulation :: Manipulation
|
||||
, _crInvCapacity :: Int
|
||||
, _crInvLock :: Bool
|
||||
, _crEquipment :: M.Map EquipPosition Int
|
||||
, _crEquipment :: M.Map EquipSite Int
|
||||
, _crState :: CreatureState
|
||||
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
||||
, _crMaterial :: Material
|
||||
|
||||
@@ -8,16 +8,17 @@ module Dodge.Data.Equipment.Misc where
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
data EquipSite
|
||||
data EquipType
|
||||
= GoesOnHead
|
||||
| GoesOnChest
|
||||
| GoesOnBack
|
||||
| GoesOnWrist
|
||||
| GoesOnLegs
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data EquipPosition
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data EquipSite
|
||||
= OnHead
|
||||
| OnChest
|
||||
| OnBack
|
||||
@@ -25,9 +26,11 @@ data EquipPosition
|
||||
| OnRightWrist
|
||||
| OnLegs
|
||||
| OnSpecial
|
||||
deriving (Eq, Ord,Show,Read)
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
data Hotkey = HotkeyQ
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
data Hotkey
|
||||
= HotkeyQ
|
||||
| HotkeyE
|
||||
| Hotkey1
|
||||
| Hotkey2
|
||||
@@ -39,13 +42,16 @@ data Hotkey = HotkeyQ
|
||||
| Hotkey8
|
||||
| Hotkey9
|
||||
| Hotkey0
|
||||
deriving (Eq, Show, Read, Ord, Bounded, Enum) --Generic, Flat)
|
||||
|
||||
deriving (Eq, Show, Read, Ord, Bounded, Enum) --Generic, Flat)
|
||||
|
||||
deriveJSON defaultOptions ''EquipType
|
||||
deriveJSON defaultOptions ''EquipSite
|
||||
deriveJSON defaultOptions ''EquipPosition
|
||||
deriveJSON defaultOptions ''Hotkey
|
||||
instance ToJSONKey EquipPosition
|
||||
instance FromJSONKey EquipPosition
|
||||
|
||||
instance ToJSONKey EquipSite
|
||||
|
||||
instance FromJSONKey EquipSite
|
||||
|
||||
instance ToJSONKey Hotkey
|
||||
|
||||
instance FromJSONKey Hotkey
|
||||
|
||||
@@ -102,7 +102,7 @@ data EquipItemType
|
||||
| FLAMESHIELD
|
||||
| FRONTARMOUR
|
||||
| WRISTARMOUR
|
||||
| INVISIBILITYEQUIPMENT EquipSite
|
||||
| INVISIBILITYEQUIPMENT EquipType
|
||||
| BRAINHAT
|
||||
| HAT
|
||||
| HEADLAMP
|
||||
|
||||
@@ -18,9 +18,6 @@ data ItEffect = ItEffect
|
||||
|
||||
data ItInvEffect
|
||||
= NoInvEffect
|
||||
-- | ChargeIfEquipped
|
||||
-- | ChargeIfInInventory
|
||||
-- | SetCharge Int
|
||||
| EffectRootNotroot ItInvEffect ItInvEffect
|
||||
| CreateShieldWall
|
||||
| RemoveShieldWall
|
||||
|
||||
@@ -32,7 +32,7 @@ data ItemLocation
|
||||
, _ilIsRoot :: Bool
|
||||
, _ilIsSelected :: Bool
|
||||
, _ilIsAttached :: Bool
|
||||
, _ilEquipPosition :: Maybe EquipPosition
|
||||
, _ilEquipSite :: Maybe EquipSite
|
||||
}
|
||||
| OnTurret {_ilTuID :: Int}
|
||||
| OnFloor {_ilFlID :: NewInt FloorInt}
|
||||
|
||||
@@ -18,7 +18,7 @@ data EquipEffect = EquipEffect
|
||||
{ _eeUse :: Euse --Item -> Creature -> World -> World
|
||||
, _eeOnEquip :: ItmCrWdWd --Item -> Creature -> World -> World
|
||||
, _eeOnRemove :: ItmCrWdWd --Item -> Creature -> World -> World
|
||||
, _eeSite :: EquipSite
|
||||
, _eeType :: EquipType
|
||||
, _eeParams :: EquipParams
|
||||
, _eeViewDist :: Maybe Float
|
||||
, _eeAttachPos :: Point3
|
||||
|
||||
@@ -18,23 +18,23 @@ data RightButtonOptions
|
||||
data EquipmentAllocation
|
||||
= DoNotMoveEquipment
|
||||
| PutOnEquipment
|
||||
{ _allocNewPos :: EquipPosition
|
||||
{ _allocNewPos :: EquipSite
|
||||
}
|
||||
| MoveEquipment
|
||||
{ _allocNewPos :: EquipPosition
|
||||
, _allocOldPos :: EquipPosition
|
||||
{ _allocNewPos :: EquipSite
|
||||
, _allocOldPos :: EquipSite
|
||||
}
|
||||
| SwapEquipment
|
||||
{ _allocNewPos :: EquipPosition
|
||||
, _allocOldPos :: EquipPosition
|
||||
{ _allocNewPos :: EquipSite
|
||||
, _allocOldPos :: EquipSite
|
||||
, _allocSwapID :: Int
|
||||
}
|
||||
| ReplaceEquipment
|
||||
{ _allocNewPos :: EquipPosition
|
||||
{ _allocNewPos :: EquipSite
|
||||
, _allocRemoveID :: Int
|
||||
}
|
||||
| RemoveEquipment
|
||||
{ _allocOldPos :: EquipPosition
|
||||
{ _allocOldPos :: EquipSite
|
||||
}
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import Dodge.Data.Item.Use.Equipment
|
||||
defaultEquip :: EquipEffect
|
||||
defaultEquip =
|
||||
EquipEffect
|
||||
{ _eeSite = GoesOnHead
|
||||
{ _eeType = GoesOnHead
|
||||
, _eeUse = EDoNothing
|
||||
, _eeOnEquip = ItmCrWdWdDoNothing
|
||||
, _eeOnRemove = ItmCrWdWdDoNothing
|
||||
|
||||
@@ -2,7 +2,7 @@ module Dodge.Equipment.Text (eqPosText) where
|
||||
|
||||
import Dodge.Data.Equipment.Misc
|
||||
|
||||
eqPosText :: EquipPosition -> String
|
||||
eqPosText :: EquipSite -> String
|
||||
eqPosText ep = case ep of
|
||||
OnHead -> "HEAD"
|
||||
OnChest -> "CHESt"
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ setWristShieldPos itm cr w = w & moveWallIDUnsafe i wlline
|
||||
i = _eparamID $ _eeParams $ _uequipEffect $ _itUse itm
|
||||
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
|
||||
invid = _ilInvID (_itLocation itm)
|
||||
handtrans = case cr ^? crInv . ix invid . itLocation . ilEquipPosition . _Just of
|
||||
handtrans = case cr ^? crInv . ix invid . itLocation . ilEquipSite . _Just of
|
||||
Just OnLeftWrist -> \cr' -> translatePointToLeftHand cr' . g
|
||||
_ -> translatePointToRightHand
|
||||
g
|
||||
|
||||
@@ -22,13 +22,10 @@ newHotkey lw = fromMaybe maxBound $
|
||||
|
||||
-- this will not remove the hotkey from its old slot, assumes there is a hotkey
|
||||
-- to swap with instead
|
||||
-- requires there actually is equipment in the slot, too
|
||||
assignHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||
assignHotkey invid hk lw = fromMaybe lw $ do
|
||||
--guard (invid `IM.member` (cr ^. crInvEquipped))
|
||||
guard $ lw ^? creatures . ix 0 . crInv . ix invid . itUse . useCondition
|
||||
== Just UseableAnytime
|
||||
-- _ <- lw ^? creatures . ix 0 . crInv . ix invid . itUse . leftUse
|
||||
return $ (setHotkey invid hk . moveOldHotkey invid hk) lw
|
||||
|
||||
moveOldHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||
|
||||
@@ -66,10 +66,7 @@ rmInvItem cid invid w =
|
||||
& pointcid . crInv %~ f -- important
|
||||
& removeAnySlotEquipment
|
||||
& pointcid . crEquipment . each %~ g
|
||||
-- & pointcid . crInvEquipped %~ IM.delete invid
|
||||
-- & pointcid . crInvEquipped %~ IM.mapKeys g
|
||||
& removeanyactivation
|
||||
-- & pointcid . crHotkeys . each %~ g
|
||||
& cWorld . lWorld . hotkeys . each %~ g
|
||||
& cWorld . lWorld . imHotkeys %~ IM.delete invid
|
||||
& cWorld . lWorld . imHotkeys %~ IM.mapKeys g
|
||||
@@ -96,13 +93,11 @@ rmInvItem cid invid w =
|
||||
rmf <- itm ^? itEffect . ieOnDrop
|
||||
return $ doInvEffect rmf itm cr
|
||||
removeAnySlotEquipment = fromMaybe id $ do
|
||||
--epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
||||
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInv . ix invid
|
||||
. itLocation . ilEquipPosition . _Just
|
||||
. itLocation . ilEquipSite . _Just
|
||||
return $ pointcid . crEquipment . at epos .~ Nothing
|
||||
removeanyactivation = fromMaybe id $ do
|
||||
epos <- w ^? cWorld . lWorld . imHotkeys . ix invid
|
||||
--return $ pointcid . crHotkeys . at epos .~ Nothing
|
||||
return $ cWorld . lWorld . hotkeys . at epos .~ Nothing
|
||||
maxk = fmap fst $ IM.lookupMax $ cr ^. crInv
|
||||
f inv =
|
||||
|
||||
@@ -72,7 +72,7 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
|
||||
, _ilIsRoot = False
|
||||
, _ilIsSelected = False
|
||||
, _ilIsAttached = False
|
||||
, _ilEquipPosition = Nothing
|
||||
, _ilEquipSite = Nothing
|
||||
}
|
||||
|
||||
---- should select the item on the floor if no inventory space?
|
||||
|
||||
@@ -72,9 +72,8 @@ crUpdateInvidLocations mo crid lw invid itm =
|
||||
, _ilIsRoot = Just invid == mo ^? imRootSelectedItem
|
||||
, _ilIsSelected = Just invid == mo ^? imSelectedItem
|
||||
, _ilIsAttached = invid `IS.member` (mo ^. imAttachedItems)
|
||||
--, _ilEquipPosition = lw ^? creatures . ix crid . crInvEquipped . ix invid
|
||||
, _ilEquipPosition = lw ^? creatures . ix crid . crInv . ix invid
|
||||
. itLocation . ilEquipPosition . _Just
|
||||
, _ilEquipSite = lw ^? creatures . ix crid . crInv . ix invid
|
||||
. itLocation . ilEquipSite . _Just
|
||||
}
|
||||
|
||||
-- this should be looked at, as it is sometimes used in functions that need not
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Dodge.Inventory.RBList (
|
||||
updateRBList,
|
||||
getEquipmentAllocation,
|
||||
equipSiteToPositions,
|
||||
eqSiteToPositions,
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
@@ -14,32 +14,30 @@ import Dodge.Data.World
|
||||
import qualified SDL
|
||||
|
||||
updateRBList :: World -> World
|
||||
updateRBList w
|
||||
| not (SDL.ButtonRight `M.member` (w ^. input . mouseButtons)) =
|
||||
w & rbOptions .~ NoRightButtonOptions
|
||||
| otherwise = case w ^. rbOptions of
|
||||
EquipOptions{} -> w
|
||||
_ -> fromMaybe (w & rbOptions .~ NoRightButtonOptions) $ do
|
||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- cr ^? crInv . ix i . itUse . uequipEffect . eeSite
|
||||
return $
|
||||
w
|
||||
& rbOptions
|
||||
.~ EquipOptions
|
||||
{ _opSel = chooseEquipmentPosition cr (equipSiteToPositions esite)
|
||||
}
|
||||
updateRBList w = case w ^. rbOptions of
|
||||
_ | norightclick -> w & rbOptions .~ NoRightButtonOptions
|
||||
EquipOptions{} -> w
|
||||
_ -> fromMaybe (w & rbOptions .~ NoRightButtonOptions) $ do
|
||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- cr ^? crInv . ix i . itUse . uequipEffect . eeType
|
||||
return $
|
||||
w & rbOptions
|
||||
.~ EquipOptions
|
||||
{ _opSel = chooseEquipPosition cr (eqSiteToPositions esite)
|
||||
}
|
||||
where
|
||||
norightclick = not $ SDL.ButtonRight `M.member` (w ^. input . mouseButtons)
|
||||
cr = you w
|
||||
|
||||
-- want to choose the current position if the item is equipped, otherwise try to
|
||||
-- find a free equipment slot
|
||||
chooseEquipmentPosition :: Creature -> [EquipPosition] -> Int
|
||||
chooseEquipmentPosition cr eps = fromMaybe (chooseFreeSite cr eps) $ do
|
||||
chooseEquipPosition :: Creature -> [EquipSite] -> Int
|
||||
chooseEquipPosition cr eps = fromMaybe (chooseFreeSite cr eps) $ do
|
||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
ep <- cr ^? crInv . ix i . itLocation . ilEquipPosition . _Just
|
||||
ep <- cr ^? crInv . ix i . itLocation . ilEquipSite . _Just
|
||||
elemIndex ep eps
|
||||
|
||||
chooseFreeSite :: Creature -> [EquipPosition] -> Int
|
||||
chooseFreeSite :: Creature -> [EquipSite] -> Int
|
||||
chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
|
||||
where
|
||||
hasnoequipment ep = isNothing $ cr ^? crEquipment . ix ep
|
||||
@@ -47,11 +45,12 @@ chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
|
||||
getEquipmentAllocation :: World -> EquipmentAllocation
|
||||
getEquipmentAllocation w = fromMaybe DoNotMoveEquipment $ do
|
||||
curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix curpos . itUse . uequipEffect . eeSite
|
||||
i <- w ^? rbOptions . opSel
|
||||
<|> Just (chooseEquipmentPosition (you w) (equipSiteToPositions esite))
|
||||
es <- equipSiteToPositions esite ^? ix i
|
||||
return $ case you w ^? crInv . ix curpos . itLocation . ilEquipPosition . _Just of
|
||||
esite <- you w ^? crInv . ix curpos . itUse . uequipEffect . eeType
|
||||
i <-
|
||||
w ^? rbOptions . opSel
|
||||
<|> Just (chooseEquipPosition (you w) (eqSiteToPositions esite))
|
||||
es <- eqSiteToPositions esite ^? ix i
|
||||
return $ case you w ^? crInv . ix curpos . itLocation . ilEquipSite . _Just of
|
||||
Just epos
|
||||
| es == epos -> RemoveEquipment{_allocOldPos = epos}
|
||||
Just epos
|
||||
@@ -74,11 +73,10 @@ getEquipmentAllocation w = fromMaybe DoNotMoveEquipment $ do
|
||||
}
|
||||
Nothing -> PutOnEquipment{_allocNewPos = es}
|
||||
|
||||
equipSiteToPositions :: EquipSite -> [EquipPosition]
|
||||
equipSiteToPositions es = case es of
|
||||
eqSiteToPositions :: EquipType -> [EquipSite]
|
||||
eqSiteToPositions es = case es of
|
||||
GoesOnHead -> [OnHead]
|
||||
GoesOnChest -> [OnChest]
|
||||
GoesOnBack -> [OnBack]
|
||||
GoesOnWrist -> [OnLeftWrist, OnRightWrist]
|
||||
GoesOnLegs -> [OnLegs]
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ invSelectionItem indent lw i ci =
|
||||
cr = lw ^?! creatures . ix 0
|
||||
anyhotkey = maybe [] ((' ' :) . hotkeyToString) (lw ^? imHotkeys . ix i)
|
||||
anyequippos = maybe [] (rightPad 8 ' ' . (' ' :) . eqPosText)
|
||||
(ci ^? _1 . itLocation . ilEquipPosition . _Just)
|
||||
(ci ^? _1 . itLocation . ilEquipSite . _Just)
|
||||
col = itemInvColor ci
|
||||
pics = itemDisplay cr ci
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
. (cWorld . lWorld . imHotkeys %~ IM.safeSwapKeys i k)
|
||||
cr = you w
|
||||
--swapSite a b = case cr ^? crInvEquipped . ix a of
|
||||
swapSite a b = case cr ^? crInv . ix a . itLocation . ilEquipPosition . _Just of
|
||||
swapSite a b = case cr ^? crInv . ix a . itLocation . ilEquipSite . _Just of
|
||||
Just epos -> crEquipment . ix epos .~ b
|
||||
Nothing -> id
|
||||
--swapSite' a b = case cr ^? crInvHotkeys . ix a of
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Dodge.ItEffect (
|
||||
doInvEffect,
|
||||
) where
|
||||
@@ -7,7 +8,7 @@ import Dodge.Data.World
|
||||
import Dodge.Euse
|
||||
|
||||
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
|
||||
doInvEffect iie = case iie of
|
||||
doInvEffect = \case
|
||||
NoInvEffect -> const $ const id
|
||||
EffectRootNotroot f g -> rootNotrootEff f g
|
||||
CreateShieldWall -> createShieldWall
|
||||
|
||||
@@ -22,12 +22,12 @@ itemEquipPict cr itmtree = case itm ^. itUse of
|
||||
ituse -> fold $ do
|
||||
attachpos <- ituse ^? uequipEffect . eeAttachPos
|
||||
i <- itm ^? itLocation . ilInvID
|
||||
epos <- cr ^? crInv . ix i . itLocation . ilEquipPosition . _Just
|
||||
epos <- cr ^? crInv . ix i . itLocation . ilEquipSite . _Just
|
||||
return $ equipPosition epos cr attachpos (itemSPic itm)
|
||||
where
|
||||
itm = itmtree ^. ldtValue . _1
|
||||
|
||||
equipPosition :: EquipPosition -> Creature -> Point3 -> SPic -> SPic
|
||||
equipPosition :: EquipSite -> Creature -> Point3 -> SPic -> SPic
|
||||
equipPosition epos cr p sh = case epos of
|
||||
OnLeftWrist -> translateToLeftWrist cr sh
|
||||
OnRightWrist -> translateToRightWrist cr sh
|
||||
|
||||
+14
-14
@@ -28,25 +28,25 @@ magShield =
|
||||
defaultEquipment
|
||||
& itParams .~ MagShieldParams Nothing
|
||||
& itUse . uequipEffect . eeUse .~ EMagShield
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeType .~ GoesOnWrist
|
||||
& itType .~ EQUIP MAGSHIELD
|
||||
|
||||
flameShield :: Item
|
||||
flameShield =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnChest
|
||||
& itUse . uequipEffect . eeType .~ GoesOnChest
|
||||
& itType .~ EQUIP FLAMESHIELD
|
||||
|
||||
frontArmour :: Item
|
||||
frontArmour =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnChest
|
||||
& itUse . uequipEffect . eeType .~ GoesOnChest
|
||||
& itType .~ EQUIP FRONTARMOUR
|
||||
|
||||
wristArmour :: Item
|
||||
wristArmour =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeType .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeOnEquip .~ EonWristShield
|
||||
& itUse . uequipEffect . eeUse .~ EWristShield
|
||||
& itUse . uequipEffect . eeOnRemove .~ EoffWristShield
|
||||
@@ -55,7 +55,7 @@ wristArmour =
|
||||
batteryPack :: Item
|
||||
batteryPack =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeType .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeAttachPos .~ V3 (-8) 0 10
|
||||
& itUse . uequipEffect . eeUse .~ EDoNothing
|
||||
& itConsumables
|
||||
@@ -73,7 +73,7 @@ batteryPack =
|
||||
fuelPack :: Item
|
||||
fuelPack =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeType .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||
-- & itUse . uequipEffect . eeUse .~ EFuelSource 10000 10000
|
||||
& itType .~ EQUIP FUELPACK
|
||||
@@ -91,7 +91,7 @@ fuelPack =
|
||||
bulletBeltPack :: Item
|
||||
bulletBeltPack =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeType .~ GoesOnBack
|
||||
& itUse . uequipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||
& itUse . uequipEffect . eeUse .~ EDoNothing
|
||||
& itConsumables
|
||||
@@ -109,7 +109,7 @@ bulletBeltPack =
|
||||
bulletBeltBracer :: Item
|
||||
bulletBeltBracer =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeType .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||
& itUse . uequipEffect . eeUse .~ EDoNothing
|
||||
& itConsumables
|
||||
@@ -127,26 +127,26 @@ bulletBeltBracer =
|
||||
brainHat :: Item
|
||||
brainHat =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnHead
|
||||
& itUse . uequipEffect . eeType .~ GoesOnHead
|
||||
& itType .~ EQUIP BRAINHAT
|
||||
|
||||
hat :: Item
|
||||
hat =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnHead
|
||||
& itUse . uequipEffect . eeType .~ GoesOnHead
|
||||
& itType .~ EQUIP HAT
|
||||
|
||||
headLamp :: Item
|
||||
headLamp =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeUse .~ EHeadLamp
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnHead
|
||||
& itUse . uequipEffect . eeType .~ GoesOnHead
|
||||
& itType .~ EQUIP HEADLAMP
|
||||
|
||||
powerLegs :: Item
|
||||
powerLegs =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnLegs
|
||||
& itUse . uequipEffect . eeType .~ GoesOnLegs
|
||||
& itType .~ EQUIP POWERLEGS
|
||||
|
||||
speedLegs :: Item
|
||||
@@ -158,7 +158,7 @@ jumpLegs = powerLegs & itType .~ EQUIP JUMPLEGS
|
||||
wristInvisibility :: Item
|
||||
wristInvisibility =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeType .~ GoesOnWrist
|
||||
-- & itUse . uequipEffect . eeOnEquip .~ ECamouflage Invisible
|
||||
-- & itUse . uequipEffect . eeOnRemove .~ ECamouflage FullyVisible
|
||||
& itType .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
|
||||
@@ -166,5 +166,5 @@ wristInvisibility =
|
||||
pulseChecker :: Item
|
||||
pulseChecker =
|
||||
defaultEquipment
|
||||
& itUse . uequipEffect . eeSite .~ GoesOnWrist
|
||||
& itUse . uequipEffect . eeType .~ GoesOnWrist
|
||||
& itType .~ EQUIP WRIST_ECG
|
||||
|
||||
@@ -210,9 +210,9 @@ aimStanceInfo as = case as of
|
||||
OneHand -> "It is held in one hand."
|
||||
|
||||
itmEquipSiteInfo :: Item -> String
|
||||
itmEquipSiteInfo = maybe "" equipSiteInfo . (^? itUse . uequipEffect . eeSite)
|
||||
itmEquipSiteInfo = maybe "" equipSiteInfo . (^? itUse . uequipEffect . eeType)
|
||||
|
||||
equipSiteInfo :: EquipSite -> String
|
||||
equipSiteInfo :: EquipType -> String
|
||||
equipSiteInfo es = case es of
|
||||
GoesOnHead -> " on the head"
|
||||
GoesOnChest -> " on the chest"
|
||||
|
||||
@@ -50,7 +50,7 @@ initCrItemLocation cr invid w it = (w & itemLocations . at locid ?~ loc
|
||||
, _ilIsRoot = False
|
||||
, _ilIsSelected = False
|
||||
, _ilIsAttached = False
|
||||
, _ilEquipPosition = Nothing
|
||||
, _ilEquipSite = Nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -239,8 +239,8 @@ drawRBOptions cfig w = fromMaybe mempty $ do
|
||||
guard $ ButtonRight `M.member` _mouseButtons (_input w)
|
||||
invid <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
eslist <-
|
||||
fmap equipSiteToPositions $
|
||||
you w ^? crInv . ix invid . itUse . uequipEffect . eeSite
|
||||
fmap eqSiteToPositions $
|
||||
you w ^? crInv . ix invid . itUse . uequipEffect . eeType
|
||||
i <- w ^? rbOptions . opSel
|
||||
let ae = getEquipmentAllocation w
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
|
||||
@@ -48,8 +48,8 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
||||
where
|
||||
rbscrollmax = fromMaybe 1 $ do
|
||||
invid <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix invid . itUse . uequipEffect . eeSite
|
||||
return $ length $ equipSiteToPositions esite
|
||||
esite <- you w ^? crInv . ix invid . itUse . uequipEffect . eeType
|
||||
return $ length $ eqSiteToPositions esite
|
||||
y = fromIntegral yi
|
||||
numLocs = (fst . IM.findMax $ (w ^. cWorld . lWorld . seenLocations)) + 1
|
||||
bdown b = b `M.member` _mouseButtons (_input w)
|
||||
|
||||
Reference in New Issue
Block a user