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 float autocvar_g_vehicles_teleportable;
16 var float autocvar_g_vehicles_vortex_damagerate = 0.5;
17 var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
18 var float autocvar_g_vehicles_rifle_damagerate = 0.75;
19 var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
20 var float autocvar_g_vehicles_tag_damagerate = 5;
22 // vehicle definitions
26 .entity vehicle_shieldent; /// Entity to disply the shild effect on damage
28 .entity vehicle_viewport;
29 .entity vehicle_hudmodel;
30 .entity vehicle_controller;
35 .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.
36 .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.
37 .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.
39 .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.
40 .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.
41 .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.
42 .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.
44 .float sound_nexttime;
45 #define VOL_VEHICLEENGINE 1
47 const float SVC_SETVIEWPORT = 5; // Net.Protocol 0x05
48 const float SVC_SETVIEWANGLES = 10; // Net.Protocol 0x0A
49 const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80
52 #define VHSF_FACTORY 2
59 const float MAX_AXH = 4;
60 .entity AuxiliaryXhair[MAX_AXH];
67 .float lock_soundtime;
68 const float DAMAGE_TARGETDRONE = 10;
70 float force_fromtag_power;
71 float force_fromtag_normpower;
72 vector force_fromtag_origin;
74 float vehicles_exit_running;
76 #ifdef VEHICLES_USE_ODE
77 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
78 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
79 void(entity e, vector torque) physics_addtorque = #542; // add relative torque
80 #endif // VEHICLES_USE_ODE
82 // functions used outside the vehicle code
83 void vehicles_exit(float eject);
84 void vehicles_enter(entity pl, entity veh);
87 .void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
88 .float(float _imp) vehicles_impulse;
89 .float vehicle_weapon2mode;
90 .void(float exit_flags) vehicle_exit;
91 .float() vehicle_enter;
92 const float VHEF_NORMAL = 0; /// User pressed exit key
93 const float VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
94 const float VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
97 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
98 ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
100 #define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
101 traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
102 if(trace_fraction != 1) \
103 acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)