Xonotic
api.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <common/weapons/_all.qh>
4 #include <common/stats.qh>
5 #include <common/weapons/_all.qh>
7 
10 
11 const int WAYPOINTFLAG_GENERATED = BIT(23);
12 const int WAYPOINTFLAG_ITEM = BIT(22);
13 const int WAYPOINTFLAG_TELEPORT = BIT(21); // teleports, warpzones and jumppads
14 //const int WAYPOINTFLAG_NORELINK = BIT(20); // deprecated, see explanation below. Do not recycle this bit.
15 const int WAYPOINTFLAG_PERSONAL = BIT(19);
16 const int WAYPOINTFLAG_PROTECTED = BIT(18); // Useless WP detection never kills these.
17 const int WAYPOINTFLAG_USEFUL = BIT(17); // Useless WP detection temporary flag.
18 const int WAYPOINTFLAG_DEAD_END = BIT(16); // Useless WP detection temporary flag.
19 const int WAYPOINTFLAG_LADDER = BIT(15);
20 const int WAYPOINTFLAG_JUMP = BIT(14);
21 const int WAYPOINTFLAG_CUSTOM_JP = BIT(13); // jumppad with different destination waypoint (changed in the editor)
22 const int WAYPOINTFLAG_CROUCH = BIT(12);
23 const int WAYPOINTFLAG_SUPPORT = BIT(11);
24 
25 // removed WAYPOINTFLAG_NORELINK since it breaks backward compatibility
26 // e.g. support waypoints would have no outgoing links in old Xonotic versions
27 // In general, old Xonotic versions should spawn a normal waypoint for each unknown waypoint type
30 
33 float bot_weapons_far[REGISTRY_MAX(Weapons)];
34 float bot_weapons_mid[REGISTRY_MAX(Weapons)];
35 float skill;
36 
38 .float bot_attack;
40 .float bot_dodge;
42 .float bot_moveskill; // moving technique
43 .float bot_pickup;
44 .float(entity player, entity item) bot_pickupevalfunc;
45 .string cleanname;
47 .void(entity this) havocbot_role;
48 .void(entity this) havocbot_previous_role;
49 .float isbot; // true if this client is actually a bot
55 .float speed;
62 .float wpconsidered;
63 .float wpcost;
64 .int wpflags;
66 
67 bool bot_aim(entity this, .entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity);
68 void bot_aim_reset(entity this);
69 void bot_clientconnect(entity this);
70 void bot_clientdisconnect(entity this);
71 void bot_cmdhelp(string scmd);
72 void bot_endgame();
73 bool bot_fixcount(bool multiple_per_frame);
74 void bot_list_commands();
75 void bot_queuecommand(entity bot, string cmdstring);
77 void bot_resetqueues();
78 void bot_serverframe();
79 bool bot_shouldattack(entity this, entity e);
80 void bot_think(entity this);
81 
84 
85 void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
86 void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
87 void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius);
88 
90 
96 
99 .entity ignoregoal;
100 
102 
105 
108 void navigation_dynamicgoal_init(entity this, bool initially_static);
109 void navigation_dynamicgoal_set(entity this, entity dropper);
111 entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
116 void navigation_goalrating_timeout_expire(entity this, float seconds);
120 void navigation_markroutes(entity this, entity fixed_source_waypoint);
121 void navigation_markroutes_inverted(entity fixed_source_waypoint);
122 void navigation_routerating(entity this, entity e, float f, float rangebias);
123 
125 
126 void set_tracewalk_dest(entity ent, vector org, bool fix_player_dest);
128 bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float end_height, float movemode);
129 
131 void waypoint_remove(entity wp);
132 void waypoint_saveall();
137 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
138 void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent);
139 void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp);
140 entity waypoint_spawn(vector m1, vector m2, float f);
142 void waypoint_start_hardwiredlink(entity pl, bool at_crosshair);
143 void waypoint_lock(entity pl);
144 
145 void waypoint_getSymmetricalOrigin_cmd(entity caller, bool save, int arg_idx);
146 void waypoint_getSymmetricalAxis_cmd(entity caller, bool save, int arg_idx);
147 
151 STATIC_INIT(botapi)
152 {
153  g_waypoints = IL_NEW();
154  g_bot_targets = IL_NEW();
155  g_bot_dodge = IL_NEW();
156 }
float nearestwaypointtimeout
Definition: api.qh:53
const int WAYPOINTFLAG_CROUCH
Definition: api.qh:22
bool bot_aim(entity this,.entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
float havocbot_role_timeout
Definition: api.qh:46
float ignoregoaltime
Definition: api.qh:98
float wp28mincost
Definition: api.qh:61
entity ignoregoal
Definition: api.qh:99
entity wphw01
Definition: api.qh:65
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
float wp17mincost
Definition: api.qh:60
void navigation_markroutes_inverted(entity fixed_source_waypoint)
Definition: navigation.qc:1171
void waypoint_remove(entity wp)
Definition: waypoints.qc:821
bool navigation_dynamicgoal
Definition: api.qh:107
float wp05mincost
Definition: api.qh:58
entity wp02
Definition: api.qh:56
entity wp24
Definition: api.qh:57
float wp06mincost
Definition: api.qh:58
entity wp27
Definition: api.qh:57
float wp14mincost
Definition: api.qh:59
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
float wp11mincost
Definition: api.qh:59
entity wp28
Definition: api.qh:57
int int number
Definition: impulse.qc:89
const int WAYPOINTFLAG_PROTECTED
Definition: api.qh:16
void bot_relinkplayerlist()
Definition: bot.qc:381
vector get_closer_dest(entity ent, vector org)
Definition: navigation.qc:103
entity wp19
Definition: api.qh:57
void bot_clientdisconnect(entity this)
Definition: bot.qc:411
void waypoint_lock(entity pl)
Definition: waypoints.qc:268
void bot_aim_reset(entity this)
Definition: aim.qc:170
float wp20mincost
Definition: api.qh:60
float wp07mincost
Definition: api.qh:58
float wp16mincost
Definition: api.qh:60
#define IL_NEW()
entity wp20
Definition: api.qh:57
entity bot_basewaypoint
Definition: api.qh:106
const int WAYPOINTFLAG_LADDER
Definition: api.qh:19
float wp26mincost
Definition: api.qh:61
void bot_cmdhelp(string scmd)
Definition: scripting.qc:331
float goalentity_lock_timeout
Definition: api.qh:97
entity() spawn
float bot_attack
Definition: api.qh:38
int player_count
Definition: api.qh:103
void navigation_dynamicgoal_init(entity this, bool initially_static)
Definition: navigation.qc:76
entity wphw04
Definition: api.qh:65
float wp00mincost
Definition: api.qh:58
entity find_bot_by_name(string name)
Definition: scripting.qc:235
const int WAYPOINTFLAG_JUMP
Definition: api.qh:20
float skill
Definition: api.qh:35
void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:176
void navigation_markroutes(entity this, entity fixed_source_waypoint)
Definition: navigation.qc:1081
float wp08mincost
Definition: api.qh:59
void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp)
Definition: waypoints.qc:570
entity wp16
Definition: api.qh:57
entity wp00
Definition: api.qh:56
float bot_weapons_close[REGISTRY_MAX(Weapons)]
Definition: api.qh:32
const int WPFLAGMASK_NORELINK
Definition: api.qh:29
entity wp03
Definition: api.qh:56
void navigation_dynamicgoal_set(entity this, entity dropper)
Definition: navigation.qc:86
entity wp26
Definition: api.qh:57
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
entity wp06
Definition: api.qh:56
entity wp22
Definition: api.qh:57
bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float end_height, float movemode)
Definition: navigation.qc:273
float wp19mincost
Definition: api.qh:60
float wpconsidered
Definition: api.qh:62
float havocbot_middlepoint_radius
Definition: api.qh:92
float wp04mincost
Definition: api.qh:58
void navigation_goalrating_timeout_force(entity this)
Definition: navigation.qc:28
const int WAYPOINTFLAG_NORELINK__DEPRECATED
Definition: api.qh:28
void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent)
Definition: waypoints.qc:2031
void navigation_routerating(entity this, entity e, float f, float rangebias)
Definition: navigation.qc:1220
int wpflags
Definition: api.qh:64
IntrusiveList g_bot_dodge
Definition: api.qh:150
IntrusiveList g_bot_targets
Definition: api.qh:149
float wp10mincost
Definition: api.qh:59
entity wp10
Definition: api.qh:56
entity wp25
Definition: api.qh:57
float bot_tracewalk_time
Definition: api.qh:37
int currentbots
Definition: api.qh:104
void bot_list_commands()
Definition: scripting.qc:444
float wp03mincost
Definition: api.qh:58
float wp31mincost
Definition: api.qh:61
void waypoint_getSymmetricalAxis_cmd(entity caller, bool save, int arg_idx)
Definition: waypoints.qc:137
float bot_moveskill
Definition: api.qh:42
entity find_bot_by_number(float number)
Definition: scripting.qc:246
float wp12mincost
Definition: api.qh:59
float havocbot_symmetry_axis_q
Definition: api.qh:94
bool navigation_goalrating_timeout_can_be_anticipated(entity this)
Definition: navigation.qc:55
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
entity wp05
Definition: api.qh:56
float wp02mincost
Definition: api.qh:58
float havocbot_symmetry_axis_m
Definition: api.qh:93
entity wp12
Definition: api.qh:56
STATIC_INIT(botapi)
Definition: api.qh:151
bool autocvar_g_waypoints_for_items
Definition: api.qh:8
string cleanname
Definition: api.qh:45
void waypoint_spawnforitem_force(entity e, vector org)
Definition: waypoints.qc:1978
bool bot_waypoints_for_items
Definition: api.qh:9
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
float navigation_hasgoals
Definition: api.qh:52
const int WAYPOINTFLAG_TELEPORT
Definition: api.qh:13
float wpcost
Definition: api.qh:63
entity wphw03
Definition: api.qh:65
float wp24mincost
Definition: api.qh:61
void waypoint_saveall()
Definition: waypoints.qc:1760
vector havocbot_middlepoint
Definition: api.qh:91
float bot_pickup
Definition: api.qh:43
entity nearestwaypoint
Definition: api.qh:54
bool bots_would_leave
Definition: api.qh:101
float bot_dodgerating
Definition: api.qh:39
void waypoint_getSymmetricalOrigin_cmd(entity caller, bool save, int arg_idx)
Definition: waypoints.qc:169
entity wp11
Definition: api.qh:56
entity wphw06
Definition: api.qh:65
entity wphw02
Definition: api.qh:65
entity wphw05
Definition: api.qh:65
float wp15mincost
Definition: api.qh:59
float lastteleporttime
Definition: api.qh:50
float wp27mincost
Definition: api.qh:61
float wp23mincost
Definition: api.qh:60
#define REGISTRY_MAX(id)
Definition: registry.qh:17
vector set_tracewalk_dest_2(entity ent, vector org)
Definition: navigation.qc:177
void navigation_goalrating_timeout_extend_if_needed(entity this, float seconds)
Definition: navigation.qc:49
void waypoint_start_hardwiredlink(entity pl, bool at_crosshair)
Definition: waypoints.qc:534
entity wp07
Definition: api.qh:56
entity wphw07
Definition: api.qh:65
float bot_weapons_far[REGISTRY_MAX(Weapons)]
Definition: api.qh:33
entity wp29
Definition: api.qh:57
void bot_endgame()
Definition: bot.qc:369
IntrusiveList g_waypoints
Definition: api.qh:148
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
void navigation_goalrating_timeout_expire(entity this, float seconds)
Definition: navigation.qc:35
entity wp09
Definition: api.qh:56
float bot_custom_weapon
Definition: api.qh:31
float wp21mincost
Definition: api.qh:60
float speed
Definition: api.qh:55
void waypoint_unreachable(entity pl)
Definition: waypoints.qc:28
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
Definition: waypoints.qc:2069
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void bot_serverframe()
Definition: bot.qc:658
float bot_forced_team
Definition: api.qh:41
entity wp21
Definition: api.qh:57
void navigation_dynamicgoal_unset(entity this)
Definition: navigation.qc:95
void set_tracewalk_dest(entity ent, vector org, bool fix_player_dest)
Definition: navigation.qc:119
entity wp18
Definition: api.qh:57
const int WAYPOINTFLAG_DEAD_END
Definition: api.qh:18
float wp25mincost
Definition: api.qh:61
void bot_clientconnect(entity this)
Definition: bot.qc:426
entity wp15
Definition: api.qh:56
float wp13mincost
Definition: api.qh:59
void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:16
entity wp30
Definition: api.qh:57
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:106
entity wp31
Definition: api.qh:57
float bot_dodge
Definition: api.qh:40
const int WAYPOINTFLAG_GENERATED
Definition: api.qh:11
entity wp14
Definition: api.qh:56
float havocbot_symmetry_origin_order
Definition: api.qh:95
bool bot_shouldattack(entity this, entity e)
Definition: aim.qc:112
float wp30mincost
Definition: api.qh:61
vector lastteleport_origin
Definition: api.qh:51
float bot_weapons_mid[REGISTRY_MAX(Weapons)]
Definition: api.qh:34
const int WAYPOINTFLAG_PERSONAL
Definition: api.qh:15
const int WAYPOINTFLAG_USEFUL
Definition: api.qh:17
entity wp01
Definition: api.qh:56
void bot_think(entity this)
Definition: bot.qc:57
float wp01mincost
Definition: api.qh:58
void waypoint_spawnforitem(entity e)
Definition: waypoints.qc:2007
void waypoint_schedulerelinkall()
Definition: waypoints.qc:1309
void bot_resetqueues()
Definition: scripting.qc:1165
void bot_queuecommand(entity bot, string cmdstring)
Definition: scripting.qc:30
const int WAYPOINTFLAG_ITEM
Definition: api.qh:12
entity wp23
Definition: api.qh:57
float wp18mincost
Definition: api.qh:60
const int WAYPOINTFLAG_CUSTOM_JP
Definition: api.qh:21
entity wphw00
Definition: api.qh:65
void waypoint_schedulerelink(entity wp)
Definition: waypoints.qc:1275
entity waypoint_spawn(vector m1, vector m2, float f)
Definition: waypoints.qc:431
entity wp13
Definition: api.qh:56
float isbot
Definition: api.qh:49
bool bot_fixcount(bool multiple_per_frame)
Definition: bot.qc:591
entity wp08
Definition: api.qh:56
entity wp17
Definition: api.qh:57
void waypoint_remove_fromeditor(entity pl)
Definition: waypoints.qc:840
entity wp04
Definition: api.qh:56
bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, entity item, vector item_org)
Definition: roles.qc:60
float wp09mincost
Definition: api.qh:59
const int WAYPOINTFLAG_SUPPORT
Definition: api.qh:23
float wp29mincost
Definition: api.qh:61
entity navigation_findnearestwaypoint(entity ent, float walkfromwp)
Definition: navigation.qc:1011
float wp22mincost
Definition: api.qh:60