]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/vehicles/vehicles.qc
Fix FL_WEAPON flag overlapping FL_JUMPRELEASED. This unintentional change was introdu...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicles.qc
1 #include "vehicles.qh"
2
3 #ifdef GAMEQC
4 float vehicle_altitude(entity this, float amax)
5 {
6         tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this);
7         return vlen(this.origin - trace_endpos);
8 }
9
10 vector vehicles_force_fromtag_hover(entity this, string tag_name, float spring_length, float max_power)
11 {
12         force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name));
13         v_forward  = normalize(v_forward) * -1;
14         traceline(force_fromtag_origin, force_fromtag_origin - (v_forward  * spring_length), MOVE_NORMAL, this);
15
16         force_fromtag_power = (1 - trace_fraction) * max_power;
17         force_fromtag_normpower = force_fromtag_power / max_power;
18
19         return v_forward  * force_fromtag_power;
20 }
21
22 vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_length, float max_power)
23 {
24         force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name));
25         v_forward  = normalize(v_forward) * -1;
26         traceline(force_fromtag_origin, force_fromtag_origin - (v_forward  * spring_length), MOVE_NORMAL, this);
27
28         // TODO - this may NOT be compatible with wall/celing movement, unhardcode 0.25 (engine count multiplier)
29         if(trace_fraction == 1.0)
30         {
31                 force_fromtag_normpower = -0.25;
32                 return '0 0 -200';
33         }
34
35         force_fromtag_power = ((1 - trace_fraction) - trace_fraction) * max_power;
36         force_fromtag_normpower = force_fromtag_power / max_power;
37
38         return v_forward  * force_fromtag_power;
39 }
40 #endif