Tweak corpse/chasm interaction
This commit is contained in:
@@ -168,16 +168,30 @@ chasmTestCorpse cr w
|
||||
w
|
||||
& tocr . crZVel -~ 0.5
|
||||
& tocr . crPos . _z +~ _crZVel cr
|
||||
| Just (x, y) <- List.find g (w ^. cWorld . cliffs) =
|
||||
-- only look for TWO cliffs to push along
|
||||
| (xy:xys) <- filter g (w ^. cWorld . cliffs) =
|
||||
w
|
||||
& soundContinue (CrChasm (_crID cr)) (cr ^. crPos . _xy) debrisS (Just 100)
|
||||
& tocr . crPos . _xy +~ normalizeV (vNormal (x - y))
|
||||
& tocr . crPos . _xy +~ h xy xys
|
||||
| any f (w ^. cWorld . chasms) = w & tocr . crZVel -~ 0.5
|
||||
| otherwise = w
|
||||
where
|
||||
|
||||
h :: (Point2,Point2) -> [(Point2,Point2)] -> Point2
|
||||
h (x,y) [] = normalizeV (vNormal (x-y))
|
||||
h x (y:_) = unitVectorAtAngle $ tweenAngles (d1/(d1+d2)) (h' x) (h' y)
|
||||
where
|
||||
h' :: (Point2,Point2) -> Float
|
||||
h' = argV . vNormal . uncurry (-)
|
||||
d a = uncurry closestPointOnLine a (cr ^. crPos . _xy)
|
||||
d1 :: Float
|
||||
d1 = norm (cxy - d x)
|
||||
d2 :: Float
|
||||
d2 = norm (cxy - d y)
|
||||
cxy = cr ^. crPos . _xy
|
||||
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
||||
g = uncurry $ circOnSeg (cr ^. crPos . _xy) (crRad $ cr ^. crType)
|
||||
f = pointInPoly (cr ^. crPos . _xy)
|
||||
g = uncurry $ circOnSeg cxy (crRad $ cr ^. crType)
|
||||
f = pointInPoly cxy
|
||||
|
||||
chasmRotate :: Creature -> Point2 -> World -> World
|
||||
chasmRotate cr v w
|
||||
|
||||
Reference in New Issue
Block a user