]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Also use crosshair_trace_plusvisibletriggers for tracing sandbox objects in the edito...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Dec 2011 19:38:28 +0000 (21:38 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Dec 2011 19:38:28 +0000 (21:38 +0200)
qcsrc/server/mutators/sandbox.qc

index 555422cc714ab67b5c051b4d1c8d340c3c0694dd..012ca7dec778f6129607eec008d019f0d8c101f8 100644 (file)
@@ -61,32 +61,15 @@ void sandbox_ObjectFunction_Think()
 .float old_solid, old_movetype;
 entity sandbox_ObjectEdit_Get(float permissions)
 {
-       // returns the traced entity if the player can edit it, and world if not
-       // if permissions if FALSE, the object is returned regardless of editing rights
-
-       // Tracing does not work for entities that use SOLID_NOT or SOLID_TRIGGER. Therefore, make all
-       // objects temporarily solid while doing the trace, then revert them to their initial solidity.
-       entity head;
-       for(head = world; (head = find(head, classname, "object")); )
-       {
-               if(head.owner == world) // skip attached objects
-               {
-                       head.old_solid = head.solid;
-                       head.solid = SOLID_BBOX;
-               }
-       }
-       makevectors(self.v_angle);
-       WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_edit, MOVE_NORMAL, self);
-       for(head = world; (head = find(head, classname, "object")); )
-       {
-               if(head.owner == world) // skip attached objects
-                       head.solid = head.old_solid;
-       }
+       // Returns the traced entity if the player can edit it, and world if not.
+       // If permissions if FALSE, the object is returned regardless of editing rights.
+       // Attached objects are SOLID_NOT and do not get traced.
 
+       crosshair_trace_plusvisibletriggers(self);
+       if(vlen(self.origin - trace_ent.origin) > autocvar_g_sandbox_editor_distance_edit)
+               return world; // out of trace range
        if(trace_ent.classname != "object")
                return world; // entity is not an object
-       if(trace_ent.owner != world)
-               return world; // entity is an attached object
        if(!permissions)
                return trace_ent; // don't check permissions, anyone can edit this object
        if(!trace_ent.crypto_idfp)