Xonotic
bot.qh
Go to the documentation of this file.
1 #pragma once
2 /*
3  * Globals and Fields
4  */
5 
6 const int AI_STATUS_ROAMING = BIT(0); // Bot is just crawling the map. No enemies at sight
7 const int AI_STATUS_ATTACKING = BIT(1); // There are enemies at sight
8 const int AI_STATUS_RUNNING = BIT(2); // Bot is bunny hopping
9 const int AI_STATUS_DANGER_AHEAD = BIT(3); // There is lava/slime/trigger_hurt ahead
10 const int AI_STATUS_OUT_JUMPPAD = BIT(4); // Trying to get out of a "vertical" jump pad
11 const int AI_STATUS_OUT_WATER = BIT(5); // Trying to get out of water
12 const int AI_STATUS_WAYPOINT_PERSONAL_LINKING = BIT(6); // Waiting for the personal waypoint to be linked
13 const int AI_STATUS_WAYPOINT_PERSONAL_GOING = BIT(7); // Going to a personal waypoint
14 const int AI_STATUS_WAYPOINT_PERSONAL_REACHED = BIT(8); // Personal waypoint reached
17 const int AI_STATUS_STUCK = BIT(11); // Cannot reach any goal
18 
19 .bool isbot; // true if this client is actually a bot
20 .int aistatus;
21 
22 // Skill system
24 
25 // havocbot_keyboardskill // keyboard movement
26 .float bot_moveskill; // moving technique
27 .float bot_dodgeskill; // dodging
28 
29 .float bot_pingskill; // ping offset
30 
31 .float bot_weaponskill; // weapon usage skill (combos, e.g.)
32 .float bot_aggresskill; // aggressivity, controls "think before fire" behaviour
33 .float bot_rangepreference; // weapon choice offset for range (>0 = prefer long range earlier "sniper", <0 = prefer short range "spammer")
34 
35 .float bot_aimskill; // aim accuracy
36 .float bot_offsetskill; // aim breakage
37 .float bot_mouseskill; // mouse "speed"
38 
39 .float bot_thinkskill; // target choice
40 .float bot_aiskill; // strategy choice
41 
43 
44 // Custom weapon priorities
47 
49 .entity nextbot;
50 .string cleanname;
51 // the *_freeme fields exist only to avoid an engine crash
52 // when trying to strunzone the original fields
56 
58 
59 .float createdtime;
61 .float bot_attack;
62 .float bot_dodge;
64 
65 .float bot_pickup;
68 .float bot_canfire;
71 
74 
77 
81 
83 #define IN_LAVA(pos) (_content_type = pointcontents(pos), (_content_type == CONTENT_LAVA || _content_type == CONTENT_SLIME))
84 #define IN_LIQUID(pos) (_content_type = pointcontents(pos), (_content_type == CONTENT_WATER || _content_type == CONTENT_LAVA || _content_type == CONTENT_SLIME))
85 #define SUBMERGED(pos) IN_LIQUID(pos + autocvar_sv_player_viewoffset)
86 #define WETFEET(pos) IN_LIQUID(pos + eZ * (m1.z + 1))
87 
88 /*
89  * Functions
90  */
91 
93 bool bot_fixcount(bool multiple_per_frame);
94 
95 void bot_think(entity this);
96 void bot_setnameandstuff(entity this);
98 void bot_endgame();
100 void bot_clientdisconnect(entity this);
101 void bot_clientconnect(entity this);
103 void bot_removenewest();
104 void autoskill(float factor);
105 void bot_serverframe();
106 
107 .void(entity this) bot_ai;
108 .float(entity player, entity item) bot_pickupevalfunc;
109 
110 /*
111  * Imports
112  */
113 
115 
void bot_clientconnect(entity this)
Definition: bot.qc:426
float bot_moveskill
Definition: bot.qh:26
float bot_pingskill
Definition: bot.qh:29
void bot_think(entity this)
Definition: bot.qc:57
string cleanname
Definition: bot.qh:50
float bot_dodgeskill
Definition: bot.qh:27
float bot_weaponskill
Definition: bot.qh:31
float autoskill_nextthink
Definition: bot.qh:23
float bot_preferredcolors
Definition: bot.qh:60
bool bot_fixcount(bool multiple_per_frame)
Definition: bot.qc:591
float botframe_nextthink
Definition: bot.qh:79
const int AI_STATUS_ROAMING
Definition: bot.qh:6
float bot_thinkskill
Definition: bot.qh:39
float bot_aggresskill
Definition: bot.qh:32
int aistatus
Definition: bot.qh:20
entity() spawn
const int AI_STATUS_JETPACK_LANDING
Definition: bot.qh:16
entity bot_spawn()
Definition: bot.qc:42
void bot_removefromlargestteam()
Definition: bot.qc:454
float bot_distance_far
Definition: bot.qh:45
const int AI_STATUS_WAYPOINT_PERSONAL_GOING
Definition: bot.qh:13
bool bot_pickup_respawning
Definition: bot.qh:67
string netname_freeme
Definition: bot.qh:53
float bot_pickupbasevalue
Definition: bot.qh:66
const int AI_STATUS_OUT_JUMPPAD
Definition: bot.qh:10
void bot_removenewest()
Definition: bot.qc:501
float bot_pickup
Definition: bot.qh:65
string playermodel_freeme
Definition: bot.qh:54
int _content_type
Definition: bot.qh:82
float botframe_spawnedwaypoints
Definition: bot.qh:78
void bot_endgame()
Definition: bot.qc:369
const int AI_STATUS_WAYPOINT_PERSONAL_LINKING
Definition: bot.qh:12
void bot_serverframe()
Definition: bot.qc:658
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
float bot_rangepreference
Definition: bot.qh:33
float bot_distance_close
Definition: bot.qh:46
float bot_canfire
Definition: bot.qh:68
void bot_setnameandstuff(entity this)
Definition: bot.qc:143
void bot_relinkplayerlist()
Definition: bot.qc:381
float botframe_nextdangertime
Definition: bot.qh:80
void(entity this) bot_ai
float bot_dodge
Definition: bot.qh:62
bool isbot
Definition: bot.qh:19
string playerskin_freeme
Definition: bot.qh:55
float bot_mouseskill
Definition: bot.qh:37
float bot_attack
Definition: bot.qh:61
float totalfrags_lastcheck
Definition: bot.qh:42
const int AI_STATUS_WAYPOINT_PERSONAL_REACHED
Definition: bot.qh:14
float bot_nextthink
Definition: bot.qh:57
const int AI_STATUS_OUT_WATER
Definition: bot.qh:11
entity nextbot
Definition: bot.qh:49
float bot_jump_time
Definition: bot.qh:70
float bot_config_loaded
Definition: bot.qh:73
const int AI_STATUS_DANGER_AHEAD
Definition: bot.qh:9
void bot_clientdisconnect(entity this)
Definition: bot.qc:411
float bot_aiskill
Definition: bot.qh:40
void havocbot_setupbot(entity this)
Definition: havocbot.qc:1683
float bot_offsetskill
Definition: bot.qh:36
void bot_custom_weapon_priority_setup()
Definition: bot.qc:308
float bot_aimskill
Definition: bot.qh:35
void bot_calculate_stepheightvec()
Definition: bot.qc:583
float bot_strategytime
Definition: bot.qh:69
float createdtime
Definition: bot.qh:59
float bot_dodgerating
Definition: bot.qh:63
entity bot_list
Definition: bot.qh:48
const int AI_STATUS_STUCK
Definition: bot.qh:17
entity bot_strategytoken
Definition: bot.qh:76
const int AI_STATUS_ATTACKING
Definition: bot.qh:7
const int AI_STATUS_JETPACK_FLYING
Definition: bot.qh:15
float bot_forced_team
Definition: bot.qh:72
const int AI_STATUS_RUNNING
Definition: bot.qh:8
void autoskill(float factor)
Definition: bot.qc:537
float bot_strategytoken_taken
Definition: bot.qh:75