]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/vehicles/vehicle.qh
Fix FL_WEAPON flag overlapping FL_JUMPRELEASED. This unintentional change was introdu...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle.qh
1 #pragma once
2
3 CLASS(Vehicle, Object)
4     ATTRIB(Vehicle, vehicleid, int, 0);
5     /** hud icon */
6     ATTRIB(Vehicle, m_icon, string);
7     /** short name */
8     ATTRIB(Vehicle, netname, string, "");
9     /** human readable name */
10     ATTRIB(Vehicle, vehicle_name, string, "Vehicle");
11     /** full name of model */
12     ATTRIB(Vehicle, model, string, "");
13     /** currently a copy of the model */
14     ATTRIB(Vehicle, mdl, string, "");
15     /** full name of tur_head model */
16     ATTRIB(Vehicle, head_model, string, "");
17     /** cockpit model */
18     ATTRIB(Vehicle, hud_model, string, "");
19     /** tur_head model tag */
20     ATTRIB(Vehicle, tag_head, string);
21     /** hud model tag */
22     ATTRIB(Vehicle, tag_hud, string);
23     /** cockpit model tag */
24     ATTRIB(Vehicle, tag_view, string);
25     /** player physics mod */
26     ATTRIB(Vehicle, PlayerPhysplug, bool(entity,float));
27     /**  */
28     ATTRIB(Vehicle, spawnflags, int, 0);
29     /** vehicle hitbox size */
30     ATTRIB(Vehicle, m_mins, vector, '-0 -0 -0');
31     /** vehicle hitbox size */
32     ATTRIB(Vehicle, m_maxs, vector, '0 0 0');
33     /** vehicle 3rd person view offset */
34     ATTRIB(Vehicle, view_ofs, vector, '0 0 0');
35     /** vehicle 3rd person view distance */
36     ATTRIB(Vehicle, height, float, 0);
37
38     /** (BOTH) setup vehicle data */
39     METHOD(Vehicle, vr_setup, void(Vehicle this, entity instance)) { }
40     /** (SERVER) logic to run every frame */
41     METHOD(Vehicle, vr_think, void(Vehicle this, entity instance)) { }
42     /** (SERVER) called when vehicle dies */
43     METHOD(Vehicle, vr_death, void(Vehicle this, entity instance)) { }
44     /** (BOTH) precaches models/sounds used by this vehicle */
45     METHOD(Vehicle, vr_precache, void(Vehicle this)) { }
46     /** (SERVER) called when a player enters this vehicle */
47     METHOD(Vehicle, vr_enter, void(Vehicle this, entity instance)) { }
48     /** (SERVER) called when a player enters this vehicle while occupied */
49     METHOD(Vehicle, vr_gunner_enter, void(Vehicle this, entity instance, entity actor)) { }
50     /** (SERVER) called when the vehicle re-spawns */
51     METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { }
52     /** (SERVER) called when a vehicle hits something */
53     METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { }
54     /** (SERVER) called when a vehicle's colors are being reset, so modules can be updated */
55     METHOD(Vehicle, vr_setcolors, void(Vehicle this, entity instance)) { }
56     /** (CLIENT) logic to run every frame */
57     METHOD(Vehicle, vr_hud, void(Vehicle this)) { }
58     /** (CLIENT) logic to run every frame */
59     METHOD(Vehicle, vr_crosshair, void(Vehicle thisveh, entity player)) { }
60 ENDCLASS(Vehicle)
61
62 // vehicle spawn flags (need them here for common registrations)
63 const int VHF_ISVEHICLE                 = BIT(1); /// Indicates vehicle
64 const int VHF_HASSHIELD                 = BIT(2); /// Vehicle has shileding
65 const int VHF_SHIELDREGEN               = BIT(3); /// Vehicles shield regenerates
66 const int VHF_HEALTHREGEN               = BIT(4); /// Vehicles health regenerates
67 const int VHF_ENERGYREGEN               = BIT(5); /// Vehicles energy regenerates
68 const int VHF_DEATHEJECT                = BIT(6); /// Vehicle ejects pilot upon fatal damage
69 const int VHF_MOVE_GROUND               = BIT(7); /// Vehicle moves on gound
70 const int VHF_MOVE_HOVER                = BIT(8); /// Vehicle hover close to gound
71 const int VHF_MOVE_FLY                  = BIT(9); /// Vehicle is airborn
72 const int VHF_DMGSHAKE                  = BIT(10); /// Add random velocity each frame if health < 50%
73 const int VHF_DMGROLL                   = BIT(11); /// Add random angles each frame if health < 50%
74 const int VHF_DMGHEADROLL               = BIT(12); /// Add random head angles each frame if health < 50%
75 const int VHF_MULTISLOT                 = BIT(13); /// Vehicle has multiple player slots
76 const int VHF_PLAYERSLOT                = BIT(14); /// This ent is a player slot on a multi-person vehicle
77
78 // fields:
79 .entity tur_head;
80 .entity vehicledef;