Refactor crPos to be a V3

This commit is contained in:
2025-10-10 13:47:31 +01:00
parent 98ece551c7
commit 49fb982877
58 changed files with 375 additions and 307 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ module Dodge.Inventory.Add (
pickUpItemAt,
) where
import Linear
import qualified Data.IntSet as IS
import Control.Lens
import Control.Monad
@@ -61,7 +62,7 @@ createItemYou :: Item -> World -> World
createItemYou itm w = maybe w' snd $ tryPutItemInInv 0 itid w'
where
itid = IM.newKey $ w ^. cWorld . lWorld . items
pos = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
pos = w ^?! cWorld . lWorld . creatures . ix 0 . crPos . _xy
w' = copyItemToFloor pos (itm & itID .~ NInt itid) w
-- the duplication is annoying...
+2 -1
View File
@@ -3,6 +3,7 @@ module Dodge.Inventory.Swap (
swapAnyExtraSelection
) where
import Linear
import NewInt
import Dodge.SoundLogic
import Dodge.Item.Grammar
@@ -71,7 +72,7 @@ checkConnection so s i j w = fromMaybe w $ do
iit <- locs ^? ix i . _2
jit <- locs ^? ix j . _2
guard $ isConnected iit || isConnected jit
return $ soundStart so cpos s Nothing w
return $ soundStart so (cpos ^. _xy) s Nothing w
isConnected :: LocationDT a -> Bool
isConnected x = case x ^. locDtContext of