Cleanup and fix selection section cursor position bug
This commit is contained in:
@@ -34,23 +34,19 @@ useItemRightClick cr' w = fromMaybe (f w) $ do
|
||||
itemEffect :: Creature -> Item -> World -> World
|
||||
itemEffect cr it w = case it ^. itUse of
|
||||
HeldUse{_heldUse = eff, _heldMods = usemods} ->
|
||||
hammerTest $ foldl' (&) (useHeld eff) (useMod usemods) it cr
|
||||
foldl' (&) (useHeld eff) (useMod usemods) it cr w
|
||||
LeftUse{} -> doequipmentchange
|
||||
EquipUse{} -> doequipmentchange
|
||||
-- ConsumeUse will cause problems if the item is not selected
|
||||
(ConsumeUse eff _) -> setuhamdown $ hammerTest $ useC eff it cr . rmInvItem (_crID cr) itRef
|
||||
CraftUse{} -> setuhamdown w
|
||||
(ConsumeUse eff _) -> useC eff it cr $ rmInvItem (_crID cr) itRef w
|
||||
CraftUse{} -> w
|
||||
where
|
||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
hammerTest f = case _crHammerPosition cr of
|
||||
HammerUp -> f w
|
||||
HammerUp -> f w & setuhamdown
|
||||
_ -> w & setuhamdown
|
||||
setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
doequipmentchange =
|
||||
setuhamdown $
|
||||
hammerTest
|
||||
( toggleEquipmentAt itRef cr
|
||||
)
|
||||
doequipmentchange = hammerTest $ toggleEquipmentAt itRef cr
|
||||
|
||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
|
||||
Reference in New Issue
Block a user