Improve item location code

This commit is contained in:
2024-09-22 14:29:02 +01:00
parent 236f7c7750
commit 4f6431968c
25 changed files with 218 additions and 186 deletions
+1 -11
View File
@@ -15,7 +15,7 @@ module Dodge.Creature.Action (
copyInvItemToFloor,
youDropItem,
pickUpItem,
pickUpItemID,
-- pickUpItemID,
) where
import Control.Applicative
@@ -210,8 +210,6 @@ copyInvItemToFloor :: Creature -> Int -> World -> World
copyInvItemToFloor cr i =
copyItemToFloor (_crPos cr) $
_crInv cr IM.! i
& itIsSelected .~ False
& itIsRoot .~ False
sizeSelf :: Float -> Creature -> World -> Maybe World
sizeSelf x cr w
@@ -236,11 +234,3 @@ sizeSelf x cr w
cid = _crID cr
cpos = _crPos cr
pickUpItemID :: Int -> Int -> World -> World
pickUpItemID cid flid w = pickUpItem cid (w ^?! cWorld . lWorld . floorItems . ix flid) w
-- | Pick up a specific item.
pickUpItem :: Int -> FloorItem -> World -> World
pickUpItem cid flit w =
maybe w (soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing . snd) $
tryPutItemInInv cid flit w