From: Mario Date: Wed, 5 Oct 2022 16:08:24 +0000 (+0000) Subject: Clear item waypoints when deleting items to fix issues with dropped powerups X-Git-Tag: xonotic-v0.8.6~337^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f9dc653e4d6d6785cb1467667894f0babfbb084;p=xonotic%2Fxonotic-data.pk3dir.git Clear item waypoints when deleting items to fix issues with dropped powerups --- 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