From: Mircea Kitsune Date: Sun, 4 Dec 2011 19:38:28 +0000 (+0200) Subject: Also use crosshair_trace_plusvisibletriggers for tracing sandbox objects in the edito... X-Git-Tag: xonotic-v0.6.0~35^2~15^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2085029332635540072947873ca49de5c455cef;p=xonotic%2Fxonotic-data.pk3dir.git Also use crosshair_trace_plusvisibletriggers for tracing sandbox objects in the editor. This gets rid of my ugly hack from earlier, necessary to trace non-solid objects --- diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 555422cc7..012ca7dec 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -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)