From 53181d3e9b453530d78ba8fb2a6b5b3158b59dd6 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Thu, 28 Oct 2021 02:19:09 +0200 Subject: [PATCH] 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). --- regamedll/dlls/addons/item_airbox.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/regamedll/dlls/addons/item_airbox.cpp b/regamedll/dlls/addons/item_airbox.cpp index a3637ea9..a42f91a7 100644 --- a/regamedll/dlls/addons/item_airbox.cpp +++ b/regamedll/dlls/addons/item_airbox.cpp @@ -63,6 +63,7 @@ void CItemAirBox::Touch(CBaseEntity *pOther) pev->nextthink = 0; SetThink(nullptr); + pev->velocity = g_vecZero; } } @@ -70,6 +71,12 @@ void CItemAirBox::Restart() { CArmoury::Restart(); 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) {