]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/vehicles/sv_vehicles.qh
Merge branch 'master' into Mario/vehicles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qh
1 // #define VEHICLES_USE_ODE
2
3 // vehicle cvars
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_nex_damagerate = 0.5;
17 var float autocvar_g_vehicles_uzi_damagerate = 0.5;
18 var float autocvar_g_vehicles_rifle_damagerate = 0.75;
19 var float autocvar_g_vehicles_minstanex_damagerate = 0.001;
20 var float autocvar_g_vehicles_tag_damagerate = 5;
21
22 // vehicle definitions
23 .entity gun1;
24 .entity gun2;
25 .entity gun3;
26 .entity vehicle_shieldent;  /// Entity to disply the shild effect on damage
27 .entity vehicle;
28 .entity vehicle_viewport;
29 .entity vehicle_hudmodel;
30 .entity vehicle_controller;
31
32 .entity gunner1;
33 .entity gunner2;
34
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.
38
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.
43
44 .float sound_nexttime;
45 #define VOL_VEHICLEENGINE 1
46
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
50
51 #define VHSF_NORMAL 0
52 #define VHSF_FACTORY 2
53
54 .float hud;
55 .float dmg_time;
56
57 .float volly_counter;
58
59 const float MAX_AXH = 4;
60 .entity AuxiliaryXhair[MAX_AXH];
61
62 .entity wps_intruder;
63
64 .entity lock_target;
65 .float  lock_strength;
66 .float  lock_time;
67 .float  lock_soundtime;
68 const float     DAMAGE_TARGETDRONE = 10;
69
70 float  force_fromtag_power;
71 float  force_fromtag_normpower;
72 vector force_fromtag_origin;
73
74 float vehicles_exit_running;
75
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
81
82 // functions used outside the vehicle code
83 void vehicles_exit(float eject);
84 void vehicles_enter(entity pl, entity veh);
85
86 // vehicle functions
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)
95
96 // macros
97 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
98         ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
99
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)