Xonotic
resources.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef SVQC
4  #include <common/stats.qh>
5 #endif
6 
7 #ifdef CSQC
8 .float health;
10 .float armorvalue;
11 #endif
12 
13 #if 1
14 .int ammo_none;
19 #ifdef SVQC
20 const .int ammo_plasma = _STAT(PLASMA);
21 const .int ammo_fuel = _STAT(FUEL);
22 #else
24 .int ammo_fuel;
25 #endif
26 #endif
27 
29  ATTRIB(Resource, netname, string, "");
30 #ifdef GAMEQC
31  ATTRIB(Resource, m_field, .float, health);
32 #endif
33 ENDCLASS(Resource)
34 
35 #define REGISTER_RESOURCE(id, inst) REGISTER(Resources, RES, id, m_id, inst)
36 REGISTRY(Resources, BITS(4));
37 REGISTER_REGISTRY(Resources)
38 REGISTRY_SORT(Resources);
39 REGISTRY_CHECK(Resources);
40 
41 REGISTRY_DEFINE_GET(Resources, NULL)
42 STATIC_INIT(Resources_renumber) { FOREACH(Resources, true, it.m_id = i); }
43 
45 const int RES_AMOUNT_HARD_LIMIT = 999;
46 const int RES_LIMIT_NONE = -1;
47 
49 REGISTER_RESOURCE(NONE, NEW(Resource));
50 
51 #include "all.inc"
52 
53 #ifdef GAMEQC
54 // ===================== Legacy and/or internal API ===========================
55 
59 Resource GetResourceType(.float res_field);
60 
64 .float GetResourceField(Resource res_type);
65 #endif
int ammo_fuel
Definition: resources.qh:24
STATIC_INIT(Resources_renumber)
Definition: resources.qh:42
int ammo_rockets
Definition: resources.qh:17
#define NEW(cname,...)
Definition: oo.qh:105
CLASS(Object) Object
Definition: oo.qh:318
#define REGISTER_RESOURCE(id, inst)
Definition: resources.qh:35
const int RES_AMOUNT_HARD_LIMIT
Unconditional maximum amount of resources the entity can have.
Definition: resources.qh:45
int ammo_shells
Definition: resources.qh:15
int ammo_nails
Definition: resources.qh:16
string netname
Definition: powerups.qc:20
int ammo_cells
Definition: resources.qh:18
float armorvalue
Definition: progsdefs.qc:179
#define ATTRIB(...)
Definition: oo.qh:136
#define REGISTER_REGISTRY(id)
Definition: registry.qh:212
#define REGISTRY_DEFINE_GET(id, null)
Definition: registry.qh:40
const int RES_LIMIT_NONE
Definition: resources.qh:46
REGISTRY_SORT(Resources)
int ammo_plasma
Definition: resources.qh:23
#define NULL
Definition: post.qh:17
float health
Definition: progsdefs.qc:137
#define ENDCLASS(cname)
Definition: oo.qh:269
REGISTRY(Resources, BITS(4))
REGISTRY_CHECK(Resources)
int ammo_none
Definition: resources.qh:14
#define FOREACH(list, cond, body)
Definition: iter.qh:19
#define BITS(n)
Definition: bits.qh:9