From: Mircea Kitsune Date: Sun, 4 Dec 2011 16:06:24 +0000 (+0200) Subject: Now put my hack in place, making it possible to trace and edit non-solid objects. X-Git-Tag: xonotic-v0.6.0~35^2~15^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eaa40d816f5655ef07274668c95d84b318227b27;p=xonotic%2Fxonotic-data.pk3dir.git Now put my hack in place, making it possible to trace and edit non-solid objects. --- diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 5312d8897..142ac199d 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -58,14 +58,27 @@ void sandbox_ObjectFunction_Think() self.nextthink = time; } +.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 // attached objects are SOLID_NOT and don't risk getting traced + entity head; + // 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. + for(head = world; (head = find(head, classname, "object")); ) + { + 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")); ) + { + head.solid = head.old_solid; + } if(trace_ent.classname != "object") return world; // entity is not an object @@ -89,7 +102,6 @@ void sandbox_ObjectEdit_Scale(entity e, float f) } } -.float old_solid, old_movetype; void sandbox_ObjectAttach_Remove(entity e); void sandbox_ObjectAttach_Set(entity e, entity parent, string s) {