Make combine and tweak menus servicable
This commit is contained in:
@@ -38,20 +38,13 @@ itemEffect cr it w = case it ^? itUse of
|
||||
|
||||
--this is ugly
|
||||
useLeftItem :: Int -> World -> World
|
||||
useLeftItem cid w = case _crInv cr IM.! crinvsel ^? itUse . lUse of
|
||||
useLeftItem cid w = case cr ^? crInv . ix crinvsel . itUse . lUse of
|
||||
Just f -> f cr crinvsel (w & creatures . ix cid . crLeftInvSel ?~ crinvsel)
|
||||
Nothing -> case _crLeftInvSel cr of
|
||||
Just invid -> case _itUse $ _crInv cr IM.! invid of
|
||||
LeftUse {_lUse = f} -> f cr invid w
|
||||
_ -> w & creatures . ix cid . crLeftInvSel .~ Nothing
|
||||
Nothing -> w
|
||||
-- Nothing -> case luse of
|
||||
-- Nothing -> w
|
||||
-- Just (invid, f) -> f cr invid w & creatures . ix cid . crLeftInvSel ?~ invid
|
||||
where
|
||||
crinvsel = _crInvSel cr
|
||||
cr = _creatures w IM.! cid
|
||||
-- luses = IM.mapMaybe (^? itUse . lUse) (_crInv cr)
|
||||
-- luse = listToMaybe $ IM.toList luses
|
||||
--the old code automatically selected the first unused item in the list: not
|
||||
--sure if I want this behaviour, can probably set it as an option later
|
||||
|
||||
@@ -166,7 +166,6 @@ arms cr
|
||||
Just (Walking sa RightForward) -> waistSH $ translateSHf (-f sa) off aHand
|
||||
_ -> emptySH
|
||||
where
|
||||
--crIt = _crInv cr IM.! _crInvSel cr
|
||||
aHand :: Shape
|
||||
aHand = translateSHz (-4) . upperPrismPolyHalf 4 $ polyCirc 3 4
|
||||
off = 8
|
||||
@@ -182,20 +181,18 @@ scalp cr
|
||||
where
|
||||
fhead = colorSH (greyN 0.9) . upperPrismPolyHalf 5 $ polyCirc 4 5
|
||||
|
||||
crInStance :: AimStance -> Creature -> Bool
|
||||
crInStance as cr = crIsAiming' cr
|
||||
&& cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimStance == Just as
|
||||
|
||||
oneH :: Creature -> Bool
|
||||
oneH cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just OneHand
|
||||
where
|
||||
crIt = _crInv cr IM.! _crInvSel cr
|
||||
oneH = crInStance OneHand
|
||||
|
||||
twoFlat :: Creature -> Bool
|
||||
twoFlat cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just TwoHandFlat
|
||||
where
|
||||
crIt = _crInv cr IM.! _crInvSel cr
|
||||
twoFlat = crInStance TwoHandFlat
|
||||
|
||||
twists :: Creature -> Bool
|
||||
twists cr = crIsAiming' cr && crIt ^? itUse . useAim . aimStance == Just TwoHandTwist
|
||||
where
|
||||
crIt = _crInv cr IM.! _crInvSel cr
|
||||
twists = crInStance TwoHandTwist
|
||||
|
||||
torso :: Creature -> Shape
|
||||
{-# INLINE torso #-}
|
||||
@@ -244,9 +241,7 @@ light4 = light . light . light . light
|
||||
-- where
|
||||
-- setPos = translate 0 (_crRad cr)
|
||||
|
||||
drawEquipment
|
||||
:: Creature
|
||||
-> SPic
|
||||
drawEquipment :: Creature -> SPic
|
||||
{-# INLINE drawEquipment #-}
|
||||
drawEquipment cr = mconcat $ map f $ IM.toList (_crInv cr)
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user