Remove creature records

This commit is contained in:
2025-06-06 13:36:18 +01:00
parent 73c79f2f4d
commit 0f55257bff
48 changed files with 621 additions and 610 deletions
+5 -4
View File
@@ -6,6 +6,7 @@ module Dodge.WallCreatureCollisions (
crOnWall,
) where
import Dodge.Creature.Radius
import Control.Lens
import Data.Maybe
import Data.Monoid
@@ -40,7 +41,7 @@ colCrWall w c
. fst
. flip (collidePoint p1) wls -- check push throughs
-- . flip (collidePointWalls' p1) wls -- check push throughs
r = _crRad c + wallBuffer
r = crRad (c ^. crType) + wallBuffer
p1 = _crOldPos c
p2 = _crPos c
ls = _wlLine <$> wls
@@ -52,7 +53,7 @@ wallBuffer :: Float
wallBuffer = 0
pushCreatureOutFromWalls :: [(Point2, Point2)] -> Creature -> Creature
pushCreatureOutFromWalls ls cr = cr & crPos %~ pushOutFromWalls (_crRad cr) ls
pushCreatureOutFromWalls ls cr = cr & crPos %~ pushOutFromWalls (crRad (cr ^. crType)) ls
-- the following tests whether or not a point is on a wall, and if so pushes it
-- out from the wall
@@ -71,7 +72,7 @@ pushOutFromWalls rad wls p1 = case (getFirst . foldMap (First . pushOutFromWall
-- -- possible improvement: choose between the closer of p2 and "p3" to p1
pushOrCrush :: [(Point2, Point2)] -> Creature -> Creature
pushOrCrush wls cr = case mapMaybe (pushOutFromWall (_crRad cr) cpos) wls of
pushOrCrush wls cr = case mapMaybe (pushOutFromWall (crRad (cr ^. crType)) cpos) wls of
[] -> cr
(p : _) -> cr & crPos .~ p
where
@@ -89,7 +90,7 @@ crOnWall cr =
. wlsNearPoint p
where
p = _crPos cr
r = _crRad cr
r = crRad (cr ^. crType)
-- assumes that the wall is orientated
-- assumes wall points are different