From: terencehill <piuntn@gmail.com>
Date: Fri, 17 Mar 2017 23:49:16 +0000 (+0100)
Subject: Add bot_ai_timeitems and bot_ai_timeitems_minrespawndelay cvars
X-Git-Tag: xonotic-v0.8.2~43
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8bbb6e37d055ef49286543466f9e1752b721a30d;p=xonotic%2Fxonotic-data.pk3dir.git

Add bot_ai_timeitems and bot_ai_timeitems_minrespawndelay cvars
---

diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg
index 5b3105c8c..be25fe0dc 100644
--- a/defaultXonotic.cfg
+++ b/defaultXonotic.cfg
@@ -398,6 +398,8 @@ set bot_ai_aimskill_order_filter_2nd 0.4 "Movement filter"
 set bot_ai_aimskill_order_filter_3th 0.2 "Acceleration filter"
 set bot_ai_aimskill_order_filter_4th 0.4 "Position prediction filter. Used rarely"
 set bot_ai_aimskill_order_filter_5th 0.5 "Movement prediction filter. Used rarely"
+set bot_ai_timeitems 1 "allow skilled bots to run to important items a little time before respawning"
+set bot_ai_timeitems_minrespawndelay 25 "bots run to items with this minimum respawn delay before respawning"
 
 // waypoint editor enable
 set g_waypointeditor 0
diff --git a/qcsrc/server/bot/default/cvars.qh b/qcsrc/server/bot/default/cvars.qh
index d612c7ab9..16b2aaf43 100644
--- a/qcsrc/server/bot/default/cvars.qh
+++ b/qcsrc/server/bot/default/cvars.qh
@@ -40,6 +40,8 @@ float autocvar_bot_ai_navigation_jetpack_mindistance;
 float autocvar_bot_ai_thinkinterval;
 bool autocvar_bot_ai_weapon_combo;
 float autocvar_bot_ai_weapon_combo_threshold;
+bool autocvar_bot_ai_timeitems;
+float autocvar_bot_ai_timeitems_minrespawndelay;
 string autocvar_bot_config_file;
 bool autocvar_bot_god;
 bool autocvar_bot_ignore_bots;
diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc
index 4f52f8b7a..2d5075f92 100644
--- a/qcsrc/server/bot/default/havocbot/roles.qc
+++ b/qcsrc/server/bot/default/havocbot/roles.qc
@@ -54,9 +54,13 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
 		if(!it.solid)
 		{
+			if(!autocvar_bot_ai_timeitems)
+				continue;
 			if(!it.scheduledrespawntime)
 				continue;
-			if(it.respawntime < 30 || (it.respawntimejitter && !it.itemdef.instanceOfPowerup))
+			if(it.respawntime < max(11, autocvar_bot_ai_timeitems_minrespawndelay))
+				continue;
+			if(it.respawntimejitter && !it.itemdef.instanceOfPowerup)
 				continue;
 
 			float t = 0;