From: terencehill Date: Sun, 19 Mar 2017 16:04:52 +0000 (+0100) Subject: Symmetrical waypoint editing: center is automatically determined based on CTF flag... X-Git-Tag: xonotic-v0.8.2~30 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2a9fa1ba1fe87ee1ceb51730b74df3fe05c632b;p=xonotic%2Fxonotic-data.pk3dir.git Symmetrical waypoint editing: center is automatically determined based on CTF flag positions --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index be25fe0dc..4bbf2cb0d 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -404,8 +404,8 @@ set bot_ai_timeitems_minrespawndelay 25 "bots run to items with this minimum res // waypoint editor enable set g_waypointeditor 0 set g_waypointeditor_auto 0 "Automatically create waypoints for bots while playing; BEWARE, this currently creates too many of them" -set g_waypointeditor_symmetrical 0 "Enable symmetrical editing of waypoints, useful in symmetrical CTF maps. NOTE: it assumes that the map is perfectly symmetrical" -set g_waypointeditor_symmetrical_center "0 0" "Center (x y) for symmetrical editing of waypoints" +set g_waypointeditor_symmetrical 0 "Enable symmetrical editing of waypoints: 1: center is automatically determined based on CTF flag positions (NOTE: it assumes that the map is perfectly symmetrical), 2: use custom center (g_waypointeditor_symmetrical_center)" +set g_waypointeditor_symmetrical_center "0 0" "Custom center (x y) for symmetrical editing of waypoints" set bot_ignore_bots 0 "When set, bots don't shoot at other bots" set bot_join_empty 0 "When set, bots also play if no player has joined the server" set bot_vs_human 0 "Bots and humans play in different teams when set. positive values to make an all-bot blue team, set to negative values to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count). Changes will be correctly applied only from the next game" diff --git a/qcsrc/server/bot/api.qh b/qcsrc/server/bot/api.qh index b3bc22730..4501d5b03 100644 --- a/qcsrc/server/bot/api.qh +++ b/qcsrc/server/bot/api.qh @@ -69,6 +69,9 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius); void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius); +vector havocbot_middlepoint; +float havocbot_middlepoint_radius; + .entity bot_basewaypoint; .bool navigation_dynamicgoal; void navigation_dynamicgoal_init(entity this, bool initially_static); diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index 7852620cf..4f8fb32b5 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -584,7 +584,10 @@ IMPULSE(navwaypoint_spawn) bprint(strcat("Waypoint spawned at ", vtos(org), "\n")); if(sym) { - vector map_center = autocvar_g_waypointeditor_symmetrical_center; + vector map_center = havocbot_middlepoint; + if (autocvar_g_waypointeditor_symmetrical == 2) + map_center = autocvar_g_waypointeditor_symmetrical_center; + org = e.origin; org.x = map_center.x - (org.x - map_center.x); org.y = map_center.y - (org.y - map_center.y); @@ -615,7 +618,10 @@ IMPULSE(navwaypoint_remove) entity wp_sym = NULL; if (sym) { - vector map_center = autocvar_g_waypointeditor_symmetrical_center; + vector map_center = havocbot_middlepoint; + if (autocvar_g_waypointeditor_symmetrical == 2) + map_center = autocvar_g_waypointeditor_symmetrical_center; + vector org = e.origin; org.x = map_center.x - (org.x - map_center.x); org.y = map_center.y - (org.y - map_center.y); diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 2c571991e..8d5155035 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1392,8 +1392,8 @@ void havocbot_ctf_calculate_middlepoint() } if(!n) return; - havocbot_ctf_middlepoint = s / n; - havocbot_ctf_middlepoint_radius = vlen(fo - havocbot_ctf_middlepoint); + havocbot_middlepoint = s / n; + havocbot_middlepoint_radius = vlen(fo - havocbot_middlepoint); } @@ -1638,13 +1638,13 @@ void havocbot_ctf_reset_role(entity this) // Evaluate best position to take // Count mates on middle position - cmiddle = havocbot_ctf_teamcount(this, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5); + cmiddle = havocbot_ctf_teamcount(this, havocbot_middlepoint, havocbot_middlepoint_radius * 0.5); // Count mates on defense position - cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5); + cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_middlepoint_radius * 0.5); // Count mates on offense position - coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_ctf_middlepoint_radius); + coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_middlepoint_radius); if(cdefense<=coffense) havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE); @@ -1926,15 +1926,15 @@ void havocbot_role_ctf_middle(entity this) { vector org; - org = havocbot_ctf_middlepoint; + org = havocbot_middlepoint; org.z = this.origin.z; this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); havocbot_goalrating_ctf_ourstolenflag(this, 50000); havocbot_goalrating_ctf_droppedflags(this, 30000, this.origin, 10000); - havocbot_goalrating_enemyplayers(this, 10000, org, havocbot_ctf_middlepoint_radius * 0.5); - havocbot_goalrating_items(this, 5000, org, havocbot_ctf_middlepoint_radius * 0.5); + havocbot_goalrating_enemyplayers(this, 10000, org, havocbot_middlepoint_radius * 0.5); + havocbot_goalrating_items(this, 5000, org, havocbot_middlepoint_radius * 0.5); havocbot_goalrating_items(this, 2500, this.origin, 10000); havocbot_goalrating_ctf_enemybase(this, 2500); navigation_goalrating_end(this); @@ -1975,11 +1975,7 @@ void havocbot_role_ctf_defense(entity this) } if (this.bot_strategytime < time) { - float mp_radius; - vector org; - - org = mf.dropped_origin; - mp_radius = havocbot_ctf_middlepoint_radius; + vector org = mf.dropped_origin; this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); @@ -2003,9 +1999,9 @@ void havocbot_role_ctf_defense(entity this) havocbot_goalrating_ctf_ourbase(this, 30000); havocbot_goalrating_ctf_ourstolenflag(this, 20000); - havocbot_goalrating_ctf_droppedflags(this, 20000, org, mp_radius); - havocbot_goalrating_enemyplayers(this, 15000, org, mp_radius); - havocbot_goalrating_items(this, 10000, org, mp_radius); + havocbot_goalrating_ctf_droppedflags(this, 20000, org, havocbot_middlepoint_radius); + havocbot_goalrating_enemyplayers(this, 15000, org, havocbot_middlepoint_radius); + havocbot_goalrating_items(this, 10000, org, havocbot_middlepoint_radius); havocbot_goalrating_items(this, 5000, this.origin, 10000); navigation_goalrating_end(this); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index c0b803422..8ef860846 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -145,9 +145,6 @@ const int HAVOCBOT_CTF_ROLE_ESCORT = 64; .bool havocbot_cantfindflag; -vector havocbot_ctf_middlepoint; -float havocbot_ctf_middlepoint_radius; - void havocbot_role_ctf_setrole(entity bot, int role); // team checking