]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clear item waypoints when deleting items to fix issues with dropped powerups
authorMario <mario.mario@y7mail.com>
Wed, 5 Oct 2022 16:08:24 +0000 (16:08 +0000)
committerterencehill <piuntn@gmail.com>
Wed, 5 Oct 2022 16:08:24 +0000 (16:08 +0000)
qcsrc/server/items/items.qc
qcsrc/server/items/items.qh

index 99c0165fd3a1b51061979bf4ff3fb384ab3bcdd2..5758a7fda777d2b2191402661ea3c740f7cb3efc 100644 (file)
@@ -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")
index dff9ccda2356075db87ccae66208428d0f58f00d..f00b7bdc3c2b77b314c75f573d582e5dea3066a4 100644 (file)
@@ -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