From d2085029332635540072947873ca49de5c455cef Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sun, 4 Dec 2011 21:38:28 +0200 Subject: [PATCH] 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 --- qcsrc/server/mutators/sandbox.qc | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) 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) -- 2.39.2