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