WIP update to latest version of Lua script, halted because script inconsistencies still exist

This commit is contained in:
lachwright 2019-11-06 13:59:53 +08:00
parent 65a0db7b31
commit c9dd2d3b93

View file

@ -49,11 +49,12 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
angle_t ang = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y); angle_t ang = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y);
fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy); fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy);
fixed_t bmom = P_AproxDistance(tails->momx, tails->momy); fixed_t bmom = P_AproxDistance(tails->momx, tails->momy);
fixed_t followmax = 128 * 8 *scale; fixed_t followmax = 128 * 8 * scale; // Max follow distance before AI begins to enter "panic" state
fixed_t followthres = 92 * scale; fixed_t followthres = 92 * scale; // Distance that AI will try to reach
fixed_t followmin = 32 * scale; fixed_t followmin = 32 * scale;
fixed_t comfortheight = 96 * scale; fixed_t comfortheight = 96 * scale;
fixed_t touchdist = 24 * scale; fixed_t touchdist = 24 * scale;
boolean stalled = (bmom < scale >> 1) && dist > followthres; // Helps to see if the AI is having trouble catching up
// We can't follow Sonic if he's not around! // We can't follow Sonic if he's not around!
if (!sonic || sonic->health <= 0) if (!sonic || sonic->health <= 0)
@ -99,7 +100,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
anxiety = 0; anxiety = 0;
panic = false; panic = false;
} }
else if (dist > followmax || zdist > comfortheight) else if (dist > followmax || zdist > comfortheight || stalled)
{ {
anxiety = min(anxiety + 2, 70); anxiety = min(anxiety + 2, 70);
if (anxiety >= 70) if (anxiety >= 70)