[nexuiz-commits] r6830 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun May 31 13:25:40 EDT 2009
Author: mand1nga
Date: 2009-05-31 13:25:40 -0400 (Sun, 31 May 2009)
New Revision: 6830
Modified:
trunk/data/qcsrc/server/bots.qc
trunk/data/qcsrc/server/havocbot_roles.qc
Log:
Added teamcount() function, will be used to improve the ctf ai
Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc 2009-05-31 17:10:57 UTC (rev 6829)
+++ trunk/data/qcsrc/server/bots.qc 2009-05-31 17:25:40 UTC (rev 6830)
@@ -218,10 +218,22 @@
}
else
{
- #ifdef DEBUG_TRACEWALK
- debugnodestatus(trace_endpos, DEBUG_NODE_FAIL);
- #endif
- return FALSE; // failed
+ // Check if we can jump over the obstacle
+ local vector jumpheight;
+ // this is an estimate, a proper calculation should involve the cvars sv_jumpvelocity and sv_gravity
+ jumpheight = (PL_VIEW_OFS_z + PL_MIN_z) * '0 0 1';
+ tracebox(org + jumpheight, m1, m2, move + jumpheight, movemode, e);
+
+ if (trace_fraction < 1)
+ {
+ #ifdef DEBUG_TRACEWALK
+ debugnodestatus(trace_endpos, DEBUG_NODE_FAIL);
+ #endif
+ return FALSE; // failed
+ }
+ // Here we will avoid the trace down because we jumped
+ org = trace_endpos;
+ continue;
}
}
else
Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc 2009-05-31 17:10:57 UTC (rev 6829)
+++ trunk/data/qcsrc/server/havocbot_roles.qc 2009-05-31 17:25:40 UTC (rev 6830)
@@ -4,11 +4,6 @@
.void() havocbot_role;
float bot_ignore_bots;
-float canreach(entity e)
-{
- return vlen(self.origin - e.origin) < 1500;
-}
-
.float max_armorvalue;
float havocbot_pickupevalfunc(entity item)
{
@@ -307,7 +302,28 @@
}
};
+// Functions for CTF
+float canreach(entity e)
+{
+ return vlen(self.origin - e.origin) < 1500;
+}
+
+float teamcount()
+{
+ if not(teams_matter)
+ return 0;
+
+ float c;
+ entity head;
+
+ FOR_EACH_PLAYER(head)
+ if(head.team==self.team)
+ ++c;
+
+ return c;
+}
+
void() havocbot_role_ctf_middle;
void() havocbot_role_ctf_defense;
void() havocbot_role_ctf_offense;
More information about the nexuiz-commits
mailing list