[nexuiz-commits] r7896 - in trunk/data/qcsrc/server: . bot
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 25 12:19:09 EDT 2009
Author: div0
Date: 2009-09-25 12:19:08 -0400 (Fri, 25 Sep 2009)
New Revision: 7896
Modified:
trunk/data/qcsrc/server/bot/navigation.qc
trunk/data/qcsrc/server/bot/waypoints.qc
trunk/data/qcsrc/server/constants.qh
trunk/data/qcsrc/server/race.qc
Log:
some bot fixes :(
Modified: trunk/data/qcsrc/server/bot/navigation.qc
===================================================================
--- trunk/data/qcsrc/server/bot/navigation.qc 2009-09-25 13:42:51 UTC (rev 7895)
+++ trunk/data/qcsrc/server/bot/navigation.qc 2009-09-25 16:19:08 UTC (rev 7896)
@@ -332,8 +332,8 @@
local entity waylist, w, best;
local float dist, bestdist;
local vector v, org, pm1, pm2;
- pm1 = ent.origin + PL_MIN;
- pm2 = ent.origin + PL_MAX;
+ pm1 = ent.origin + ent.mins;
+ pm2 = ent.origin + ent.maxs;
waylist = findchain(classname, "waypoint");
// do two scans, because box test is cheaper
@@ -347,7 +347,9 @@
w = w.chain;
}
- org = ent.origin + (ent.mins_z - PL_MIN_z) * '0 0 1';
+ org = ent.origin + 0.5 * (ent.mins + ent.maxs);
+ org_z = ent.origin_z + ent.mins_z - PL_MIN_z; // player height
+ // TODO possibly make other code have the same support for bboxes
if(ent.tag_entity)
org = org + ent.tag_entity.origin;
if (navigation_testtracewalk)
@@ -719,7 +721,11 @@
{
if (time > e.nearestwaypointtimeout)
{
- e.nearestwaypoint = navigation_findnearestwaypoint(e, TRUE);
+ nwp = navigation_findnearestwaypoint(e, TRUE);
+ if(nwp)
+ e.nearestwaypoint = nwp;
+ else
+ print("FAILED to find a nearest waypoint to ", etos(e), "\n");
// TODO: Cleaner solution, probably handling this timeout from ctf.qc
if(e.classname=="item_flag_team")
Modified: trunk/data/qcsrc/server/bot/waypoints.qc
===================================================================
--- trunk/data/qcsrc/server/bot/waypoints.qc 2009-09-25 13:42:51 UTC (rev 7895)
+++ trunk/data/qcsrc/server/bot/waypoints.qc 2009-09-25 16:19:08 UTC (rev 7896)
@@ -765,17 +765,20 @@
return cwp + cwb;
};
+vector waypoint_fixorigin(vector position)
+{
+ tracebox(trace_endpos + '0 0 1' * (-1 - PL_MIN_z), PL_MIN, PL_MAX, trace_endpos + '0 0 -512', MOVE_NOMONSTERS, world);
+ if(trace_fraction < 1)
+ position = trace_endpos;
+ return position;
+}
+
void waypoint_spawnforitem_force(entity e, vector org)
{
local entity w;
// Fix the waypoint altitude if necessary
- traceline(org, org + '0 0 -65535', TRUE, e);
- if(
- org_z - trace_endpos_z > PL_MAX_z - PL_MIN_z + 10 // If middle of entiy is above player heigth
- || org_z - trace_endpos_z < (PL_MAX_z - PL_MIN_z) * 0.5 // or below half player height
- )
- org_z = trace_endpos_z + PL_MAX_z - PL_MIN_z;
+ org = waypoint_fixorigin(org);
// don't spawn an item spawnfunc_waypoint if it already exists
w = findchain(classname, "waypoint");
@@ -832,10 +835,7 @@
// drop the waypoint to a proper location:
// first move it up by a player height
// then move it down to hit the floor with player bbox size
- traceline(position, position + '0 0 1' * (PL_MAX_z - PL_MIN_z), MOVE_NOMONSTERS, world);
- tracebox(trace_endpos, PL_MIN, PL_MAX, trace_endpos + '0 0 -1024', MOVE_NOMONSTERS, world);
- if(trace_fraction < 1)
- position = trace_endpos;
+ position = waypoint_fixorigin(position);
w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
w.nearestwaypoint = world;
Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh 2009-09-25 13:42:51 UTC (rev 7895)
+++ trunk/data/qcsrc/server/constants.qh 2009-09-25 16:19:08 UTC (rev 7896)
@@ -1,5 +1,5 @@
string CVAR_CHECK_DEFAULT = "a806b2ec1a306ab62c20ebb3dd3fb5d2";
-string CVAR_CHECK_BALANCE = "df069a840b96084fe7ea4de2efb12ae5";
+string CVAR_CHECK_BALANCE = "59ee376a58dfcc2e2ee440c6a9508e11";
float FALSE = 0;
float TRUE = 1;
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2009-09-25 13:42:51 UTC (rev 7895)
+++ trunk/data/qcsrc/server/race.qc 2009-09-25 16:19:08 UTC (rev 7896)
@@ -528,6 +528,7 @@
o = (self.absmin + self.absmax) * 0.5;
tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self);
waypoint_spawnforitem_force(self, trace_endpos);
+ self.nearestwaypointtimeout = time + 1000000000;
if(!self.message)
self.message = "went backwards";
More information about the nexuiz-commits
mailing list