]> 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 #ifndef VEHICLES_DEF_H
2 #define VEHICLES_DEF_H
3
4 #include "../server/tturrets/include/turrets_early.qh"
5
6 // #define VEHICLES_USE_ODE
7
8 // vehicle cvars
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;
26
27 // vehicle definitions
28 .entity gun1;
29 .entity gun2;
30 .entity gun3;
31 .entity vehicle_shieldent;  /// Entity to disply the shild effect on damage
32 .entity vehicle;
33 .entity vehicle_viewport;
34 .entity vehicle_hudmodel;
35 .entity vehicle_controller;
36
37 .entity gunner1;
38 .entity gunner2;
39
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.
43
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.
48
49 .float sound_nexttime;
50 const float VOL_VEHICLEENGINE = 1;
51
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
55
56 const float VHSF_NORMAL = 0;
57 const float VHSF_FACTORY = 2;
58
59 .int hud;
60 .float dmg_time;
61
62 .float volly_counter;
63
64 const int MAX_AXH = 4;
65 .entity AuxiliaryXhair[MAX_AXH];
66
67 .entity wps_intruder;
68
69 .entity lock_target;
70 .float  lock_strength;
71 .float  lock_time;
72 .float  lock_soundtime;
73 const float     DAMAGE_TARGETDRONE = 10;
74
75 float  force_fromtag_power;
76 float  force_fromtag_normpower;
77 vector force_fromtag_origin;
78
79 float vehicles_exit_running;
80
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
86
87 // functions used outside the vehicle code
88 void vehicles_exit(bool eject);
89 void vehicles_enter(entity pl, entity veh);
90
91 // vehicle functions
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)
100
101 // macros
102 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
103         ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
104
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)
109
110 #endif