Move towards unifying (your) creature manipulation with selection

This commit is contained in:
2026-05-14 13:42:33 +01:00
parent ab393febcb
commit 59d128f87a
35 changed files with 271 additions and 252 deletions
+3 -2
View File
@@ -350,7 +350,8 @@ pushYouOutFromWalls u
-- rotate creature as well? behaviour on ledges?
muzzleWallCheck :: World -> Creature -> Creature
muzzleWallCheck w cr = fromMaybe cr $ do
invid <- cr ^? crManipulation . manObject . imRootSelectedItem . unNInt
invid <- w ^? hud . manObject . imRootSelectedItem . unNInt
--revise1 invid <- cr ^? crManipulation . manObject . imRootSelectedItem . unNInt
loc <-
invIndents ((\k -> w ^?! cWorld . lWorld . items . ix k) <$> _crInv cr)
^? ix invid . _2
@@ -368,7 +369,7 @@ muzzleWallCheck w cr = fromMaybe cr $ do
x = dotV v' v
in cr & crPos . _xy +~ min 1 x *^ v'
where
f loc = map (muzzlePos loc cr) (itemMuzzles loc)
f loc = map (muzzlePos w loc cr) (itemMuzzles loc)
g cp wls p = case collidePoint cp p wls of
(ep, Just wl) -> Just (ep - p, wl)
_ -> Nothing