Make examine inventory controlled by item, perhaps still buggy

This commit is contained in:
2025-01-01 21:14:38 +00:00
parent 86aba6d115
commit 5b978d9f1c
25 changed files with 523 additions and 502 deletions
+7 -7
View File
@@ -3,9 +3,7 @@
-- | Actions performed by creatures within the world
module Dodge.Creature.Action (
performActions,
-- stripNoItems,
setMinInvSize,
-- dropUnselected,
dropExcept,
dropItem,
blinkActionMousePos,
@@ -13,12 +11,9 @@ module Dodge.Creature.Action (
unsafeBlinkAction,
sizeSelf,
youDropItem,
-- pickUpItem,
) where
import Control.Applicative
--import Data.List (findIndex)
import Control.Monad
import Data.Bifunctor
import Data.Maybe
@@ -31,6 +26,7 @@ import Dodge.Default
import Dodge.FloatFunction
import Dodge.FloorItem
import Dodge.Inventory
import Dodge.ItEffect
--import Dodge.Inventory.Add
import Dodge.Path
import Dodge.SoundLogic
@@ -176,11 +172,15 @@ dropExcept cr invid w =
-- why not a cid (Int)?
dropItem :: Creature -> Int -> World -> World
dropItem cr invid =
maybeshiftseldown
. rmInvItem (_crID cr) invid
doanyitemdropeffect
. maybeshiftseldown
. rmInvItem (_crID cr) invid
. copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
. soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
where
doanyitemdropeffect = fromMaybe id $ do
rmf <- itm ^? itEffect . ieOnDrop
return $ doInvEffect rmf itm cr
itm = fromMaybe (error "dropItem cannot find item") $ cr ^? crInv . ix invid
maybeshiftseldown w = fromMaybe w $ do
3 <- w ^? hud . hudElement . diSelection . _Just . _1