Xonotic
sv_vehicles.qh
Go to the documentation of this file.
1 #pragma once
2 #ifdef SVQC
3 
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 float autocvar_g_vehicles_crush_minspeed = 100;
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.75;
25 float autocvar_g_vehicles_machinegun_damagerate = 0.75;
26 float autocvar_g_vehicles_rifle_damagerate = 0.75;
27 float autocvar_g_vehicles_vaporizer_damagerate = 0.5;
28 float autocvar_g_vehicles_tag_damagerate = 5;
29 float autocvar_g_vehicles_weapon_damagerate = 2;
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;
41 .entity vehicle;
42 .entity vehicle_viewport;
43 .entity vehicle_hudmodel;
44 .entity vehicle_controller;
45 
46 .entity gunner1;
47 .entity gunner2;
48 
49 const .float vehicle_health = _STAT(VEHICLESTAT_HEALTH);
50 const .float vehicle_energy = _STAT(VEHICLESTAT_ENERGY);
51 const .float vehicle_shield = _STAT(VEHICLESTAT_SHIELD);
52 
53 const .float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1);
54 const .float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1);
55 const .float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2);
56 const .float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2);
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 .float dmg_time;
69 
70 .float pain_frame;
71 
72 .float play_time;
73 
74 .int volly_counter;
75 
76 const int MAX_AXH = 4;
77 .entity AuxiliaryXhair[MAX_AXH];
78 
79 .entity wps_intruder;
80 
81 .entity lock_target;
82 .float lock_strength;
83 .float lock_time;
84 .float lock_soundtime;
85 
86 // vehicle functions
87 .void(int _spawnflag) vehicle_spawn;
88 .bool(entity this, int _imp) vehicles_impulse;
89 .void(entity this, int exit_flags) vehicle_exit;
90 .bool(entity this, entity player) vehicle_enter;
91 const int VHEF_NORMAL = 0;
92 const int VHEF_EJECT = 1;
93 const int VHEF_RELEASE = 2;
94 
95 float vehicles_exit_running;
96 
97 // macros
98 #define VEHICLE_UPDATE_PLAYER(ply,vehi,fld,vhname) \
99  ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
100 
101 #define VEHICLE_UPDATE_PLAYER_RESOURCE(ply,vehi,fld,vhname,res) \
102  ply.vehicle_##fld = (GetResource(vehi, res) / 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 void vehicles_enter(entity pl, entity veh);
111 
112 IntrusiveList g_vehicle_returners;
113 STATIC_INIT(g_vehicle_returners) { g_vehicle_returners = IL_NEW(); }
114 
115 #endif
int int int imp
Definition: impulse.qc:90
#define IL_NEW()
entity() spawn
bool vehicles_crushable(entity e)
Definition: sv_vehicles.qc:735
bool vehicle_impulse(entity this, int imp)
Definition: sv_vehicles.qc:921
#define STATIC_INIT(func)
during worldspawn
Definition: static.qh:32
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
const int MAX_AXH
Definition: cl_vehicles.qh:23
void vehicles_enter(entity pl, entity veh)
Definition: sv_vehicles.qc:939
#define AUTOCVAR(...)
Definition: cvar.qh:161
float volly_counter
Definition: sv_turrets.qh:38
entity AuxiliaryXhair[MAX_AXH]
Definition: cl_vehicles.qh:24
void vehicles_exit(entity vehic, bool eject)
Definition: sv_vehicles.qc:788
entity vehicle
Definition: impulse.qc:21
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)