CItemAirBox: Fix flight to the moon! (#697)

* Update item_airbox.cpp

Also reset the velocity on Touch, just to avoid the "invisible" entity to keep moving.
Let the reset on "Restart" too in case of, despite facultative.

Final version: Reset all the axes of the velocity to make the sure the item spawns with a complete null velocity (I did not do that before more in order to take in consideration the possible custom X/Y speed we could give to them, like via plugin, but I finally decided to clean up all, the plugins could still affect it later if needed).
This commit is contained in:
StevenKal 2021-10-28 02:19:09 +02:00 committed by GitHub
parent b9cccc691b
commit 53181d3e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,7 @@ void CItemAirBox::Touch(CBaseEntity *pOther)
pev->nextthink = 0; pev->nextthink = 0;
SetThink(nullptr); SetThink(nullptr);
pev->velocity = g_vecZero;
} }
} }
@ -70,6 +71,12 @@ void CItemAirBox::Restart()
{ {
CArmoury::Restart(); CArmoury::Restart();
UTIL_SetOrigin(pev, pev->oldorigin); UTIL_SetOrigin(pev, pev->oldorigin);
pev->velocity = g_vecZero;
if(m_flyup < 0)
{
m_flyup = -m_flyup;
}
if (m_flyup > 0 && m_delay > 0.01f) if (m_flyup > 0 && m_delay > 0.01f)
{ {