6 #include "../antilag.qh"
7 #include "../cl_player.qh"
8 #include "../g_damage.qh"
9 #include "../g_hook.qh"
10 #include "../movelib.qh"
12 #include "../bot/bot.qh"
14 #include "../command/common.qh"
16 #include "../tturrets/include/turrets_early.qh"
18 #include "../weapons/tracing.qh"
20 #include "../../common/deathtypes.qh"
21 #include "../../common/stats.qh"
23 #include "../../warpzonelib/anglestransform.qh"
24 #include "../../warpzonelib/server.qh"
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);
32 vector vehicles_findgoodexit(vector prefer_spot);
36 /** vehicles_locktarget
38 Generic target locking.
40 Figure out if what target is "locked" (if any), for missile tracking as such.
42 after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean
43 you have a locked in target.
45 Exspects a crosshair_trace() or equivalent to be
52 .float lock_soundtime;
54 void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id);
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);
60 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
61 ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
63 void CSQCVehicleSetup(entity own, float vehicle_id);
65 .float() PlayerPhysplug;
67 float autocvar_g_vehicles_allow_bots = 0;
69 void vehicles_touch();
71 void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale);
73 float shortangle_f(float ang1, float ang2);
74 float anglemods(float v);
76 entity vehicle_tossgib(entity _template, vector _vel, string _tag, float _burn, float _explode, float _maxtime, vector _rot);
78 void vehicles_impact(float _minspeed, float _speedfac, float _maxpain);
80 void shieldhit_think();
82 float vehicle_addplayerslot( entity _owner,
87 void(float) _exitfunc);
89 .void() vehicle_impact;
91 float vehicle_initialize(string net_name,
102 void(float _spawnflag) spawnproc,
106 void(float extflag) exitfunc,
113 float force_fromtag_normpower;
115 void vehicles_painframe();
117 void vehicles_locktarget(float incr, float decr, float _lock_time);
119 vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power);
121 vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power);
123 void vehicles_projectile_explode();
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
146 .entity vehicle_shieldent; /// Entity to disply the shild effect on damage
148 .entity vehicle_viewport;
149 .entity vehicle_hudmodel;
150 .entity vehicle_controller;
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.
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.
164 .float sound_nexttime;
165 const float VOL_VEHICLEENGINE = 1;
169 .float vehicle_respawntime;
170 //.void() vehicle_spawn;
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)
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
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;
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