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 ATTRIB(Vehicle, model, string, "");
20 ATTRIB(Vehicle, mdl, string, "");
22 ATTRIB(Vehicle, head_model, string, "");
24 ATTRIB(Vehicle, hud_model, string, "");
26 ATTRIB(Vehicle, tag_head, string);
28 ATTRIB(Vehicle, tag_hud, string);
30 ATTRIB(Vehicle, tag_view, string);
32 ATTRIB(Vehicle, PlayerPhysplug, bool(entity,float));
36 ATTRIB(Vehicle, m_mins, vector, '-0 -0 -0');
42 ATTRIB(Vehicle, height, float, 0);
43
44#ifdef MENUQC
46 {
47 TC(Vehicle, this);
48 return SUPER(Vehicle).describe(this);
49 }
50#endif
51#ifndef SVQC
52 METHOD(Vehicle, display, void(Vehicle this, void(string name, string icon) returns))
53 {
54 TC(Vehicle, this);
55 returns(this.m_name, icon_path_from_HUDskin(this.m_icon));
56 }
57#endif
58
60 METHOD(Vehicle, vr_setup, void(Vehicle this, entity instance)) { }
62 METHOD(Vehicle, vr_think, void(Vehicle this, entity instance)) { }
64 METHOD(Vehicle, vr_death, void(Vehicle this, entity instance)) { }
68 METHOD(Vehicle, vr_enter, void(Vehicle this, entity instance)) { }
70 METHOD(Vehicle, vr_gunner_enter, void(Vehicle this, entity instance, entity actor)) { }
72 METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { }
74 METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { }
76 METHOD(Vehicle, vr_setcolors, void(Vehicle this, entity instance)) { }
78 METHOD(Vehicle, vr_hud, void(Vehicle this)) { }
80 METHOD(Vehicle, vr_crosshair, void(Vehicle thisveh, entity player)) { }
82
83// vehicle spawn flags (need them here for common registrations)
84const int VHF_ISVEHICLE = BIT(1);
85const int VHF_HASSHIELD = BIT(2);
86const int VHF_SHIELDREGEN = BIT(3);
87const int VHF_HEALTHREGEN = BIT(4);
88const int VHF_ENERGYREGEN = BIT(5);
89const int VHF_DEATHEJECT = BIT(6);
90const int VHF_MOVE_GROUND = BIT(7);
91const int VHF_MOVE_HOVER = BIT(8);
92const int VHF_MOVE_FLY = BIT(9);
93const int VHF_DMGSHAKE = BIT(10);
94const int VHF_DMGROLL = BIT(11);
95const int VHF_DMGHEADROLL = BIT(12);
96const int VHF_MULTISLOT = BIT(13);
97const int VHF_PLAYERSLOT = BIT(14);
98
99// 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:70
string hud_model
cockpit model
Definition vehicle.qh:24
string head_model
full name of tur_head model
Definition vehicle.qh:22
virtual void describe()
Definition vehicle.qh:45
virtual void vr_spawn()
(SERVER) called when the vehicle re-spawns
Definition vehicle.qh:72
vector m_mins
vehicle hitbox size
Definition vehicle.qh:36
float height
vehicle 3rd person view distance
Definition vehicle.qh:42
virtual void vr_crosshair()
(CLIENT) logic to run every frame
Definition vehicle.qh:80
string model
full name of model
Definition vehicle.qh:18
virtual void vr_precache()
(BOTH) precaches models/sounds used by this vehicle
Definition vehicle.qh:66
virtual void vr_impact()
(SERVER) called when a vehicle hits something
Definition vehicle.qh:74
virtual void vr_think()
(SERVER) logic to run every frame
Definition vehicle.qh:62
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:68
string mdl
currently a copy of the model
Definition vehicle.qh:20
virtual void vr_setup()
(BOTH) setup vehicle data
Definition vehicle.qh:60
string netname
short name
Definition vehicle.qh:12
virtual void vr_death()
(SERVER) called when vehicle dies
Definition vehicle.qh:64
int spawnflags
Definition vehicle.qh:34
vector view_ofs
vehicle 3rd person view offset
Definition vehicle.qh:40
vector m_maxs
vehicle hitbox size
Definition vehicle.qh:38
int vehicleid
Definition vehicle.qh:8
virtual void vr_hud()
(CLIENT) logic to run every frame
Definition vehicle.qh:78
virtual void vr_setcolors()
(SERVER) called when a vehicle's colors are being reset, so modules can be updated
Definition vehicle.qh:76
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
vector
Definition self.qh:92
entity tur_head
Definition sv_turrets.qh:28
const int VHF_PLAYERSLOT
Vehicle has multiple player slots.
Definition vehicle.qh:97
const int VHF_MOVE_FLY
Vehicle hover close to gound.
Definition vehicle.qh:92
const int VHF_HASSHIELD
Indicates vehicle.
Definition vehicle.qh:85
const int VHF_MOVE_HOVER
Vehicle moves on gound.
Definition vehicle.qh:91
const int VHF_MULTISLOT
Add random head angles each frame if health < 50%.
Definition vehicle.qh:96
entity vehicledef
Definition vehicle.qh:101
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
Definition vehicle.qh:87
const int VHF_DMGSHAKE
Vehicle is airborn.
Definition vehicle.qh:93
const int VHF_DMGHEADROLL
Add random angles each frame if health < 50%.
Definition vehicle.qh:95
const int VHF_MOVE_GROUND
Vehicle ejects pilot upon fatal damage.
Definition vehicle.qh:90
const int VHF_ENERGYREGEN
Vehicles health regenerates.
Definition vehicle.qh:88
const int VHF_ISVEHICLE
Definition vehicle.qh:84
const int VHF_SHIELDREGEN
Vehicle has shileding.
Definition vehicle.qh:86
const int VHF_DEATHEJECT
Vehicles energy regenerates.
Definition vehicle.qh:89
const int VHF_DMGROLL
Add random velocity each frame if health < 50%.
Definition vehicle.qh:94