From 13719cec41a5a1b20d0fff3fe1b6df449bc2a884 Mon Sep 17 00:00:00 2001 From: TimePath Date: Thu, 8 Oct 2015 10:15:40 +1100 Subject: [PATCH] Bots: define the API boundaries --- qcsrc/common/physics.qc | 4 + qcsrc/common/triggers/func/breakable.qc | 1 - qcsrc/common/weapons/all.qh | 4 - qcsrc/server/autocvars.qh | 62 ------------ qcsrc/server/bot/api.qh | 96 +++++++++++++++++++ qcsrc/server/bot/{ => default}/aim.qc | 5 - qcsrc/server/bot/{ => default}/aim.qh | 0 qcsrc/server/bot/default/all.inc | 11 +++ qcsrc/server/bot/{ => default}/bot.qc | 30 +----- qcsrc/server/bot/{ => default}/bot.qh | 9 -- qcsrc/server/bot/default/defs.qh | 61 ++++++++++++ .../bot/{ => default}/havocbot/havocbot.qc | 13 --- .../bot/{ => default}/havocbot/havocbot.qh | 0 .../{ => default}/havocbot/role_keyhunt.qc | 8 -- .../{ => default}/havocbot/role_keyhunt.qh | 3 - .../bot/{ => default}/havocbot/roles.qc | 8 +- .../bot/{ => default}/havocbot/roles.qh | 0 qcsrc/server/bot/{ => default}/navigation.qc | 9 +- qcsrc/server/bot/{ => default}/navigation.qh | 0 qcsrc/server/bot/{ => default}/scripting.qc | 5 +- qcsrc/server/bot/{ => default}/scripting.qh | 1 + qcsrc/server/bot/{ => default}/waypoints.qc | 10 -- qcsrc/server/bot/{ => default}/waypoints.qh | 19 ++-- qcsrc/server/bot/havocbot/scripting.qh | 5 - qcsrc/server/bot/impl.qc | 3 + qcsrc/server/bot/null/impl.qc | 39 ++++++++ qcsrc/server/cl_client.qc | 3 +- qcsrc/server/cl_impulse.qc | 3 - qcsrc/server/cl_player.qc | 1 - qcsrc/server/command/sv_cmd.qc | 4 - qcsrc/server/defs.qh | 1 - qcsrc/server/g_world.qc | 1 - qcsrc/server/mutators/gamemode.qh | 8 -- qcsrc/server/mutators/gamemode_assault.qh | 3 - qcsrc/server/mutators/gamemode_keyhunt.qc | 2 +- qcsrc/server/mutators/gamemode_nexball.qc | 2 + qcsrc/server/mutators/mutator.qh | 8 -- qcsrc/server/pathlib/path_waypoint.qc | 2 - qcsrc/server/progs.inc | 12 +-- qcsrc/server/race.qc | 2 - qcsrc/server/sv_main.qc | 3 - qcsrc/server/t_items.qc | 3 - qcsrc/server/teamplay.qc | 2 - 43 files changed, 235 insertions(+), 231 deletions(-) create mode 100644 qcsrc/server/bot/api.qh rename qcsrc/server/bot/{ => default}/aim.qc (99%) rename qcsrc/server/bot/{ => default}/aim.qh (100%) create mode 100644 qcsrc/server/bot/default/all.inc rename qcsrc/server/bot/{ => default}/bot.qc (95%) rename qcsrc/server/bot/{ => default}/bot.qh (90%) create mode 100644 qcsrc/server/bot/default/defs.qh rename qcsrc/server/bot/{ => default}/havocbot/havocbot.qc (99%) rename qcsrc/server/bot/{ => default}/havocbot/havocbot.qh (100%) rename qcsrc/server/bot/{ => default}/havocbot/role_keyhunt.qc (97%) rename qcsrc/server/bot/{ => default}/havocbot/role_keyhunt.qh (62%) rename qcsrc/server/bot/{ => default}/havocbot/roles.qc (98%) rename qcsrc/server/bot/{ => default}/havocbot/roles.qh (100%) rename qcsrc/server/bot/{ => default}/navigation.qc (99%) rename qcsrc/server/bot/{ => default}/navigation.qh (100%) rename qcsrc/server/bot/{ => default}/scripting.qc (99%) rename qcsrc/server/bot/{ => default}/scripting.qh (98%) rename qcsrc/server/bot/{ => default}/waypoints.qc (99%) rename qcsrc/server/bot/{ => default}/waypoints.qh (80%) delete mode 100644 qcsrc/server/bot/havocbot/scripting.qh create mode 100644 qcsrc/server/bot/impl.qc create mode 100644 qcsrc/server/bot/null/impl.qc diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 1a799c8de7..6d63226115 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -1109,6 +1109,8 @@ void PM_check_frozen(void) } } +.float ladder_time; + void PM_check_hitground() {SELFPARAM(); #ifdef SVQC @@ -1300,6 +1302,8 @@ void PM_swim(float maxspd_mod) PM_ClientMovement_Move(); } +.entity ladder_entity; + void PM_ladder(float maxspd_mod) {SELFPARAM(); // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index af9a6b4233..e6253b14de 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -4,7 +4,6 @@ #include "../../../server/g_subs.qh" #include "../../../server/g_damage.qh" -#include "../../../server/bot/bot.qh" #include "../../../common/csqcmodel_settings.qh" #include "../../../csqcmodellib/sv_model.qh" #include "../../../server/weapons/common.qh" diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index c96061fe61..faea45b5f8 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -26,10 +26,6 @@ WepSet ReadWepSet(); #include "../util.qh" -#ifdef SVQC -#include "../../server/bot/aim.qh" -#endif - REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72. REGISTER_REGISTRY(RegisterWeapons) entity get_weaponinfo(int id); diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index affd9437ed..6a2ff9d4cd 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -7,63 +7,6 @@ bool autocvar__campaign_testrun; int autocvar__campaign_index; string autocvar__campaign_name; bool autocvar__sv_init; -float autocvar_bot_ai_aimskill_blendrate; -float autocvar_bot_ai_aimskill_firetolerance_distdegrees; -float autocvar_bot_ai_aimskill_firetolerance_maxdegrees; -float autocvar_bot_ai_aimskill_firetolerance_mindegrees; -float autocvar_bot_ai_aimskill_fixedrate; -float autocvar_bot_ai_aimskill_mouse; -float autocvar_bot_ai_aimskill_offset; -float autocvar_bot_ai_aimskill_order_filter_1st; -float autocvar_bot_ai_aimskill_order_filter_2nd; -float autocvar_bot_ai_aimskill_order_filter_3th; -float autocvar_bot_ai_aimskill_order_filter_4th; -float autocvar_bot_ai_aimskill_order_filter_5th; -float autocvar_bot_ai_aimskill_order_mix_1st; -float autocvar_bot_ai_aimskill_order_mix_2nd; -float autocvar_bot_ai_aimskill_order_mix_3th; -float autocvar_bot_ai_aimskill_order_mix_4th; -float autocvar_bot_ai_aimskill_order_mix_5th; -float autocvar_bot_ai_aimskill_think; -float autocvar_bot_ai_bunnyhop_firstjumpdelay; -float autocvar_bot_ai_bunnyhop_skilloffset; -float autocvar_bot_ai_bunnyhop_startdistance; -float autocvar_bot_ai_bunnyhop_stopdistance; -float autocvar_bot_ai_chooseweaponinterval; -string autocvar_bot_ai_custom_weapon_priority_close; -string autocvar_bot_ai_custom_weapon_priority_distances; -string autocvar_bot_ai_custom_weapon_priority_far; -string autocvar_bot_ai_custom_weapon_priority_mid; -float autocvar_bot_ai_dangerdetectioninterval; -float autocvar_bot_ai_dangerdetectionupdates; -float autocvar_bot_ai_enemydetectioninterval; -float autocvar_bot_ai_enemydetectionradius; -float autocvar_bot_ai_friends_aware_pickup_radius; -float autocvar_bot_ai_ignoregoal_timeout; -float autocvar_bot_ai_keyboard_distance; -float autocvar_bot_ai_keyboard_threshold; -float autocvar_bot_ai_navigation_jetpack; -float autocvar_bot_ai_navigation_jetpack_mindistance; -float autocvar_bot_ai_strategyinterval; -float autocvar_bot_ai_thinkinterval; -bool autocvar_bot_ai_weapon_combo; -float autocvar_bot_ai_weapon_combo_threshold; -string autocvar_bot_config_file; -bool autocvar_bot_god; -bool autocvar_bot_ignore_bots; -bool autocvar_bot_join_empty; -bool autocvar_bot_navigation_ignoreplayers; -bool autocvar_bot_nofire; -#define autocvar_bot_number cvar("bot_number") -#define autocvar_bot_prefix cvar_string("bot_prefix") -bool autocvar_bot_sound_monopoly; -#define autocvar_bot_suffix cvar_string("bot_suffix") -bool autocvar_bot_usemodelnames; -int autocvar_bot_vs_human; -int autocvar_bot_debug; -bool autocvar_bot_debug_tracewalk; -bool autocvar_bot_debug_goalstack; -bool autocvar_bot_wander_enable; int autocvar_captureleadlimit_override; #define autocvar_capturelimit_override cvar("capturelimit_override") #define autocvar_developer cvar("developer") @@ -293,7 +236,6 @@ float autocvar_g_ctf_dropped_capture_delay; float autocvar_g_ctf_dropped_capture_radius; float autocvar_g_cts_finish_kill_delay; bool autocvar_g_cts_selfdamage; -bool autocvar_g_debug_bot_commands; int autocvar_g_domination_default_teams; bool autocvar_g_domination_disable_frags; int autocvar_g_domination_point_amt; @@ -502,7 +444,6 @@ float autocvar_g_turrets_targetscan_maxdelay; float autocvar_g_turrets_targetscan_mindelay; bool autocvar_g_use_ammunition; bool autocvar_g_waypointeditor; -int autocvar_g_waypointeditor_auto; bool autocvar_g_waypoints_for_items; float autocvar_g_weapon_charge_colormod_blue_full; float autocvar_g_weapon_charge_colormod_blue_half; @@ -534,7 +475,6 @@ int autocvar_rescan_pending; bool autocvar_samelevel; string autocvar_sessionid; #define autocvar_skill cvar("skill") -float autocvar_skill_auto; #define autocvar_slowmo cvar("slowmo") float autocvar_snd_soundradius; int autocvar_spawn_debug; @@ -584,7 +524,6 @@ float autocvar_sv_itemstime; string autocvar_sv_jumpspeedcap_max; float autocvar_sv_jumpspeedcap_max_disable_on_ramps; string autocvar_sv_jumpspeedcap_min; -float autocvar_sv_jumpvelocity; bool autocvar_sv_logscores_bots; bool autocvar_sv_logscores_console; bool autocvar_sv_logscores_file; @@ -652,7 +591,6 @@ float autocvar_timelimit_overtime; int autocvar_timelimit_overtimes; float autocvar_timelimit_suddendeath; #define autocvar_utf8_enable cvar("utf8_enable") -bool autocvar_waypoint_benchmark; float autocvar_sv_gameplayfix_gravityunaffectedbyticrate; bool autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag; float autocvar_g_trueaim_minrange; diff --git a/qcsrc/server/bot/api.qh b/qcsrc/server/bot/api.qh new file mode 100644 index 0000000000..9dc20ebb3b --- /dev/null +++ b/qcsrc/server/bot/api.qh @@ -0,0 +1,96 @@ +#ifndef BOT_API_H +#define BOT_API_H + +#include "../defs.qh" +#include "../autocvars.qh" +#include "../../common/weapons/all.qh" +#include "../../common/teams.qh" +#include "../teamplay.qh" +#include "../miscfunctions.qh" +#include "../campaign.qh" +#include "../cl_client.qh" +#include "../mutators/mutators_include.qh" +#include "../constants.qh" +#include "../weapons/weaponsystem.qh" + +const int WAYPOINTFLAG_GENERATED = 0x800000; + +int autocvar_bot_vs_human; +int autocvar_bot_number; +bool autocvar_bot_sound_monopoly; +float autocvar_bot_ai_strategyinterval; + +float bot_custom_weapon; +float bot_weapons_close[Weapons_MAX]; +float bot_weapons_far[Weapons_MAX]; +float bot_weapons_mid[Weapons_MAX]; +float currentbots; +float skill; + +.float bot_attack; +.float bot_dodgerating; +.float bot_dodge; +.float bot_forced_team; +.float bot_moveskill; // moving technique +.float bot_pickup; +.float(entity player, entity item) bot_pickupevalfunc; +.float bot_strategytime; +.string cleanname; +.float havocbot_role_timeout; +.float isbot; // true if this client is actually a bot +.float lastteleporttime; +.float navigation_hasgoals; +.float nearestwaypointtimeout; +.entity nearestwaypoint; +.float speed; +.entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15; +.entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31; +.float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost; +.float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost; +.float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost; +.float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost; +.float wpconsidered; +.float wpcost; +.int wpflags; + +bool bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity); +void bot_clientconnect(); +void bot_clientdisconnect(); +void bot_cmdhelp(string scmd); +void bot_endgame(); +bool bot_fixcount(); +void bot_list_commands(); +void bot_queuecommand(entity bot, string cmdstring); +void bot_relinkplayerlist(); +void bot_resetqueues(); +void bot_serverframe(); +bool bot_shouldattack(entity e); +void bot_think(); + +entity find_bot_by_name(string name); +entity find_bot_by_number(float number); + +void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius); +void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius); +void havocbot_goalrating_items(float ratingscale, vector org, float sradius); + +entity navigation_findnearestwaypoint(entity ent, float walkfromwp); +void navigation_goalrating_end(); +void navigation_goalrating_start(); +void navigation_markroutes(entity fixed_source_waypoint); +void navigation_markroutes_inverted(entity fixed_source_waypoint); +void navigation_routerating(entity e, float f, float rangebias); + +bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode); + +void waypoint_remove(entity e); +void waypoint_saveall(); +void waypoint_schedulerelinkall(); +void waypoint_schedulerelink(entity wp); +void waypoint_spawnforitem(entity e); +void waypoint_spawnforitem_force(entity e, vector org); +void waypoint_spawnforteleporter(entity e, vector destination, float timetaken); +void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken); +entity waypoint_spawn(vector m1, vector m2, float f); + +#endif diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/default/aim.qc similarity index 99% rename from qcsrc/server/bot/aim.qc rename to qcsrc/server/bot/default/aim.qc index 4f750cdb4d..6353d1ee3a 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/default/aim.qc @@ -1,9 +1,4 @@ #include "aim.qh" -#include "../_all.qh" - -#include "bot.qh" - -#include "../mutators/mutators_include.qh" // traces multiple trajectories to find one that will impact the target // 'end' vector is the place it aims for, diff --git a/qcsrc/server/bot/aim.qh b/qcsrc/server/bot/default/aim.qh similarity index 100% rename from qcsrc/server/bot/aim.qh rename to qcsrc/server/bot/default/aim.qh diff --git a/qcsrc/server/bot/default/all.inc b/qcsrc/server/bot/default/all.inc new file mode 100644 index 0000000000..a613a39187 --- /dev/null +++ b/qcsrc/server/bot/default/all.inc @@ -0,0 +1,11 @@ +#include "defs.qh" + +#include "bot.qc" +#include "aim.qc" +#include "navigation.qc" +#include "scripting.qc" +#include "waypoints.qc" + +#include "havocbot/havocbot.qc" +#include "havocbot/role_keyhunt.qc" +#include "havocbot/roles.qc" diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/default/bot.qc similarity index 95% rename from qcsrc/server/bot/bot.qc rename to qcsrc/server/bot/default/bot.qc index 00051cadb9..7eb438ec85 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -1,5 +1,4 @@ #include "bot.qh" -#include "../_all.qh" #include "aim.qh" #include "navigation.qh" @@ -7,35 +6,8 @@ #include "waypoints.qh" #include "havocbot/havocbot.qh" -#include "havocbot/scripting.qh" -#include "../antilag.qh" -#include "../autocvars.qh" -#include "../campaign.qh" -#include "../cl_client.qh" -#include "../constants.qh" -#include "../defs.qh" -#include "../race.qh" -#include "../t_items.qh" - -#include "../mutators/mutators_include.qh" - -#include "../weapons/accuracy.qh" - -#include "../../common/constants.qh" -#include "../../common/mapinfo.qh" -#include "../../common/teams.qh" -#include "../../common/util.qh" - -#include "../../common/weapons/all.qh" - -#include "../../csqcmodellib/sv_model.qh" - -#include "../../dpdefs/dpextensions.qh" -#include "../../dpdefs/progsdefs.qh" - -#include "../../warpzonelib/common.qh" -#include "../../warpzonelib/util_server.qh" +#include "../../weapons/accuracy.qh" entity bot_spawn() {SELFPARAM(); diff --git a/qcsrc/server/bot/bot.qh b/qcsrc/server/bot/default/bot.qh similarity index 90% rename from qcsrc/server/bot/bot.qh rename to qcsrc/server/bot/default/bot.qh index d5a2794008..b3c628de1d 100644 --- a/qcsrc/server/bot/bot.qh +++ b/qcsrc/server/bot/default/bot.qh @@ -21,7 +21,6 @@ const int AI_STATUS_STUCK = 2048; // Cannot reach any goal .int aistatus; // Skill system -float skill; float autoskill_nextthink; // havocbot_keyboardskill // keyboard movement @@ -43,14 +42,7 @@ float autoskill_nextthink; .float totalfrags_lastcheck; -// Custom weapon priorities -float bot_custom_weapon; -float bot_distance_far; -float bot_distance_close; -float bot_weapons_far[Weapons_MAX]; -float bot_weapons_mid[Weapons_MAX]; -float bot_weapons_close[Weapons_MAX]; entity bot_list; entity player_list; @@ -84,7 +76,6 @@ float botframe_spawnedwaypoints; float botframe_nextthink; float botframe_nextdangertime; float bot_cvar_nextthink; -float bot_ignore_bots; // let bots not attack other bots (only works in non-teamplay) /* * Functions diff --git a/qcsrc/server/bot/default/defs.qh b/qcsrc/server/bot/default/defs.qh new file mode 100644 index 0000000000..2d7c49975d --- /dev/null +++ b/qcsrc/server/bot/default/defs.qh @@ -0,0 +1,61 @@ +float bot_distance_close; +float bot_distance_far; +float bot_ignore_bots; // let bots not attack other bots (only works in non-teamplay) + +int autocvar_g_waypointeditor_auto; +float autocvar_skill_auto; +float autocvar_sv_jumpvelocity; +bool autocvar_waypoint_benchmark; +bool autocvar_bot_god; +float autocvar_bot_ai_thinkinterval; +float autocvar_bot_ai_aimskill_blendrate; +float autocvar_bot_ai_aimskill_firetolerance_distdegrees; +float autocvar_bot_ai_aimskill_firetolerance_maxdegrees; +float autocvar_bot_ai_aimskill_firetolerance_mindegrees; +float autocvar_bot_ai_aimskill_fixedrate; +float autocvar_bot_ai_aimskill_mouse; +float autocvar_bot_ai_aimskill_offset; +float autocvar_bot_ai_aimskill_order_filter_1st; +float autocvar_bot_ai_aimskill_order_filter_2nd; +float autocvar_bot_ai_aimskill_order_filter_3th; +float autocvar_bot_ai_aimskill_order_filter_4th; +float autocvar_bot_ai_aimskill_order_filter_5th; +float autocvar_bot_ai_aimskill_order_mix_1st; +float autocvar_bot_ai_aimskill_order_mix_2nd; +float autocvar_bot_ai_aimskill_order_mix_3th; +float autocvar_bot_ai_aimskill_order_mix_4th; +float autocvar_bot_ai_aimskill_order_mix_5th; +float autocvar_bot_ai_aimskill_think; +float autocvar_bot_ai_bunnyhop_firstjumpdelay; +float autocvar_bot_ai_bunnyhop_skilloffset; +float autocvar_bot_ai_bunnyhop_startdistance; +float autocvar_bot_ai_bunnyhop_stopdistance; +float autocvar_bot_ai_chooseweaponinterval; +string autocvar_bot_ai_custom_weapon_priority_close; +string autocvar_bot_ai_custom_weapon_priority_distances; +string autocvar_bot_ai_custom_weapon_priority_far; +string autocvar_bot_ai_custom_weapon_priority_mid; +float autocvar_bot_ai_dangerdetectioninterval; +float autocvar_bot_ai_dangerdetectionupdates; +float autocvar_bot_ai_enemydetectioninterval; +float autocvar_bot_ai_enemydetectionradius; +float autocvar_bot_ai_friends_aware_pickup_radius; +float autocvar_bot_ai_ignoregoal_timeout; +float autocvar_bot_ai_keyboard_distance; +float autocvar_bot_ai_keyboard_threshold; +float autocvar_bot_ai_navigation_jetpack; +float autocvar_bot_ai_navigation_jetpack_mindistance; +bool autocvar_bot_ai_weapon_combo; +float autocvar_bot_ai_weapon_combo_threshold; +string autocvar_bot_config_file; +bool autocvar_bot_ignore_bots; +bool autocvar_bot_join_empty; +bool autocvar_bot_navigation_ignoreplayers; +bool autocvar_bot_nofire; +#define autocvar_bot_prefix cvar_string("bot_prefix") +#define autocvar_bot_suffix cvar_string("bot_suffix") +bool autocvar_bot_usemodelnames; +int autocvar_bot_debug; +bool autocvar_bot_debug_tracewalk; +bool autocvar_bot_debug_goalstack; +bool autocvar_bot_wander_enable; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc similarity index 99% rename from qcsrc/server/bot/havocbot/havocbot.qc rename to qcsrc/server/bot/default/havocbot/havocbot.qc index f69527916c..ae5314a8cd 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1,17 +1,4 @@ #include "havocbot.qh" -#include "../../_all.qh" - -#include "../aim.qh" -#include "../bot.qh" -#include "../navigation.qh" -#include "../scripting.qh" -#include "../waypoints.qh" - -#include "../../../common/constants.qh" - -#include "../../../common/triggers/trigger/jumppads.qh" - -#include "../../../warpzonelib/common.qh" void havocbot_ai() {SELFPARAM(); diff --git a/qcsrc/server/bot/havocbot/havocbot.qh b/qcsrc/server/bot/default/havocbot/havocbot.qh similarity index 100% rename from qcsrc/server/bot/havocbot/havocbot.qh rename to qcsrc/server/bot/default/havocbot/havocbot.qh diff --git a/qcsrc/server/bot/havocbot/role_keyhunt.qc b/qcsrc/server/bot/default/havocbot/role_keyhunt.qc similarity index 97% rename from qcsrc/server/bot/havocbot/role_keyhunt.qc rename to qcsrc/server/bot/default/havocbot/role_keyhunt.qc index b1603c792a..a260685814 100644 --- a/qcsrc/server/bot/havocbot/role_keyhunt.qc +++ b/qcsrc/server/bot/default/havocbot/role_keyhunt.qc @@ -1,12 +1,4 @@ #include "role_keyhunt.qh" -#include "../../_all.qh" - -#include "havocbot.qh" - -#include "../bot.qh" -#include "../navigation.qh" - -#include "../../mutators/mutators_include.qh" void() havocbot_role_kh_carrier; void() havocbot_role_kh_defense; diff --git a/qcsrc/server/bot/havocbot/role_keyhunt.qh b/qcsrc/server/bot/default/havocbot/role_keyhunt.qh similarity index 62% rename from qcsrc/server/bot/havocbot/role_keyhunt.qh rename to qcsrc/server/bot/default/havocbot/role_keyhunt.qh index f3136c6307..ac3c77e524 100644 --- a/qcsrc/server/bot/havocbot/role_keyhunt.qh +++ b/qcsrc/server/bot/default/havocbot/role_keyhunt.qh @@ -1,8 +1,5 @@ #ifndef ROLE_KEYHUNT_H #define ROLE_KEYHUNT_H -entity kh_worldkeylist; -.entity kh_worldkeynext; - void havocbot_chooserole_kh(); #endif diff --git a/qcsrc/server/bot/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc similarity index 98% rename from qcsrc/server/bot/havocbot/roles.qc rename to qcsrc/server/bot/default/havocbot/roles.qc index 037968f136..c520ab3cd5 100644 --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -1,10 +1,4 @@ -#include "../../_all.qh" - -#include "havocbot.qh" -#include "role_keyhunt.qh" - -#include "../bot.qh" -#include "../navigation.qh" +#include "roles.qh" .float max_armorvalue; .float havocbot_role_timeout; diff --git a/qcsrc/server/bot/havocbot/roles.qh b/qcsrc/server/bot/default/havocbot/roles.qh similarity index 100% rename from qcsrc/server/bot/havocbot/roles.qh rename to qcsrc/server/bot/default/havocbot/roles.qh diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/default/navigation.qc similarity index 99% rename from qcsrc/server/bot/navigation.qc rename to qcsrc/server/bot/default/navigation.qc index 99e3901b2b..fb196fcc32 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1,13 +1,6 @@ #include "navigation.qh" -#include "../_all.qh" -#include "bot.qh" -#include "waypoints.qh" - -#include "../t_items.qh" - -#include "../../common/constants.qh" -#include "../../common/triggers/trigger/jumppads.qh" +#include "../common/triggers/trigger/jumppads.qh" void bot_debug(string input) { diff --git a/qcsrc/server/bot/navigation.qh b/qcsrc/server/bot/default/navigation.qh similarity index 100% rename from qcsrc/server/bot/navigation.qh rename to qcsrc/server/bot/default/navigation.qh diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/default/scripting.qc similarity index 99% rename from qcsrc/server/bot/scripting.qc rename to qcsrc/server/bot/default/scripting.qc index 72951cd662..3f53d2b9f2 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -1,7 +1,4 @@ #include "scripting.qh" -#include "../_all.qh" - -#include "bot.qh" .float bot_cmdqueuebuf_allocated; .float bot_cmdqueuebuf; @@ -1168,6 +1165,8 @@ void bot_resetqueues() bot_barriertime = time; } +bool autocvar_g_debug_bot_commands; + // Here we map commands to functions and deal with complex interactions between commands and execution states // NOTE: Of course you need to include your commands here too :) float bot_execute_commands_once() diff --git a/qcsrc/server/bot/scripting.qh b/qcsrc/server/bot/default/scripting.qh similarity index 98% rename from qcsrc/server/bot/scripting.qh rename to qcsrc/server/bot/default/scripting.qh index d5cdda9d69..1f2d4da312 100644 --- a/qcsrc/server/bot/scripting.qh +++ b/qcsrc/server/bot/default/scripting.qh @@ -9,6 +9,7 @@ #define CMD_STATUS_FINISHED 1 #define CMD_STATUS_ERROR 2 +void bot_clearqueue(entity bot); // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER const int BOT_CMD_NULL = 0; diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc similarity index 99% rename from qcsrc/server/bot/waypoints.qc rename to qcsrc/server/bot/default/waypoints.qc index 8f50d0276a..25031ef340 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -1,14 +1,4 @@ #include "waypoints.qh" -#include "../_all.qh" - -#include "bot.qh" -#include "navigation.qh" - -#include "../antilag.qh" - -#include "../../common/constants.qh" - -#include "../../warpzonelib/util_server.qh" // create a new spawnfunc_waypoint and automatically link it to other waypoints, and link // them back to it as well diff --git a/qcsrc/server/bot/waypoints.qh b/qcsrc/server/bot/default/waypoints.qh similarity index 80% rename from qcsrc/server/bot/waypoints.qh rename to qcsrc/server/bot/default/waypoints.qh index fde524bb94..42082c6ab8 100644 --- a/qcsrc/server/bot/waypoints.qh +++ b/qcsrc/server/bot/default/waypoints.qh @@ -3,15 +3,14 @@ /* * Globals and Fields */ - -const int WAYPOINTFLAG_GENERATED = 8388608; -const int WAYPOINTFLAG_ITEM = 4194304; -const int WAYPOINTFLAG_TELEPORT = 2097152; -const int WAYPOINTFLAG_NORELINK = 1048576; -const int WAYPOINTFLAG_PERSONAL = 524288; -const int WAYPOINTFLAG_PROTECTED = 262144; // Useless WP detection never kills these. -const int WAYPOINTFLAG_USEFUL = 131072; // Useless WP detection temporary flag. -const int WAYPOINTFLAG_DEAD_END = 65536; // Useless WP detection temporary flag. +// const int WAYPOINTFLAG_GENERATED = 0x800000; +const int WAYPOINTFLAG_ITEM = 0x400000; +const int WAYPOINTFLAG_TELEPORT = 0x200000; +const int WAYPOINTFLAG_NORELINK = 0x100000; +const int WAYPOINTFLAG_PERSONAL = 0x80000; +const int WAYPOINTFLAG_PROTECTED = 0x40000; // Useless WP detection never kills these. +const int WAYPOINTFLAG_USEFUL = 0x20000; // Useless WP detection temporary flag. +const int WAYPOINTFLAG_DEAD_END = 0x10000; // Useless WP detection temporary flag. // fields you can query using prvm_global server to get some statistics about waypoint linking culling float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled; @@ -29,7 +28,7 @@ float botframe_cachedwaypointlinks; .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost; .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost; -.float wpfire, wpcost, wpconsidered, wpisbox, wplinked, wphardwired; +.float wpfire, wpconsidered, wpisbox, wplinked, wphardwired; .int wpflags; .vector wpnearestpoint; diff --git a/qcsrc/server/bot/havocbot/scripting.qh b/qcsrc/server/bot/havocbot/scripting.qh deleted file mode 100644 index c09dbdeacc..0000000000 --- a/qcsrc/server/bot/havocbot/scripting.qh +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef HAVOCBOT_SCRIPTING_H -#define HAVOCBOT_SCRIPTING_H - -void bot_clearqueue(entity bot); -#endif diff --git a/qcsrc/server/bot/impl.qc b/qcsrc/server/bot/impl.qc new file mode 100644 index 0000000000..9f36c4f679 --- /dev/null +++ b/qcsrc/server/bot/impl.qc @@ -0,0 +1,3 @@ +#include "api.qh" + +#include "default/all.inc" diff --git a/qcsrc/server/bot/null/impl.qc b/qcsrc/server/bot/null/impl.qc new file mode 100644 index 0000000000..ea35b7fbc5 --- /dev/null +++ b/qcsrc/server/bot/null/impl.qc @@ -0,0 +1,39 @@ +bool bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity) { return false; } +void bot_clientconnect() { } +void bot_clientdisconnect() { } +void bot_cmdhelp(string scmd) { } +void bot_endgame() { } +bool bot_fixcount() { return true; } +void bot_list_commands() { } +void bot_queuecommand(entity bot, string cmdstring) { } +void bot_relinkplayerlist() { } +void bot_resetqueues() { } +void bot_serverframe() { } +bool bot_shouldattack(entity e) { return false; } +void bot_think() { } + +entity find_bot_by_name(string name) { return NULL; } +entity find_bot_by_number(float number) { return NULL; } + +void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius) { } +void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius) { } +void havocbot_goalrating_items(float ratingscale, vector org, float sradius) { } + +entity navigation_findnearestwaypoint(entity ent, float walkfromwp) { return NULL; } +void navigation_goalrating_end() { } +void navigation_goalrating_start() { } +void navigation_markroutes(entity fixed_source_waypoint) { } +void navigation_markroutes_inverted(entity fixed_source_waypoint) { } +void navigation_routerating(entity e, float f, float rangebias) { } + +bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode) { return false; } + +void waypoint_remove(entity e) { } +void waypoint_saveall() { } +void waypoint_schedulerelinkall() { } +void waypoint_schedulerelink(entity wp) { } +void waypoint_spawnforitem(entity e) { } +void waypoint_spawnforitem_force(entity e, vector org) { } +void waypoint_spawnforteleporter(entity e, vector destination, float timetaken) { } +void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken) { } +entity waypoint_spawn(vector m1, vector m2, float f) { return NULL; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0d0d356a9d..127080323d 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -20,8 +20,7 @@ #include "campaign.qh" #include "command/common.qh" -#include "bot/bot.qh" -#include "bot/navigation.qh" +#include "bot/api.qh" #include "../common/vehicles/all.qh" diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index a594c83c7c..1789023750 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -1,12 +1,9 @@ #include "_all.qh" #include "round_handler.qh" -#include "bot/waypoints.qh" - #include "weapons/throwing.qh" #include "command/common.qh" #include "cheats.qh" -#include "bot/navigation.qh" #include "weapons/selection.qh" #include "weapons/tracing.qh" #include "weapons/weaponsystem.qh" diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index e94ba62832..82c456f0ac 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -1,7 +1,6 @@ #include "cl_player.qh" #include "_all.qh" -#include "bot/bot.qh" #include "cheats.qh" #include "g_damage.qh" #include "g_subs.qh" diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index d08588ff99..03d47c7471 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -17,10 +17,6 @@ #include "../playerdemo.qh" #include "../teamplay.qh" -#include "../bot/bot.qh" -#include "../bot/navigation.qh" -#include "../bot/scripting.qh" - #include "../mutators/mutators_include.qh" #include "../../common/constants.qh" diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 4a7edc2b94..102309a081 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -45,7 +45,6 @@ float sv_clones; float sv_foginterval; float player_count; -float currentbots; float bots_would_leave; void UpdateFrags(entity player, float f); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index d6ffeeb5d1..efc3b95045 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -3,7 +3,6 @@ #include "anticheat.qh" #include "antilag.qh" -#include "bot/bot.qh" #include "campaign.qh" #include "cheats.qh" #include "cl_client.qh" diff --git a/qcsrc/server/mutators/gamemode.qh b/qcsrc/server/mutators/gamemode.qh index d2066b9abd..4a52ffabfb 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -12,14 +12,6 @@ #include "../scores.qh" #include "../scores_rules.qh" -#include "../bot/bot.qh" -#include "../bot/navigation.qh" -#include "../bot/waypoints.qh" -#include "../bot/havocbot/roles.qh" -#include "../bot/havocbot/role_keyhunt.qh" - -#include "../bot/havocbot/havocbot.qh" - #include "../command/vote.qh" #include "../../common/monsters/all.qh" diff --git a/qcsrc/server/mutators/gamemode_assault.qh b/qcsrc/server/mutators/gamemode_assault.qh index 1266492ca0..7635a9395e 100644 --- a/qcsrc/server/mutators/gamemode_assault.qh +++ b/qcsrc/server/mutators/gamemode_assault.qh @@ -21,9 +21,6 @@ void() havocbot_role_ast_offense; 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; - // scoreboard stuff const float ST_ASSAULT_OBJECTIVES = 1; const float SP_ASSAULT_OBJECTIVES = 4; diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index be45c3db0c..17f2da70b8 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -50,7 +50,7 @@ float kh_Team_ByID(float t) return 0; } -//entity kh_worldkeylist; +entity kh_worldkeylist; .entity kh_worldkeynext; entity kh_controller; //float kh_tracking_enabled; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index f65e058433..e95231ea41 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -3,6 +3,8 @@ #include "gamemode.qh" +#include "../../common/triggers/trigger/jumppads.qh" + float autocvar_g_nexball_basketball_bouncefactor; float autocvar_g_nexball_basketball_bouncestop; float autocvar_g_nexball_basketball_carrier_highspeed; diff --git a/qcsrc/server/mutators/mutator.qh b/qcsrc/server/mutators/mutator.qh index 39adb175c8..70c9125620 100644 --- a/qcsrc/server/mutators/mutator.qh +++ b/qcsrc/server/mutators/mutator.qh @@ -13,14 +13,6 @@ #include "../scores.qh" #include "../scores_rules.qh" -#include "../bot/bot.qh" -#include "../bot/navigation.qh" -#include "../bot/waypoints.qh" - -#include "../bot/havocbot/havocbot.qh" -#include "../bot/havocbot/roles.qh" -#include "../bot/havocbot/role_keyhunt.qh" - #include "../command/vote.qh" #include "../command/common.qh" diff --git a/qcsrc/server/pathlib/path_waypoint.qc b/qcsrc/server/pathlib/path_waypoint.qc index 4c3a7a1aad..615840d51b 100644 --- a/qcsrc/server/pathlib/path_waypoint.qc +++ b/qcsrc/server/pathlib/path_waypoint.qc @@ -1,5 +1,3 @@ -#include "../bot/waypoints.qh" - #include "pathlib.qh" #include "main.qh" diff --git a/qcsrc/server/progs.inc b/qcsrc/server/progs.inc index adb8cf6323..75c00833f4 100644 --- a/qcsrc/server/progs.inc +++ b/qcsrc/server/progs.inc @@ -45,16 +45,6 @@ #include "t_quake3.qc" #include "t_quake.qc" -#include "bot/aim.qc" -#include "bot/bot.qc" -#include "bot/navigation.qc" -#include "bot/scripting.qc" -#include "bot/waypoints.qc" - -#include "bot/havocbot/havocbot.qc" -#include "bot/havocbot/role_keyhunt.qc" -#include "bot/havocbot/roles.qc" - #include "command/all.qc" #include "mutators/mutators_include.qc" @@ -120,6 +110,8 @@ #include "../warpzonelib/server.qc" #include "../warpzonelib/util_server.qc" +#include "bot/impl.qc" + #if BUILD_MOD #include "../../mod/server/progs.inc" #endif diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index fbf1eaa185..4c451caa73 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -5,8 +5,6 @@ #include "portals.qh" #include "scores.qh" #include "spawnpoints.qh" -#include "bot/waypoints.qh" -#include "bot/navigation.qh" #include "command/getreplies.qh" #include "../common/deathtypes.qh" #include "../common/notifications.qh" diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 138051827b..9dfd6b807d 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -4,9 +4,6 @@ #include "g_hook.qh" #include "g_world.qh" -#include "bot/bot.qh" -#include "bot/waypoints.qh" - #include "command/common.qh" #include "mutators/mutators_include.qh" diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index e93ee2d7e1..e19b5d48f7 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -5,9 +5,6 @@ #if defined(SVQC) #include "_all.qh" - #include "bot/bot.qh" - #include "bot/waypoints.qh" - #include "mutators/mutators_include.qh" #include "weapons/common.qh" diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 6defa736f6..8f0120cd8b 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -6,8 +6,6 @@ #include "scores.qh" #include "scores_rules.qh" -#include "bot/bot.qh" - #include "command/vote.qh" #include "mutators/mutators_include.qh" -- 2.39.2