Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / waypoints.qh
1 #pragma once
2
3 bool waypointeditor_enabled;
4
5 bool autocvar_g_waypointeditor;
6 bool autocvar_g_waypointeditor_symmetrical;
7 bool autocvar_g_waypointeditor_symmetrical_allowload = true;
8 vector autocvar_g_waypointeditor_symmetrical_origin;
9 int autocvar_g_waypointeditor_symmetrical_order;
10 vector autocvar_g_waypointeditor_symmetrical_axis;
11
12 // increase by 0.01 when changes require only waypoint relinking
13 // increase by 1 when changes require to manually edit waypoints
14 // max 2 decimal places, always specified
15 const float WAYPOINT_VERSION = 1.04;
16 float waypoint_version_loaded;
17 string waypoint_time;
18
19 // fields you can query using prvm_global server to get some statistics about waypoint linking culling
20 float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;
21
22 float botframe_waypointeditorlightningtime;
23 float botframe_loadedforcedlinks;
24 float botframe_cachedwaypointlinks;
25
26 // waypoint wp links to waypoint wp.wpXX (OUTGOING link)
27 // links are sorted by their cost (wpXXmincost)
28 .entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
29 .entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
30
31 // used by jumppads to store original destination wp, used in case it gets changed in the editor
32 .entity wp00_original;
33
34 .float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
35 .float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
36 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
37 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
38
39 // hardwired links are saved to the .wpXX fields among normal links
40 // AND to the supporting .wphwXX fields to allow identifying them precisely
41 // these links are not sorted, unlike normal links
42 .entity wphw00, wphw01, wphw02, wphw03, wphw04, wphw05, wphw06, wphw07;
43
44 .float wpcost;
45 .int wpfire, wpconsidered, wpisbox, wplinked;
46 .int wpflags;
47 .entity wp_aimed;
48 .entity wp_locked;
49
50 .vector wpnearestpoint;
51
52 // holds reference to the support waypoint, if any
53 .entity goalentity;
54 #define SUPPORT_WP goalentity
55
56 /*
57  * Functions
58  */
59
60 spawnfunc(waypoint);
61
62 bool waypoint_has_hardwiredlinks(entity wp);
63 bool waypoint_is_hardwiredlink(entity wp_from, entity wp_to);
64 void waypoint_mark_hardwiredlink(entity wp_from, entity wp_to);
65 void waypoint_unmark_hardwiredlink(entity wp_from, entity wp_to);
66
67 void waypoint_removelink(entity from, entity to);
68 int waypoint_getlinknum(entity from, entity to);
69 bool waypoint_islinked(entity from, entity to);
70 void waypoint_addlink_customcost(entity from, entity to, float c);
71 void waypoint_addlink(entity from, entity to);
72 void waypoint_think(entity this);
73 void waypoint_clearlinks(entity wp);
74 void waypoint_schedulerelink(entity wp);
75
76 float waypoint_get_assigned_link_cost(entity w, float i);
77
78 float waypoint_getlinkcost(entity from, entity to);
79 float waypoint_gettravelcost(vector from, vector to, entity from_ent, entity to_ent);
80 float waypoint_getlinearcost(float dist);
81 void waypoint_updatecost_foralllinks();
82
83 void waypoint_remove_fromeditor(entity pl);
84 void waypoint_remove(entity wp);
85 void waypoint_schedulerelinkall();
86 void waypoint_save_links();
87 void waypoint_saveall();
88
89 void waypoint_spawnforitem_force(entity e, vector org);
90 void waypoint_spawnforitem(entity e);
91 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
92 void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent);
93 void botframe_showwaypointlinks();
94
95 float waypoint_loadall();
96 bool waypoint_load_links();
97 void waypoint_load_hardwiredlinks();
98
99 void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp);
100 entity waypoint_spawn(vector m1, vector m2, float f);
101 entity waypoint_spawnpersonal(entity this, vector position);
102
103 void waypoint_unreachable(entity pl);
104
105 vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
106
107 void botframe_autowaypoints();