4 #include "../server/tturrets/include/turrets_early.qh"
6 // #define VEHICLES_USE_ODE
9 float autocvar_g_vehicles;
10 float autocvar_g_vehicles_enter;
11 float autocvar_g_vehicles_enter_radius;
12 float autocvar_g_vehicles_steal;
13 float autocvar_g_vehicles_steal_show_waypoint;
14 float autocvar_g_vehicles_crush_dmg;
15 float autocvar_g_vehicles_crush_force;
16 float autocvar_g_vehicles_delayspawn;
17 float autocvar_g_vehicles_delayspawn_jitter;
18 float autocvar_g_vehicles_allow_bots;
19 float autocvar_g_vehicles_teams;
20 float autocvar_g_vehicles_teleportable;
21 var float autocvar_g_vehicles_vortex_damagerate = 0.5;
22 var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
23 var float autocvar_g_vehicles_rifle_damagerate = 0.75;
24 var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
25 var float autocvar_g_vehicles_tag_damagerate = 5;
27 // vehicle definitions
31 .entity vehicle_shieldent; /// Entity to disply the shild effect on damage
33 .entity vehicle_viewport;
34 .entity vehicle_hudmodel;
35 .entity vehicle_controller;
40 .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.
41 .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.
42 .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.
44 .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.
45 .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.
46 .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.
47 .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.
49 .float sound_nexttime;
50 const float VOL_VEHICLEENGINE = 1;
52 const float SVC_SETVIEWPORT = 5; // Net.Protocol 0x05
53 const float SVC_SETVIEWANGLES = 10; // Net.Protocol 0x0A
54 const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80
56 const float VHSF_NORMAL = 0;
57 const float VHSF_FACTORY = 2;
64 const int MAX_AXH = 4;
65 .entity AuxiliaryXhair[MAX_AXH];
72 .float lock_soundtime;
73 const float DAMAGE_TARGETDRONE = 10;
75 float force_fromtag_power;
76 float force_fromtag_normpower;
77 vector force_fromtag_origin;
79 float vehicles_exit_running;
81 #ifdef VEHICLES_USE_ODE
82 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
83 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
84 void(entity e, vector torque) physics_addtorque = #542; // add relative torque
85 #endif // VEHICLES_USE_ODE
87 // functions used outside the vehicle code
88 void vehicles_exit(bool eject);
89 void vehicles_enter(entity pl, entity veh);
92 .void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
93 .int(int _imp) vehicles_impulse;
94 .float vehicle_weapon2mode;
95 .void(int exit_flags) vehicle_exit;
96 .float() vehicle_enter;
97 const int VHEF_NORMAL = 0; /// User pressed exit key
98 const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
99 const int VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
102 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
103 ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
105 #define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
106 traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
107 if(trace_fraction != 1) \
108 acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)