]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/vehicles/vehicle.qh
Merge remote-tracking branch 'origin/master' into terencehill/hud_configure
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / vehicles / vehicle.qh
1 #ifndef VEHICLE_H
2 #define VEHICLE_H
3
4 #include "../_all.qh"
5
6 #include "../antilag.qh"
7 #include "../cl_player.qh"
8 #include "../g_damage.qh"
9 #include "../g_hook.qh"
10 #include "../g_subs.qh"
11 #include "../movelib.qh"
12
13 #include "../bot/bot.qh"
14
15 #include "../command/common.qh"
16
17 #include "../tturrets/include/turrets_early.qh"
18
19 #include "../weapons/tracing.qh"
20
21 #include "../../common/deathtypes.qh"
22 #include "../../common/stats.qh"
23
24 #include "../../warpzonelib/anglestransform.qh"
25 #include "../../warpzonelib/server.qh"
26
27 entity vehicles_projectile(string _mzlfx, string _mzlsound,
28                            vector _org, vector _vel,
29                            float _dmg, float _radi, float _force,  float _size,
30                            float _deahtype, float _projtype, float _health,
31                            float _cull, float _clianim, entity _owner);
32
33 vector vehicles_findgoodexit(vector prefer_spot);
34
35
36
37 /** vehicles_locktarget
38
39     Generic target locking.
40
41     Figure out if what target is "locked" (if any), for missile tracking as such.
42
43     after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean
44     you have a locked in target.
45
46     Exspects a crosshair_trace() or equivalent to be
47     dont before calling.
48
49 **/
50 .entity lock_target;
51 .float  lock_strength;
52 .float  lock_time;
53 .float  lock_soundtime;
54
55 void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id);
56
57 vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
58                          float _pichlimit_min, float _pichlimit_max,
59                          float _rotlimit_min, float _rotlimit_max, float _aimspeed);
60
61 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
62 ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
63
64 void CSQCVehicleSetup(entity own, float vehicle_id);
65
66 .float() PlayerPhysplug;
67
68 float autocvar_g_vehicles_allow_bots = 0;
69
70 void vehicles_touch();
71
72 void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale);
73
74 float shortangle_f(float ang1, float ang2);
75 float anglemods(float v);
76
77 entity vehicle_tossgib(entity _template, vector _vel, string _tag, float _burn, float _explode, float _maxtime, vector _rot);
78
79 void vehicles_impact(float _minspeed, float _speedfac, float _maxpain);
80
81 void shieldhit_think();
82
83 float vehicle_addplayerslot(    entity _owner,
84                                 entity _slot,
85                                 float _hud,
86                                 string _hud_model,
87                                 float() _framefunc,
88                                 void(float) _exitfunc);
89
90 .void() vehicle_impact;
91
92 float vehicle_initialize(string  net_name,
93                          string  bodymodel,
94                          string  topmodel,
95                          string  hudmodel,
96                          string  toptag,
97                          string  hudtag,
98                          string  viewtag,
99                          float   vhud,
100                          vector  min_s,
101                          vector  max_s,
102                          float   nodrop,
103                          void(float _spawnflag)  spawnproc,
104                          float   _respawntime,
105                          float() physproc,
106                          void()  enterproc,
107                          void(float extflag) exitfunc,
108                          void() dieproc,
109                          void() thinkproc,
110                          float  use_csqc,
111                          float _max_health,
112                          float _max_shield);
113
114 float  force_fromtag_normpower;
115
116 void vehicles_painframe();
117
118 void vehicles_locktarget(float incr, float decr, float _lock_time);
119
120 vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power);
121
122 vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power);
123
124 void vehicles_projectile_explode();
125
126 #if VEHICLES_ENABLED
127
128 .int vehicle_flags;
129 const int VHF_ISVEHICLE     = 2;    /// Indicates vehicle
130 const int VHF_HASSHIELD     = 4;    /// Vehicle has shileding
131 const int VHF_SHIELDREGEN   = 8;    /// Vehicles shield regenerates
132 const int VHF_HEALTHREGEN   = 16;   /// Vehicles health regenerates
133 const int VHF_ENERGYREGEN   = 32;   /// Vehicles energy regenerates
134 const int VHF_DEATHEJECT    = 64;   /// Vehicle ejects pilot upon fatal damage
135 const int VHF_MOVE_GROUND   = 128;  /// Vehicle moves on gound
136 const int VHF_MOVE_HOVER    = 256;  /// Vehicle hover close to gound
137 const int VHF_MOVE_FLY      = 512;  /// Vehicle is airborn
138 const int VHF_DMGSHAKE      = 1024; /// Add random velocity each frame if health < 50%
139 const int VHF_DMGROLL       = 2048; /// Add random angles each frame if health < 50%
140 const int VHF_DMGHEADROLL   = 4096; /// Add random head angles each frame if health < 50%
141 const int VHF_MULTISLOT     = 8192; /// Vehicle has multiple player slots
142 const int VHF_PLAYERSLOT    = 16384;    /// This ent is a player slot on a multi-person vehicle
143
144 .entity gun1;
145 .entity gun2;
146 .entity gun3;
147 .entity vehicle_shieldent;  /// Entity to disply the shild effect on damage
148 .entity vehicle;
149 .entity vehicle_viewport;
150 .entity vehicle_hudmodel;
151 .entity vehicle_controller;
152
153 .entity gunner1;
154 .entity gunner2;
155
156 .float vehicle_health;      /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
157 .float vehicle_energy;      /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
158 .float vehicle_shield;      /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
159
160 .float vehicle_ammo1;   /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo1 value.
161 .float vehicle_reload1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload1 value.
162 .float vehicle_ammo2;   /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value.
163 .float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value.
164
165 .float sound_nexttime;
166 const float VOL_VEHICLEENGINE = 1;
167
168 .float hud;
169 .float dmg_time;
170 .float  vehicle_respawntime;
171 //.void() vehicle_spawn;
172
173 void vehicles_exit(float eject);
174 .void(float exit_flags) vehicle_exit;
175 const float VHEF_NORMAL = 0;  /// User pressed exit key
176 const float VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
177 const float VHEF_RELESE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
178
179 const float SVC_SETVIEWPORT   = 5;   // Net.Protocol 0x05
180 const float SVC_SETVIEWANGLES = 10;  // Net.Protocol 0x0A
181 const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
182
183 .void() vehicle_enter;  /// Vehicles custom funciton to be executed when owner exit it
184 .void() vehicle_die;    /// Vehicles custom function to be executed when vehile die
185 const float VHSF_NORMAL = 0;
186 const float VHSF_FACTORY = 2;
187 .void(float _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
188 .float(float _imp) vehicles_impulse;
189 .float vehicle_weapon2mode;
190
191 #if VEHICLES_USE_ODE
192 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
193 void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force
194 void(entity e, vector torque) physics_addtorque = #542; // add relative torque
195 #endif  // VEHICLES_USE_ODE
196 #endif  // VEHICLES_ENABLED
197 #endif