r3843 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Jul 17 02:24:17 EDT 2008
Author: div0
Date: 2008-07-17 02:24:17 -0400 (Thu, 17 Jul 2008)
New Revision: 3843
Modified:
trunk/data/qcsrc/server/cl_impulse.qc
Log:
added cheat "impulse 911": emergency teleport. MOSTLY works. For some reason, DPHITCONTENTS_NODROP or DPHITCONTENTS_SKY is not found by tracebox on space maps.
Modified: trunk/data/qcsrc/server/cl_impulse.qc
===================================================================
--- trunk/data/qcsrc/server/cl_impulse.qc 2008-07-16 20:43:21 UTC (rev 3842)
+++ trunk/data/qcsrc/server/cl_impulse.qc 2008-07-17 06:24:17 UTC (rev 3843)
@@ -260,6 +260,91 @@
CopyBody(0);
self.lip += 1;
}
+ else if (imp == 143) // actually: impulse 911
+ {
+ vector start, end;
+ float i;
+ float m;
+ float good, evil;
+ vector org, delta;
+
+ good = DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP;
+ evil = DPCONTENTS_NODROP | DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER;
+
+ m = self.dphitcontentsmask;
+ self.dphitcontentsmask = good | evil;
+
+ org = world.mins;
+ delta = world.maxs - world.mins;
+
+ for(i = 100; i > 0; --i)
+ {
+ start_x = org_x + random() * delta_x;
+ start_y = org_y + random() * delta_y;
+ start_z = org_z + random() * delta_z;
+
+ // rule 1: start inside world bounds, and outside
+ // solid, and don't start from somewhere where you can
+ // fall down to evil
+ tracebox(start, self.mins, self.maxs, start - '0 0 1' * delta_z, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+ if(trace_startsolid)
+ continue;
+ dprint("hit contents ", ftos(trace_dphitcontents), "\n");
+ if(trace_dphitcontents & evil)
+ continue;
+
+ // rule 2: if we are too high, lower the point
+ if(trace_fraction * delta_z > 1024)
+ start = trace_endpos + '0 0 1024';
+
+ // these can be traceLINES as we already verified the starting box
+ traceline(start, start + '1 0 0' * delta_x, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+ traceline(start, start - '1 0 0' * delta_x, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+ traceline(start, start + '0 1 0' * delta_y, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+ traceline(start, start - '0 1 0' * delta_y, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+ traceline(start, start + '0 0 1' * delta_z, MOVE_NORMAL, self);
+ if(trace_fraction >= 1)
+ continue;
+
+ end_x = org_x + random() * delta_x;
+ end_y = org_y + random() * delta_y;
+ end_z = org_z + random() * delta_z;
+ end = start + normalize(end - start) * 256;
+
+ // rule 3: start TO end must not be too short
+ tracebox(start, self.mins, self.maxs, end, MOVE_NORMAL, self);
+ if(trace_startsolid)
+ continue;
+ if(trace_fraction < 1)
+ continue;
+
+ break;
+ }
+
+ if(i)
+ {
+ self.origin = start;
+ self.angles = vectoangles(end - start);
+ self.angles_x = -self.angles_x;
+ self.fixangle = TRUE;
+ self.velocity = '0 0 0';
+ dprint("Needed ", ftos(101 - i), " attempts\n");
+ }
+ else
+ sprint(self, "Emergency teleport could not find a good location, forget it!\n");
+
+ self.dphitcontentsmask = m;
+ }
}
}
}
More information about the nexuiz-commits
mailing list