Merge remote-tracking branch 'origin/terencehill/bot_waypoints'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / waypoints.qh
1 #pragma once
2 /*
3  * Globals and Fields
4  */
5
6 // increase by 0.01 when changes require only waypoint relinking
7 // increase by 1 when changes require to manually edit waypoints
8 // max 2 decimal places, always specified
9 const float WAYPOINT_VERSION = 1.02;
10 string waypoint_time;
11
12 // fields you can query using prvm_global server to get some statistics about waypoint linking culling
13 float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;
14
15 float botframe_waypointeditorlightningtime;
16 float botframe_loadedforcedlinks;
17 float botframe_cachedwaypointlinks;
18
19 // waypoint wp links to waypoint wp.wpXX (OUTGOING link)
20 // links are sorted by their cost (wpXXmincost)
21 .entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
22 .entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
23
24 .float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
25 .float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
26 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
27 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
28
29 .float wpfire, wpcost, wpconsidered, wpisbox, wplinked, wphardwired;
30 .int wpflags;
31 .entity wp_aimed;
32 .entity wp_locked;
33
34 .vector wpnearestpoint;
35
36 /*
37  * Functions
38  */
39
40 spawnfunc(waypoint);
41 void waypoint_removelink(entity from, entity to);
42 int waypoint_getlinknum(entity from, entity to);
43 bool waypoint_islinked(entity from, entity to);
44 void waypoint_addlink_customcost(entity from, entity to, float c);
45 void waypoint_addlink(entity from, entity to);
46 void waypoint_think(entity this);
47 void waypoint_clearlinks(entity wp);
48 void waypoint_schedulerelink(entity wp);
49
50 float waypoint_getlinkcost(entity from, entity to);
51 float waypoint_gettravelcost(vector from, vector to, entity from_ent, entity to_ent);
52 float waypoint_getlinearcost(float dist);
53 void waypoint_updatecost_foralllinks();
54
55 void waypoint_remove_fromeditor(entity pl);
56 void waypoint_remove(entity wp);
57 void waypoint_schedulerelinkall();
58 void waypoint_save_links();
59 void waypoint_saveall();
60
61 void waypoint_spawnforitem_force(entity e, vector org);
62 void waypoint_spawnforitem(entity e);
63 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
64 void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent);
65 void botframe_showwaypointlinks();
66
67 float waypoint_loadall();
68 bool waypoint_load_links();
69 #define waypoint_load_links_hardwired() waypoint_load_or_remove_links_hardwired(false)
70 #define waypoint_remove_links_hardwired() waypoint_load_or_remove_links_hardwired(true)
71 void waypoint_load_or_remove_links_hardwired(bool removal_mode);
72
73 void waypoint_spawn_fromeditor(entity pl);
74 entity waypoint_spawn(vector m1, vector m2, float f);
75 entity waypoint_spawnpersonal(entity this, vector position);
76
77 void waypoint_unreachable(entity pl);
78
79 vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
80
81 void botframe_autowaypoints();