]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
When removing sandbox objects, if the object being removed has been selected for...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Dec 2011 20:34:47 +0000 (22:34 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Dec 2011 20:34:47 +0000 (22:34 +0200)
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;        }