Merge branch 'ufo-stumble' into 'master'

Non-damaging UFO-player collision

See merge request KartKrew/Kart!1042
This commit is contained in:
toaster 2023-03-16 12:14:04 +00:00
commit 5c4044a943

View file

@ -728,9 +728,31 @@ void Obj_PlayerUFOCollide(mobj_t *ufo, mobj_t *other)
{
// Bump and deal damage.
Obj_SpecialUFODamage(ufo, other, other, DMG_STEAL);
K_KartBouncing(other, ufo);
other->player->sneakertimer = 0;
}
else
{
const angle_t moveAngle = K_MomentumAngle(ufo);
const angle_t clipAngle = R_PointToAngle2(ufo->x, ufo->y, other->x, other->y);
if (other->z > ufo->z + ufo->height)
{
return; // overhead
}
if (other->z + other->height < ufo->z)
{
return; // underneath
}
if (AngleDelta(moveAngle, clipAngle) < ANG60)
{
// in front
K_StumblePlayer(other->player);
}
}
K_KartBouncing(other, ufo);
}
void Obj_UFOPieceThink(mobj_t *piece)
@ -950,4 +972,4 @@ UINT32 K_GetSpecialUFODistance(void)
}
return UINT32_MAX;
}
}