1 // #define VEHICLES_USE_ODE
4 float autocvar_g_vehicles;
5 float autocvar_g_vehicles_enter;
6 float autocvar_g_vehicles_enter_radius;
7 float autocvar_g_vehicles_steal;
8 float autocvar_g_vehicles_steal_show_waypoint;
9 float autocvar_g_vehicles_crush_dmg;
10 float autocvar_g_vehicles_crush_force;
11 float autocvar_g_vehicles_delayspawn;
12 float autocvar_g_vehicles_delayspawn_jitter;
13 float autocvar_g_vehicles_allow_bots;
14 float autocvar_g_vehicles_teams;
15 var float autocvar_g_vehicles_nex_damagerate = 0.5;
16 var float autocvar_g_vehicles_uzi_damagerate = 0.5;
17 var float autocvar_g_vehicles_rifle_damagerate = 0.75;
18 var float autocvar_g_vehicles_minstanex_damagerate = 0.001;
19 var float autocvar_g_vehicles_tag_damagerate = 5;
21 // vehicle definitions
25 .entity vehicle_shieldent; /// Entity to disply the shild effect on damage
27 .entity vehicle_viewport;
28 .entity vehicle_hudmodel;
29 .entity vehicle_controller;
34 .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.
35 .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.
36 .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.
38 .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.
39 .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.
40 .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.
41 .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.
43 .float sound_nexttime;
44 #define VOL_VEHICLEENGINE 1
46 const float SVC_SETVIEWPORT = 5; // Net.Protocol 0x05
47 const float SVC_SETVIEWANGLES = 10; // Net.Protocol 0x0A
48 const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80
51 #define VHSF_FACTORY 2
58 const float MAX_AXH = 4;
59 .entity AuxiliaryXhair[MAX_AXH];
66 .float lock_soundtime;
67 const float DAMAGE_TARGETDRONE = 10;
69 float force_fromtag_power;
70 float force_fromtag_normpower;
71 vector force_fromtag_origin;
73 float vehicles_exit_running;
75 #ifdef VEHICLES_USE_ODE
76 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
77 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
78 void(entity e, vector torque) physics_addtorque = #542; // add relative torque
79 #endif // VEHICLES_USE_ODE
81 // functions used outside the vehicle code
82 void vehicles_exit(float eject);
83 void vehicles_enter(entity pl, entity veh);
86 .void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
87 .float(float _imp) vehicles_impulse;
88 .float vehicle_weapon2mode;
89 .void(float exit_flags) vehicle_exit;
90 .float() vehicle_enter;
91 const float VHEF_NORMAL = 0; /// User pressed exit key
92 const float VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
93 const float VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
96 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
97 ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
99 #define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
100 traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
101 if(trace_fraction != 1) \
102 acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)