]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/bot/lib/pathlib/debug.qc
Bots: move supporting code into bot directory
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / lib / pathlib / debug.qc
1 #include "pathlib.qh"
2
3 MODEL(SQUARE,       "models/pathlib/square.md3");
4 MODEL(SQUARE_GOOD,  "models/pathlib/goodsquare.md3");
5 MODEL(SQUARE_BAD,   "models/pathlib/badsquare.md3");
6 MODEL(EDGE,         "models/pathlib/edge.md3");
7
8 #ifdef TURRET_DEBUG
9 void mark_error(vector where,float lifetime);
10 void mark_info(vector where,float lifetime);
11 entity mark_misc(vector where,float lifetime);
12 #endif
13
14 void pathlib_showpath(entity start)
15 {
16     entity e;
17     e = start;
18     while(e.path_next)
19     {
20         te_lightning1(e,e.origin,e.path_next.origin);
21         e = e.path_next;
22     }
23 }
24
25 void path_dbg_think()
26 {SELFPARAM();
27     pathlib_showpath(self);
28     self.nextthink = time + 1;
29 }
30
31 void __showpath2_think()
32 {SELFPARAM();
33     #ifdef TURRET_DEBUG
34         mark_info(self.origin,1);
35         #endif
36     if(self.path_next)
37     {
38         self.path_next.think     = __showpath2_think;
39         self.path_next.nextthink = time + 0.15;
40     }
41     else
42     {
43         self.owner.think     = __showpath2_think;
44         self.owner.nextthink = time + 0.15;
45     }
46 }
47
48 void pathlib_showpath2(entity path)
49 {
50     path.think     = __showpath2_think;
51     path.nextthink = time;
52 }
53
54
55 void pathlib_showsquare2(entity node ,vector ncolor,float align)
56 {
57
58     node.alpha     = 0.25;
59     node.scale     = pathlib_gridsize / 512.001;
60     node.solid     = SOLID_NOT;
61
62     setmodel(node, MDL_SQUARE);
63     setorigin(node,node.origin);
64     node.colormod = ncolor;
65
66     if(align)
67     {
68         traceline(node.origin + '0 0 32', node.origin - '0 0 128', MOVE_WORLDONLY, node);
69         node.angles = vectoangles(trace_plane_normal);
70         node.angles_x -= 90;
71     }
72 }
73
74 void SUB_Remove();
75
76 void pathlib_showsquare(vector where,float goodsquare,float _lifetime)
77 {
78     entity s;
79
80     if(!_lifetime)
81         _lifetime = time + 30;
82     else
83         _lifetime += time;
84
85     s           = spawn();
86     s.alpha     = 0.25;
87     s.think     = SUB_Remove;
88     s.nextthink = _lifetime;
89     s.scale     = pathlib_gridsize / 512.001;
90     s.solid     = SOLID_NOT;
91
92     setmodel(s, goodsquare ? MDL_SQUARE_GOOD : MDL_SQUARE_BAD);
93
94     traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,s);
95
96     s.angles = vectoangles(trace_plane_normal);
97     s.angles_x -= 90;
98     setorigin(s,where);
99 }
100
101 void pathlib_showedge(vector where,float _lifetime,float rot)
102 {
103     entity e;
104
105     if(!_lifetime)
106         _lifetime = time + 30;
107     else
108         _lifetime += time;
109
110     e           = spawn();
111     e.alpha     = 0.25;
112     e.think     = SUB_Remove;
113     e.nextthink = _lifetime;
114     e.scale     = pathlib_gridsize / 512;
115     e.solid     = SOLID_NOT;
116     setorigin(e,where);
117     setmodel(e, MDL_EDGE);
118     //traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,e);
119     //e.angles = vectoangles(trace_plane_normal);
120     e.angles_y = rot;
121     //e.angles_x += 90;
122
123 }