]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/vehicles/sv_vehicles.qh
Merge branch 'master' into TimePath/scoreboard_elo
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qh
1 #ifndef VEHICLES_DEF_H
2 #define VEHICLES_DEF_H
3 #ifdef SVQC
4
5 #include <common/turrets/sv_turrets.qh>
6 #include "vehicle.qh"
7
8 // vehicle cvars
9 bool autocvar_g_vehicles = true;
10 AUTOCVAR(g_vehicles_enter, bool, false, "require pressing use key to enter a vehicle");
11 float autocvar_g_vehicles_enter_radius = 250;
12 AUTOCVAR(g_vehicles_steal, bool, true, "allow stealing enemy vehicles in teamplay modes");
13 AUTOCVAR(g_vehicles_steal_show_waypoint, bool, true, "show a waypoint above the thief");
14 float autocvar_g_vehicles_crush_dmg = 70;
15 float autocvar_g_vehicles_crush_force = 50;
16 bool autocvar_g_vehicles_delayspawn = true;
17 float autocvar_g_vehicles_delayspawn_jitter = 10;
18 float autocvar_g_vehicles_allow_bots;
19 int autocvar_g_vehicles_exit_attempts = 25;
20 float autocvar_g_vehicles_thinkrate = 0.1;
21
22 AUTOCVAR(g_vehicles_teams, bool, true, "allow team specific vehicles");
23 float autocvar_g_vehicles_teleportable;
24 float autocvar_g_vehicles_vortex_damagerate = 0.5;
25 float autocvar_g_vehicles_machinegun_damagerate = 0.5;
26 float autocvar_g_vehicles_rifle_damagerate = 0.75;
27 float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
28 float autocvar_g_vehicles_tag_damagerate = 5;
29 float autocvar_g_vehicles_weapon_damagerate = 1;
30
31 .float vehicle_last_trace;
32
33 // flags:
34 .int vehicle_flags;
35
36 // vehicle definitions
37 .entity gun1;
38 .entity gun2;
39 .entity gun3;
40 .entity vehicle_shieldent;  /// Entity to disply the shild effect on damage
41 .entity vehicle;
42 .entity vehicle_viewport;
43 .entity vehicle_hudmodel;
44 .entity vehicle_controller;
45
46 .entity gunner1;
47 .entity gunner2;
48
49 .float vehicle_health = _STAT(VEHICLESTAT_HEALTH);  /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value.
50 .float vehicle_energy = _STAT(VEHICLESTAT_ENERGY);  /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value.
51 .float vehicle_shield = _STAT(VEHICLESTAT_SHIELD);  /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value.
52
53 .float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1);   /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value.
54 .float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehile, this is the real reload1 value.
55 .float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2);   /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value.
56 .float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehile, this is the real reload2 value.
57
58 .float sound_nexttime;
59 const float VOL_VEHICLEENGINE = 1;
60
61 const float SVC_SETVIEWPORT   = 5;   // Net.Protocol 0x05
62 const float SVC_SETVIEWANGLES = 10;  // Net.Protocol 0x0A
63 const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
64
65 const float VHSF_NORMAL = 0;
66 const float VHSF_FACTORY = 2;
67
68 .int hud = _STAT(HUD);
69 .float dmg_time;
70
71 .int volly_counter;
72
73 const int MAX_AXH = 4;
74 .entity AuxiliaryXhair[MAX_AXH];
75
76 .entity wps_intruder;
77
78 .entity lock_target;
79 .float  lock_strength;
80 .float  lock_time;
81 .float  lock_soundtime;
82 const float     DAMAGE_TARGETDRONE = 10;
83
84 // vehicle functions
85 .void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
86 .bool(entity this, int _imp) vehicles_impulse;
87 .int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
88 .void(entity this, int exit_flags) vehicle_exit;
89 .bool(entity this, entity player) vehicle_enter;
90 const int VHEF_NORMAL = 0;  /// User pressed exit key
91 const int VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
92 const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
93
94 float  force_fromtag_power;
95 float  force_fromtag_normpower;
96 vector force_fromtag_origin;
97
98 float vehicles_exit_running;
99
100 // macros
101 #define VEHICLE_UPDATE_PLAYER(ply,vehi,fld,vhname) \
102         ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
103
104 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
105
106 void vehicles_exit(entity vehic, int eject);
107 bool vehicle_initialize(entity this, Vehicle info, float nodrop);
108 bool vehicle_impulse(entity this, int imp);
109 bool vehicles_crushable(entity e);
110 float vehicle_altitude(entity this, float amax);
111
112 #endif
113 #endif