]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Detach objects at exactly the same origin, not the origin of the parent. Angles howev...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 29 Oct 2011 13:16:59 +0000 (16:16 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 29 Oct 2011 13:16:59 +0000 (16:16 +0300)
qcsrc/server/mutators/sandbox.qc

index 7de8f4cb053cbee05b02deef4eb03984d5d20db3..8f595c059fd5990e02bd802fdd55b530b83b2bb4 100644 (file)
@@ -85,16 +85,18 @@ void sandbox_ObjectAttach_Remove(entity e)
        {
                if(head.owner == e)
                {
+                       vector org;
                        head.movetype = MOVETYPE_TOSS; // default
                        head.solid = SOLID_BBOX;
                        head.takedamage = DAMAGE_AIM;
 
+                       org = gettaginfo(head, 0);
                        setattachment(head, world, "");
                        head.owner = world;
 
-                       // objects reset origin and angles when detached, so apply the parent's to prevent teleporting
-                       setorigin(head, e.origin);
-                       head.angles = e.angles;
+                       // objects change origin and angles when detached, so apply previous position
+                       setorigin(head, org);
+                       head.angles = e.angles; // don't allow detached objects to spin or roll
                }
        }
 }