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