From 4f9dc653e4d6d6785cb1467667894f0babfbb084 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 5 Oct 2022 16:08:24 +0000 Subject: [PATCH] Clear item waypoints when deleting items to fix issues with dropped powerups --- qcsrc/server/items/items.qc | 6 ++++-- qcsrc/server/items/items.qh | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 99c0165fd..5758a7fda 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -635,7 +635,7 @@ void Item_Touch(entity this, entity toucher) { if (ITEM_TOUCH_NEEDKILL()) { - delete(this); + RemoveItem(this); return; } } @@ -787,6 +787,8 @@ void Item_FindTeam(entity this) void RemoveItem(entity this) { if(wasfreed(this) || !this) { return; } + if(this.waypointsprite_attached) + WaypointSprite_Kill(this.waypointsprite_attached); Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1); delete(this); } @@ -977,7 +979,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default if (Item_IsLoot(this)) { - this.reset = SUB_Remove; + this.reset = RemoveItem; set_movetype(this, MOVETYPE_TOSS); // Savage: remove thrown items after a certain period of time ("garbage collection") diff --git a/qcsrc/server/items/items.qh b/qcsrc/server/items/items.qh index dff9ccda2..f00b7bdc3 100644 --- a/qcsrc/server/items/items.qh +++ b/qcsrc/server/items/items.qh @@ -74,13 +74,14 @@ void Item_Touch(entity this, entity toucher); void Item_Reset(entity this); void Item_FindTeam(entity this); -// Savage: used for item garbage-collection bool ItemSend(entity this, entity to, int sf); void ItemUpdate(entity this); void UpdateItemAfterTeleport(entity this); +void RemoveItem(entity this); + // pickup evaluation functions // these functions decide how desirable an item is to the bots -- 2.39.2