Muzzle pushback direction depends only on wall line

This commit is contained in:
2026-03-30 20:30:18 +01:00
parent c7866cf668
commit d00b4d1c6f
+3 -3
View File
@@ -359,12 +359,12 @@ muzzleWallCheck w cr = fromMaybe cr $ do
if null vs
then cr
else
let v = minimumBy (compare `on` norm) vs
in cr & crPos . _xy +~ normalize v
let (_,wl) = minimumBy (compare `on` norm . fst) vs
in cr & crPos . _xy +~ signorm (vNormal (uncurry (-) (wl ^. wlLine)))
where
f loc = map (muzzlePos loc cr) (itemMuzzles loc)
g cp wls p = case collidePoint cp p wls of
(ep, Just _) -> Just (ep - p)
(ep, Just wl) -> Just (ep - p, wl)
_ -> Nothing
updateCreatureStrides :: World -> World