Tweak slime wall collisions, all creatures cliff collisions (min 10)
This commit is contained in:
@@ -87,7 +87,7 @@ walkCliffPush :: Creature -> [(Point2,Point2)] -> Point2
|
|||||||
walkCliffPush cr xs = pushAgainst (cr ^. crOldPos . _xy - cr ^. crOldOldPos . _xy) (-h xs)
|
walkCliffPush cr xs = pushAgainst (cr ^. crOldPos . _xy - cr ^. crOldOldPos . _xy) (-h xs)
|
||||||
where
|
where
|
||||||
cxy = cr ^. crPos . _xy
|
cxy = cr ^. crPos . _xy
|
||||||
h = circSegsInside cxy (cr ^. crType . to crRad)
|
h = circSegsInside cxy (min 10 (cr ^. crType . to crRad))
|
||||||
|
|
||||||
groundCliffPush :: Creature -> [(Point2,Point2)] -> Point2
|
groundCliffPush :: Creature -> [(Point2,Point2)] -> Point2
|
||||||
groundCliffPush cr xs = x *^ circSegsInside cxy r xs
|
groundCliffPush cr xs = x *^ circSegsInside cxy r xs
|
||||||
@@ -138,9 +138,14 @@ chasmTestCliffPush f' cr w
|
|||||||
where
|
where
|
||||||
cxy = cr ^. crPos . _xy
|
cxy = cr ^. crPos . _xy
|
||||||
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
||||||
g = uncurry $ crOnSeg cr
|
--g = uncurry $ crOnSeg cr
|
||||||
|
g = uncurry $ crOnSeg' cr
|
||||||
f = pointInPoly cxy
|
f = pointInPoly cxy
|
||||||
|
|
||||||
|
crOnSeg' :: Creature -> Point2 -> Point2 -> Bool
|
||||||
|
{-# INLINE crOnSeg' #-}
|
||||||
|
crOnSeg' cr = circOnSeg (cr ^. crPos . _xy) (min 10 (cr ^. crType . to crRad))
|
||||||
|
|
||||||
chasmRotate :: Creature -> Point2 -> World -> World
|
chasmRotate :: Creature -> Point2 -> World -> World
|
||||||
chasmRotate cr v w
|
chasmRotate cr v w
|
||||||
| t = rotateTo8 (argV v) w
|
| t = rotateTo8 (argV v) w
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ data DebugBool
|
|||||||
| Show_writable_values
|
| Show_writable_values
|
||||||
| Show_mouse_click_pos
|
| Show_mouse_click_pos
|
||||||
| Muzzle_positions
|
| Muzzle_positions
|
||||||
|
| Show_cr_hitboxes
|
||||||
deriving (Eq, Ord, Bounded, Enum, Show)
|
deriving (Eq, Ord, Bounded, Enum, Show)
|
||||||
|
|
||||||
data ResFactor = DoubleRes | FullRes | HalfRes | QuarterRes | EighthRes | SixteenthRes
|
data ResFactor = DoubleRes | FullRes | HalfRes | QuarterRes | EighthRes | SixteenthRes
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Dodge.Debug (debugEvents, drawDebug) where
|
module Dodge.Debug (debugEvents, drawDebug) where
|
||||||
|
|
||||||
|
import Dodge.Creature.Radius
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Dodge.Render.Label
|
import Dodge.Render.Label
|
||||||
import Dodge.HeldUse
|
import Dodge.HeldUse
|
||||||
@@ -81,6 +82,7 @@ debugEvent' = \case
|
|||||||
Debug_get -> id
|
Debug_get -> id
|
||||||
Debug_put -> id
|
Debug_put -> id
|
||||||
Muzzle_positions -> id
|
Muzzle_positions -> id
|
||||||
|
Show_cr_hitboxes -> id
|
||||||
|
|
||||||
debugItem :: DebugBool -> Universe -> Maybe [DebugItem]
|
debugItem :: DebugBool -> Universe -> Maybe [DebugItem]
|
||||||
debugItem = \case
|
debugItem = \case
|
||||||
@@ -117,6 +119,7 @@ debugItem = \case
|
|||||||
Debug_get -> doDebugGet
|
Debug_get -> doDebugGet
|
||||||
Debug_put -> debugPutItems
|
Debug_put -> debugPutItems
|
||||||
Muzzle_positions -> mempty
|
Muzzle_positions -> mempty
|
||||||
|
Show_cr_hitboxes -> mempty
|
||||||
|
|
||||||
debugGet :: Universe -> [String]
|
debugGet :: Universe -> [String]
|
||||||
debugGet u = foldMap getPretty $ u ^. uvWorld . cWorld . lWorld . shockwaves
|
debugGet u = foldMap getPretty $ u ^. uvWorld . cWorld . lWorld . shockwaves
|
||||||
@@ -287,7 +290,13 @@ drawDebug u = \case
|
|||||||
Show_writable_values -> mempty
|
Show_writable_values -> mempty
|
||||||
Show_mouse_click_pos -> mempty
|
Show_mouse_click_pos -> mempty
|
||||||
Muzzle_positions -> showMuzzlePositions u
|
Muzzle_positions -> showMuzzlePositions u
|
||||||
|
Show_cr_hitboxes -> foldMap drawCreatureRad (u ^. uvWorld . cWorld . lWorld . creatures)
|
||||||
|
|
||||||
|
drawCreatureRad :: Creature -> Picture
|
||||||
|
drawCreatureRad cr = setLayer DebugLayer
|
||||||
|
. translate3 (cr ^. crPos)
|
||||||
|
. color orange
|
||||||
|
$ circle (crRad (cr ^. crType))
|
||||||
|
|
||||||
showMuzzlePositions :: Universe -> Picture
|
showMuzzlePositions :: Universe -> Picture
|
||||||
showMuzzlePositions u = fold $ do
|
showMuzzlePositions u = fold $ do
|
||||||
|
|||||||
@@ -377,7 +377,9 @@ chasmSpitTerminal = do
|
|||||||
return $
|
return $
|
||||||
tToBTree "chasmTerm" $
|
tToBTree "chasmTerm" $
|
||||||
Node
|
Node
|
||||||
(addDoorToggleTerminal' i1 (PS 150 0) y')
|
(addDoorToggleTerminal' i1 (PS 150 0) y'
|
||||||
|
& rmPmnts .:~ (sps0 (PutCrit slimeCrit) & plSpot . psPos .~ V2 150 100)
|
||||||
|
)
|
||||||
[ treePost [triggerDoorRoom i1, deadEndPSType cr]
|
[ treePost [triggerDoorRoom i1, deadEndPSType cr]
|
||||||
, treePost [triggerDoorRoom i1, deadEndPSType cr]
|
, treePost [triggerDoorRoom i1, deadEndPSType cr]
|
||||||
, return $ cleatOnward $ triggerDoorRoom i1
|
, return $ cleatOnward $ triggerDoorRoom i1
|
||||||
|
|||||||
+5
-3
@@ -283,7 +283,7 @@ functionalUpdate =
|
|||||||
. over uvWorld updateDistortions
|
. over uvWorld updateDistortions
|
||||||
. over uvWorld updateCreatureSoundPositions
|
. over uvWorld updateCreatureSoundPositions
|
||||||
. over uvWorld updateCreatureStrides
|
. over uvWorld updateCreatureStrides
|
||||||
. over uvWorld pushYouOutFromWalls
|
. pushYouOutFromWalls
|
||||||
. colCrsWalls
|
. colCrsWalls
|
||||||
. over uvWorld simpleCrSprings
|
. over uvWorld simpleCrSprings
|
||||||
. over uvWorld updateDoors
|
. over uvWorld updateDoors
|
||||||
@@ -342,8 +342,10 @@ functionalUpdate =
|
|||||||
. updateAimPos
|
. updateAimPos
|
||||||
. over uvWorld updatePastWorlds -- it might be possible to do this without storing stuff such as the temporary lights/flares etc
|
. over uvWorld updatePastWorlds -- it might be possible to do this without storing stuff such as the temporary lights/flares etc
|
||||||
|
|
||||||
pushYouOutFromWalls :: World -> World
|
pushYouOutFromWalls :: Universe -> Universe
|
||||||
pushYouOutFromWalls w = w & cWorld . lWorld . creatures . ix 0 %~ muzzleWallCheck w
|
pushYouOutFromWalls u
|
||||||
|
| debugOn Noclip (u ^. uvConfig) = u
|
||||||
|
| otherwise = u & uvWorld . cWorld . lWorld . creatures . ix 0 %~ muzzleWallCheck (u ^. uvWorld)
|
||||||
|
|
||||||
-- rotate creature as well? behaviour on ledges?
|
-- rotate creature as well? behaviour on ledges?
|
||||||
muzzleWallCheck :: World -> Creature -> Creature
|
muzzleWallCheck :: World -> Creature -> Creature
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ colCrWall w c = cornpush . wallpush $ pushthrough c
|
|||||||
cornpush = crPos . _xy %~ pushOutFromCorners r ls'
|
cornpush = crPos . _xy %~ pushOutFromCorners r ls'
|
||||||
wallpush = pushCr (w ^. cWorld . lWorld) wls
|
wallpush = pushCr (w ^. cWorld . lWorld) wls
|
||||||
pushthrough = crPos . _xy %~ fst . flip (collidePoint p1) wls -- check push throughs
|
pushthrough = crPos . _xy %~ fst . flip (collidePoint p1) wls -- check push throughs
|
||||||
r = crRad (c ^. crType) + wallBuffer
|
r | SlimeCrit {} <- c ^. crType = min 10 . crRad $ c ^. crType
|
||||||
|
| otherwise = crRad $ c ^. crType
|
||||||
p1 = c ^. crOldPos . _xy
|
p1 = c ^. crOldPos . _xy
|
||||||
p2 = c ^. crPos . _xy
|
p2 = c ^. crPos . _xy
|
||||||
ls = _wlLine <$> IM.elems wls
|
ls = _wlLine <$> IM.elems wls
|
||||||
@@ -60,7 +61,8 @@ pushCr w wls cr
|
|||||||
ap = cr ^. crOldPos . _xy
|
ap = cr ^. crOldPos . _xy
|
||||||
-- sp = cr ^. crPos . _xy
|
-- sp = cr ^. crPos . _xy
|
||||||
ecr = foldl' f (cr & crWallTouch .~ mempty) wls
|
ecr = foldl' f (cr & crWallTouch .~ mempty) wls
|
||||||
r = crRad (cr ^. crType)
|
r | SlimeCrit {} <- cr ^. crType = min 10 . crRad $ cr ^. crType
|
||||||
|
| otherwise = crRad $ cr ^. crType
|
||||||
f acr wl = case pushOutFromWall' r (acr ^. crPos . _xy) (wl ^. wlLine) of
|
f acr wl = case pushOutFromWall' r (acr ^. crPos . _xy) (wl ^. wlLine) of
|
||||||
Just (p,hitp) -> acr & crPos . _xy .~ p & crWallTouch . at (wl ^. wlID) ?~ hitp
|
Just (p,hitp) -> acr & crPos . _xy .~ p & crWallTouch . at (wl ^. wlID) ?~ hitp
|
||||||
Nothing -> acr
|
Nothing -> acr
|
||||||
@@ -95,10 +97,6 @@ wlWlCrush' w p w1 w2 = (t w1 w2 || t w2 w1) -- test either wall is moving toward
|
|||||||
(wallMovement w p x - wallMovement w p y) > 0
|
(wallMovement w p x - wallMovement w p y) > 0
|
||||||
f = normalizeV . uncurry (-) . (^. wlLine)
|
f = normalizeV . uncurry (-) . (^. wlLine)
|
||||||
|
|
||||||
-- the amount to push creatures out from walls, extra to their radius
|
|
||||||
wallBuffer :: Float
|
|
||||||
wallBuffer = 0
|
|
||||||
|
|
||||||
---- assumes that the wall is orientated
|
---- assumes that the wall is orientated
|
||||||
---- assumes wall points are different
|
---- assumes wall points are different
|
||||||
--pushOutFromWall :: Float -> Point2 -> (Point2, Point2) -> Maybe Point2
|
--pushOutFromWall :: Float -> Point2 -> (Point2, Point2) -> Maybe Point2
|
||||||
|
|||||||
Reference in New Issue
Block a user