From c43366d84b411525517bc684d6be01c86cb77b3b Mon Sep 17 00:00:00 2001 From: mand1nga Date: Tue, 16 Aug 2011 03:15:38 -0300 Subject: [PATCH] Many minor improvements --- qcsrc/server/assault.qc | 2 - qcsrc/server/bot/havocbot/role_assault.qc | 123 ++++++++++++++++++++-- qcsrc/server/func_breakable.qc | 2 + 3 files changed, 119 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/assault.qc b/qcsrc/server/assault.qc index 77d7d36fc..517da8168 100644 --- a/qcsrc/server/assault.qc +++ b/qcsrc/server/assault.qc @@ -208,8 +208,6 @@ void spawnfunc_func_assault_destructible() { } self.spawnflags = 3; self.classname = "func_assault_destructible"; - self.takedamage = TRUE; - self.bot_attack = TRUE; if(assault_attacker_team == COLOR_TEAM1) { self.team = COLOR_TEAM2; } else { diff --git a/qcsrc/server/bot/havocbot/role_assault.qc b/qcsrc/server/bot/havocbot/role_assault.qc index edb4995be..e662a3500 100644 --- a/qcsrc/server/bot/havocbot/role_assault.qc +++ b/qcsrc/server/bot/havocbot/role_assault.qc @@ -1,6 +1,6 @@ #define HAVOCBOT_AST_ROLE_NONE 0 #define HAVOCBOT_AST_ROLE_DEFENSE 2 -#define HAVOCBOT_AST_ROLE_OFFENSE 8 +#define HAVOCBOT_AST_ROLE_OFFENSE 4 .float havocbot_role_flags; .float havocbot_attack_time; @@ -12,11 +12,117 @@ void() havocbot_role_ast_defense; void() havocbot_role_ast_offense; .entity havocbot_ast_target; +entity havocbot_ast_core; +float havocbot_ast_core_unreachable; + void(entity bot) havocbot_ast_reset_role; void(float ratingscale, vector org, float sradius) havocbot_goalrating_items; void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers; -.entity assault_decreaser; + +void havocbot_ast_find_core() +{ + entity are, to1, to2, to3; + + if(havocbot_ast_core_unreachable) + return; + + are = findchain(classname, "target_assault_roundend"); + + for (; are; are = are.chain) + { + for(to1 = world; (to1 = find(to1, target, are.targetname)); ) + { + if(to1.classname == "func_assault_destructible") + { + havocbot_ast_core = to1; + return; + } + + for(to2 = world; (to2 = find(to2, target, to1.targetname)); ) + { + if(to2.classname == "func_assault_destructible") + { + havocbot_ast_core = to2; + return; + } + + for(to3 = world; (to3 = find(to3, target, to2.targetname)); ) + { + if(to3.classname == "func_assault_destructible") + { + havocbot_ast_core = to3; + return; + } + } + } + } + } + + dprint("ERROR: Power core unreachable\n"); + havocbot_ast_core_unreachable = TRUE; +} + +void havocbot_goalrating_ast_core(float ratingscale) +{ + entity best, wp; + float radius, found, bestvalue, c; + vector p; + + havocbot_ast_find_core(); + + if not(havocbot_ast_core) + return; + + if not(havocbot_ast_core.takedamage) + havocbot_ast_core.takedamage = TRUE; + + p = 0.5 * (havocbot_ast_core.absmin + havocbot_ast_core.absmax); +// dprint(vtos(ad.origin), " ", vtos(ad.absmin), " ", vtos(ad.absmax),"\n"); + te_knightspike(p); + te_lightning2(world, '0 0 0', p); + + // Find and rate waypoints around it + found = FALSE; + best = world; + bestvalue = 99999999999; + for(radius=0; radius<1000 && !found; radius+=500) + { + for(wp=findradius(p, radius); wp; wp=wp.chain) + { + if(!(wp.wpflags & WAYPOINTFLAG_GENERATED)) + if(wp.classname=="waypoint") + if(checkpvs(wp.origin, havocbot_ast_core)) + { + found = TRUE; + if(wp.cnt