Fix bugs in item locations

This commit is contained in:
2024-09-23 13:12:09 +01:00
parent 4f6431968c
commit 5262355368
10 changed files with 133 additions and 175 deletions
+21 -2
View File
@@ -20,8 +20,27 @@ import Dodge.Data.Universe
import qualified IntMapHelp as IM
testStringInit :: Universe -> [String]
testStringInit u = map show $
(IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <> IM.toList ( fmap _itLocation (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crInv))
testStringInit u = (topTestPart u
<>) $ map showh $
(IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <> ( IM.elems $ fmap h (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crInv))
where
h itm = (_itID itm, _itLocation itm)
showh (x,(InInv a b c d)) = show x ++ "," ++ show a ++ "," ++ show b ++"," ++ show c ++"," ++ show d
showh _ = ""
topTestPart :: Universe -> [String]
topTestPart u = [show $ u ^? uvWorld . hud . hudElement . diSections . sssExtra . sssSelPos
, maybe "" showManObj $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
]
showManObj :: ManipulatedObject -> String
showManObj (InInventory SortInventory) = "SortInventory"
showManObj (InInventory (SelectedItem x y)) = "SelItem: "++ show x++ " Root: "++show y
showManObj (SelNothing) = "SelNothing"
showManObj ((InNearby SortNearby)) = "SortNearby"
showManObj (InNearby (SelCloseObject x)) = "Close " ++ show x
--testStringInit u = fromMaybe mempty $ do
-- inv <- fmap invLDT $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crInv
-- invitm <- inv ^? ix 1