Allow dropping items by dragging off inventory
This commit is contained in:
@@ -14,7 +14,7 @@ module Dodge.Creature.Action (
|
||||
sizeSelf,
|
||||
youDropItem,
|
||||
pickUpItem,
|
||||
-- pickUpItemID,
|
||||
-- pickUpItemID,
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
@@ -174,9 +174,12 @@ dropExcept cr invid w =
|
||||
foldr (dropItem cr) w . IM.keys $
|
||||
invid `IM.delete` _crInv cr
|
||||
|
||||
-- why not a cid (Int)?
|
||||
dropItem :: Creature -> Int -> World -> World
|
||||
dropItem cr invid = rmInvItem (_crID cr) invid .
|
||||
copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
|
||||
dropItem cr invid =
|
||||
rmInvItem (_crID cr) invid
|
||||
. copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
|
||||
. soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
where
|
||||
itm = fromMaybe (error "dropItem cannot find item") $ cr ^? crInv . ix invid
|
||||
|
||||
@@ -190,8 +193,9 @@ youDropItem w = fromMaybe w $ do
|
||||
return $
|
||||
w
|
||||
& dropItem cr curpos
|
||||
& soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
where
|
||||
-- & soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
|
||||
cr = you w
|
||||
|
||||
sizeSelf :: Float -> Creature -> World -> Maybe World
|
||||
@@ -216,4 +220,3 @@ sizeSelf x cr w
|
||||
raddist = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR)
|
||||
cid = _crID cr
|
||||
cpos = _crPos cr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user