]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Symmetrical waypoint editing: center is automatically determined based on CTF flag...
authorterencehill <piuntn@gmail.com>
Sun, 19 Mar 2017 16:04:52 +0000 (17:04 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 19 Mar 2017 16:04:52 +0000 (17:04 +0100)
defaultXonotic.cfg
qcsrc/server/bot/api.qh
qcsrc/server/impulse.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh

index be25fe0dcb3f48ac5fb71e385604fe8fe6274654..4bbf2cb0ddf427fb531534929c4bc618f42e0eed 100644 (file)
@@ -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"
index b3bc2273004a9666923a45cda0f5a227b65ab722..4501d5b03cf1fca8907c3825faa179ee5f2d616d 100644 (file)
@@ -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);
index 7852620cf880939face7e5d9c70210b73a560ed2..4f8fb32b5ea194b0d7096d218db0faed35194bab 100644 (file)
@@ -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);
index 2c571991e7ddeb025395edd372bcb8e042b539c1..8d51550354868fa15d67f66f74e9816759a7ce75 100644 (file)
@@ -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);
        }
index c0b8034229b56c7ed351903b3b24745b4c6e2041..8ef860846e45d08077bbcc14259f77484dab207c 100644 (file)
@@ -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