Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
vehicle.qh
Go to the documentation of this file.
1#pragma once
2
3#ifndef SVQC
4 #include <common/util.qh> // for icon_path_from_HUDskin
5#endif
6
10 ATTRIB(Vehicle, m_icon, string);
12 ATTRIB(Vehicle, netname, string, "");
14 ATTRIB(Vehicle, m_name, string, _("Vehicle"));
18#ifdef GAMEQC
19 ATTRIB(Vehicle, model, string, "");
21 ATTRIB(Vehicle, mdl, string, "");
23 ATTRIB(Vehicle, head_model, string, "");
25 ATTRIB(Vehicle, hud_model, string, "");
27 ATTRIB(Vehicle, tag_head, string);
29 ATTRIB(Vehicle, tag_hud, string);
31 ATTRIB(Vehicle, tag_view, string);
35 ATTRIB(Vehicle, height, float, 0);
36#endif
37#ifdef SVQC
39 ATTRIB(Vehicle, PlayerPhysplug, bool(entity, float));
43 ATTRIB(Vehicle, m_mins, vector, '-0 -0 -0');
46#endif
47
48#ifdef MENUQC
50 {
51 TC(Vehicle, this);
52 return SUPER(Vehicle).describe(this);
53 }
54#endif
55#ifndef SVQC
56 METHOD(Vehicle, display, void(Vehicle this, void(string name, string icon) returns))
57 {
58 TC(Vehicle, this);
59 returns(this.m_name, icon_path_from_HUDskin(this.m_icon));
60 }
61#endif
62
63#ifdef GAMEQC
65 METHOD(Vehicle, vr_setup, void(Vehicle this, entity instance)) { }
68#endif
69#ifdef SVQC
71 METHOD(Vehicle, vr_think, void(Vehicle this, entity instance)) { }
73 METHOD(Vehicle, vr_death, void(Vehicle this, entity instance)) { }
75 METHOD(Vehicle, vr_enter, void(Vehicle this, entity instance)) { }
77 METHOD(Vehicle, vr_gunner_enter, void(Vehicle this, entity instance, entity actor)) { }
79 METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { }
81 METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { }
83 METHOD(Vehicle, vr_setcolors, void(Vehicle this, entity instance)) { }
84#endif
85#ifdef CSQC
87 METHOD(Vehicle, vr_hud, void(Vehicle this)) { }
89 METHOD(Vehicle, vr_crosshair, void(Vehicle thisveh, entity player)) { }
90#endif
92
93// vehicle spawn flags (need them here for common registrations)
94const int VHF_ISVEHICLE = BIT(1);
95const int VHF_HASSHIELD = BIT(2);
96const int VHF_SHIELDREGEN = BIT(3);
97const int VHF_HEALTHREGEN = BIT(4);
98const int VHF_ENERGYREGEN = BIT(5);
99const int VHF_DEATHEJECT = BIT(6);
100const int VHF_MOVE_GROUND = BIT(7);
101const int VHF_MOVE_HOVER = BIT(8);
102const int VHF_MOVE_FLY = BIT(9);
103const int VHF_DMGSHAKE = BIT(10);
104const int VHF_DMGROLL = BIT(11);
105const int VHF_DMGHEADROLL = BIT(12);
106const int VHF_MULTISLOT = BIT(13);
107const int VHF_PLAYERSLOT = BIT(14);
108
109// fields:
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void vr_gunner_enter()
(SERVER) called when a player enters this vehicle while occupied
Definition vehicle.qh:77
string hud_model
cockpit model
Definition vehicle.qh:25
string head_model
full name of tur_head model
Definition vehicle.qh:23
virtual void describe()
Definition vehicle.qh:49
virtual void vr_spawn()
(SERVER) called when the vehicle re-spawns
Definition vehicle.qh:79
ATTRIB(Vehicle, tag_view, string)
cockpit model tag
vector m_mins
vehicle hitbox size
Definition vehicle.qh:43
float height
vehicle 3rd person view distance
Definition vehicle.qh:35
virtual void vr_crosshair()
(CLIENT) logic to run every frame
Definition vehicle.qh:89
string model
full name of model
Definition vehicle.qh:19
ATTRIB(Vehicle, PlayerPhysplug, bool(entity, float))
player physics mod
ATTRIB(Vehicle, tag_hud, string)
hud model tag
ATTRIB(Vehicle, tag_head, string)
tur_head model tag
virtual void vr_precache()
(BOTH) precaches models/sounds used by this vehicle
Definition vehicle.qh:67
virtual void vr_impact()
(SERVER) called when a vehicle hits something
Definition vehicle.qh:81
virtual void vr_think()
(SERVER) logic to run every frame
Definition vehicle.qh:71
vector m_color
color
Definition vehicle.qh:16
string m_name
human readable name
Definition vehicle.qh:14
virtual void vr_enter()
(SERVER) called when a player enters this vehicle
Definition vehicle.qh:75
string mdl
currently a copy of the model
Definition vehicle.qh:21
virtual void vr_setup()
(BOTH) setup vehicle data
Definition vehicle.qh:65
string netname
short name
Definition vehicle.qh:12
virtual void vr_death()
(SERVER) called when vehicle dies
Definition vehicle.qh:73
int spawnflags
spawnflags
Definition vehicle.qh:41
vector view_ofs
vehicle 3rd person view offset
Definition vehicle.qh:33
vector m_maxs
vehicle hitbox size
Definition vehicle.qh:45
int vehicleid
Definition vehicle.qh:8
virtual void vr_hud()
(CLIENT) logic to run every frame
Definition vehicle.qh:87
virtual void vr_setcolors()
(SERVER) called when a vehicle's colors are being reset, so modules can be updated
Definition vehicle.qh:83
ATTRIB(Vehicle, m_icon, string)
hud icon
#define TC(T, sym)
Definition _all.inc:82
string name
Definition menu.qh:30
#define SUPER(cname)
Definition oo.qh:231
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define ATTRIB(...)
Definition oo.qh:148
vector
Definition self.qh:92
entity tur_head
Definition sv_turrets.qh:28
const int VHF_PLAYERSLOT
This ent is a player slot on a multi-person vehicle.
Definition vehicle.qh:107
const int VHF_MOVE_FLY
Vehicle is airborn.
Definition vehicle.qh:102
const int VHF_HASSHIELD
Vehicle has shileding.
Definition vehicle.qh:95
const int VHF_MOVE_HOVER
Vehicle hover close to gound.
Definition vehicle.qh:101
const int VHF_MULTISLOT
Vehicle has multiple player slots.
Definition vehicle.qh:106
entity vehicledef
Definition vehicle.qh:111
const int VHF_HEALTHREGEN
Vehicles health regenerates.
Definition vehicle.qh:97
const int VHF_DMGSHAKE
Add random velocity each frame if health < 50%.
Definition vehicle.qh:103
const int VHF_DMGHEADROLL
Add random head angles each frame if health < 50%.
Definition vehicle.qh:105
const int VHF_MOVE_GROUND
Vehicle moves on gound.
Definition vehicle.qh:100
const int VHF_ENERGYREGEN
Vehicles energy regenerates.
Definition vehicle.qh:98
const int VHF_ISVEHICLE
Indicates vehicle.
Definition vehicle.qh:94
const int VHF_SHIELDREGEN
Vehicles shield regenerates.
Definition vehicle.qh:96
const int VHF_DEATHEJECT
Vehicle ejects pilot upon fatal damage.
Definition vehicle.qh:99
const int VHF_DMGROLL
Add random angles each frame if health < 50%.
Definition vehicle.qh:104