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