]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/sandbox.qc
When removing sandbox objects, if the object being removed has been selected for...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / sandbox.qc
index e12b98da352b02a1aa95d8446f7f30971d8548bd..66377d1d84aade6398814d045f04926cefdc7d17 100644 (file)
@@ -181,6 +181,14 @@ void sandbox_ObjectRemove(entity e)
 {
        sandbox_ObjectAttach_Remove(e); // detach child objects
 
+       // if the object being removed has been selected for attachment by a player, unset it
+       entity head;
+       FOR_EACH_REALPLAYER(head) // bots can't have objects
+       {
+               if(head.object_attach == e)
+                       head.object_attach = world;
+       }
+
        if(e.material)  {       strunzone(e.material);  e.material = string_null;       }
        if(e.crypto_idfp)       {       strunzone(e.crypto_idfp);       e.crypto_idfp = string_null;    }
        if(e.netname)   {       strunzone(e.netname);   e.netname = string_null;        }