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
+3 -1
View File
@@ -17,6 +17,7 @@ import Geometry
import LensHelp
import qualified ListHelp as List
import System.Random
import Linear
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
updateBullet w bu
@@ -108,7 +109,8 @@ updateBulVel bt = bt & buVel .*.*~ _buDrag bt
bounceDir :: IM.IntMap Item -> (Point2, Either Creature Wall) -> Maybe Point2
bounceDir _ (_, Right wl) | _wlBouncy wl = Just $ uncurry (-) (_wlLine wl)
bounceDir m (p, Left cr) | crIsArmouredFrom m p cr = Just $ vNormal $ p - _crPos cr
bounceDir m (p, Left cr) | crIsArmouredFrom m p cr
= Just $ vNormal $ p - (cr ^. crPos . _xy)
bounceDir _ _ = Nothing
useBulletPayload :: Bullet -> Point2 -> World -> World