e661c672d019ab4ad2aeeea5484dcca621c2a5a7
[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
33 .vector wpnearestpoint;
34
35 /*
36  * Functions
37  */
38
39 spawnfunc(waypoint);
40 void waypoint_removelink(entity from, entity to);
41 int waypoint_getlinknum(entity from, entity to);
42 bool waypoint_islinked(entity from, entity to);
43 void waypoint_addlink_customcost(entity from, entity to, float c);
44 void waypoint_addlink(entity from, entity to);
45 void waypoint_think(entity this);
46 void waypoint_clearlinks(entity wp);
47 void waypoint_schedulerelink(entity wp);
48
49 float waypoint_getlinkcost(entity from, entity to);
50 float waypoint_gettravelcost(vector from, vector to, entity from_ent, entity to_ent);
51 float waypoint_getlinearcost(float dist);
52 void waypoint_updatecost_foralllinks();
53
54 void waypoint_remove_fromeditor(entity pl);
55 void waypoint_remove(entity wp);
56 void waypoint_schedulerelinkall();
57 void waypoint_save_links();
58 void waypoint_saveall();
59
60 void waypoint_spawnforitem_force(entity e, vector org);
61 void waypoint_spawnforitem(entity e);
62 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
63 void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent);
64 void botframe_showwaypointlinks();
65
66 float waypoint_loadall();
67 bool waypoint_load_links();
68 #define waypoint_load_links_hardwired() waypoint_load_or_remove_links_hardwired(false)
69 #define waypoint_remove_links_hardwired() waypoint_load_or_remove_links_hardwired(true)
70 void waypoint_load_or_remove_links_hardwired(bool removal_mode);
71
72 void waypoint_spawn_fromeditor(entity pl);
73 entity waypoint_spawn(vector m1, vector m2, float f);
74 entity waypoint_spawnpersonal(entity this, vector position);
75
76 void waypoint_unreachable(entity pl);
77
78 vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
79
80 void botframe_autowaypoints();