Distinguish between selected item and root-selected item
This commit is contained in:
@@ -33,6 +33,7 @@ followImpulses w cr = foldl' (flip f) (id, cr) (reverse $ _apImpulse $ _crAction
|
||||
where
|
||||
f imp (theupdate, cr') = first (. theupdate) $ followImpulse cr' w imp
|
||||
|
||||
-- note SwitchToItem doesn't necessarily update the root item correctly
|
||||
followImpulse :: Creature -> World -> Impulse -> (World -> World, Creature)
|
||||
followImpulse cr w imp = case imp of
|
||||
ImpulseNothing -> (id, cr)
|
||||
@@ -47,7 +48,7 @@ followImpulse cr w imp = case imp of
|
||||
TurnTo p -> crup $ creatureTurnTo p cr
|
||||
ChangePosture post -> crup $ cr & crStance . posture .~ post
|
||||
UseItem -> (useItemRightClick cr, cr)
|
||||
SwitchToItem i -> crup $ cr & crManipulation . manObject .~ InInventory (SelItem i NoInvSelAction)
|
||||
SwitchToItem i -> crup $ cr & crManipulation . manObject .~ InInventory (SelectedItem i i)
|
||||
Melee cid' ->
|
||||
( hitCr cid'
|
||||
, crMvAbsolute (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20
|
||||
|
||||
Reference in New Issue
Block a user