]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/reset_clear_item_waypoints' into 'master'
authorterencehill <piuntn@gmail.com>
Wed, 5 Oct 2022 16:08:25 +0000 (16:08 +0000)
committerterencehill <piuntn@gmail.com>
Wed, 5 Oct 2022 16:08:25 +0000 (16:08 +0000)
Clear item waypoints when deleting items to fix issues with dropped powerups

Closes #2735 and #2721

See merge request xonotic/xonotic-data.pk3dir!1070

qcsrc/server/items/items.qc
qcsrc/server/items/items.qh

index 89532a790efc8af3e7af5f2b968d8f7fb94d8db0..6a19a435f2a502c05d0e6c8ed39ca7565c3a3601 100644 (file)
@@ -634,7 +634,7 @@ void Item_Touch(entity this, entity toucher)
        {
                if (ITEM_TOUCH_NEEDKILL())
                {
-                       delete(this);
+                       RemoveItem(this);
                        return;
                }
        }
@@ -786,6 +786,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);
 }
@@ -983,7 +985,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