Xonotic
nades.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <common/teams.qh>
4 
5 #ifdef SVQC
6 bool autocvar_g_nades;
7 bool autocvar_g_nades_override_dropweapon = true;
8 vector autocvar_g_nades_throw_offset;
9 bool autocvar_g_nades_spawn;
10 int autocvar_g_nades_spawn_count;
11 bool autocvar_g_nades_client_select;
12 bool autocvar_g_nades_pickup = true;
13 float autocvar_g_nades_pickup_time = 2;
14 float autocvar_g_nades_nade_lifetime;
15 float autocvar_g_nades_nade_minforce;
16 float autocvar_g_nades_nade_maxforce;
17 float autocvar_g_nades_nade_health;
18 float autocvar_g_nades_nade_refire;
19 float autocvar_g_nades_nade_damage;
20 float autocvar_g_nades_nade_edgedamage;
21 float autocvar_g_nades_nade_radius;
22 float autocvar_g_nades_nade_force;
23 int autocvar_g_nades_nade_newton_style;
24 int autocvar_g_nades_napalm_ball_count;
25 float autocvar_g_nades_napalm_ball_spread;
26 float autocvar_g_nades_napalm_ball_damage;
27 float autocvar_g_nades_napalm_ball_damageforcescale;
28 float autocvar_g_nades_napalm_ball_lifetime;
29 float autocvar_g_nades_napalm_ball_radius;
30 bool autocvar_g_nades_napalm_blast;
31 float autocvar_g_nades_napalm_fountain_lifetime;
32 float autocvar_g_nades_napalm_fountain_delay;
33 float autocvar_g_nades_napalm_fountain_radius;
34 float autocvar_g_nades_napalm_fountain_damage;
35 float autocvar_g_nades_napalm_fountain_edgedamage;
36 float autocvar_g_nades_napalm_burntime;
37 bool autocvar_g_nades_napalm_selfdamage;
38 int autocvar_g_nades_nade_type;
39 int autocvar_g_nades_bonus_type;
40 bool autocvar_g_nades_bonus;
41 bool autocvar_g_nades_bonus_onstrength;
42 bool autocvar_g_nades_bonus_client_select;
43 bool autocvar_g_nades_bonus_only;
44 int autocvar_g_nades_bonus_max;
45 int autocvar_g_nades_bonus_score_max;
46 int autocvar_g_nades_bonus_score_time;
47 int autocvar_g_nades_bonus_score_time_flagcarrier;
48 int autocvar_g_nades_bonus_score_minor;
49 int autocvar_g_nades_bonus_score_low;
50 int autocvar_g_nades_bonus_score_high;
51 int autocvar_g_nades_bonus_score_medium;
52 int autocvar_g_nades_bonus_score_spree;
53 float autocvar_g_nades_ice_freeze_time;
54 float autocvar_g_nades_ice_health;
55 bool autocvar_g_nades_ice_explode;
56 bool autocvar_g_nades_ice_teamcheck;
57 float autocvar_g_nades_heal_time;
58 float autocvar_g_nades_heal_rate;
59 float autocvar_g_nades_heal_friend;
60 float autocvar_g_nades_heal_foe;
61 float autocvar_g_nades_entrap_strength = 0.01;
62 float autocvar_g_nades_entrap_speed = 0.5;
63 float autocvar_g_nades_entrap_radius = 500;
64 float autocvar_g_nades_entrap_time = 10;
65 float autocvar_g_nades_veil_time = 8;
66 float autocvar_g_nades_veil_radius = 300;
67 string autocvar_g_nades_pokenade_monster_type;
68 float autocvar_g_nades_pokenade_monster_lifetime;
69 #endif
70 
71 // use slots 70-100
72 const int PROJECTILE_NADE = 71;
73 const int PROJECTILE_NADE_BURN = 72;
74 const int PROJECTILE_NADE_NAPALM = 73;
77 const int PROJECTILE_NADE_ICE = 76;
78 const int PROJECTILE_NADE_ICE_BURN = 77;
80 const int PROJECTILE_NADE_SPAWN = 79;
81 const int PROJECTILE_NADE_HEAL = 80;
83 const int PROJECTILE_NADE_MONSTER = 82;
85 const int PROJECTILE_NADE_ENTRAP = 84;
87 const int PROJECTILE_NADE_VEIL = 86;
89 
90 REGISTRY(Nades, BITS(4))
91 REGISTER_REGISTRY(Nades)
92 REGISTRY_CHECK(Nades)
93 
94 #define REGISTER_NADE(id) REGISTER(Nades, NADE_TYPE, id, m_id, NEW(Nade))
95 
97  ATTRIB(Nade, m_id, int, 0);
98  ATTRIB(Nade, m_color, vector, '0 0 0');
99  ATTRIB(Nade, m_name, string, _("Grenade"));
100  ATTRIB(Nade, m_icon, string, "nade_normal");
101  ATTRIB(Nade, m_alpha, float, 1);
102  ATTRIBARRAY(Nade, m_projectile, int, 2);
103  ATTRIBARRAY(Nade, m_trail, entity, 2);
104  METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
105  returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
106  }
107 ENDCLASS(Nade)
108 
109 REGISTER_NADE(Null);
110 REGISTRY_DEFINE_GET(Nades, NADE_TYPE_Null)
111 
113 {
114  FOREACH(Nades, true, {
115  for (int j = 0; j < 2; j++)
116  {
117  if (it.m_projectile[j] == proj) return it;
118  }
119  });
120  return NADE_TYPE_Null;
121 }
122 
123 #ifdef GAMEQC
124 #include "effects.inc"
125 #endif
126 
127 #include "nades.inc"
128 
130 .float orb_radius;
131 
132 #ifdef GAMEQC
133 REPLICATE_INIT(int, cvar_cl_nade_type);
134 REPLICATE_INIT(string, cvar_cl_pokenade_type);
135 #endif
136 
137 #ifdef SVQC
138 
139 .entity nade;
140 .entity fake_nade;
141 .float nade_refire;
142 .float nade_special_time;
143 .string pokenade_type;
144 .entity nade_damage_target;
145 .float toss_time;
146 .float nade_show_particles;
147 .float nade_veil_prevalpha;
148 
149 bool orb_send(entity this, entity to, int sf);
150 
151 // Remove nades that are being thrown
152 void nades_Clear(entity player);
153 
154 // Give a bonus grenade to a player
155 void nades_GiveBonus(entity player, float score);
156 
160 #define EV_Nade_Damage(i, o) \
161  i(entity, MUTATOR_ARGV_0_entity) \
162  i(entity, MUTATOR_ARGV_1_entity) \
163  i(vector, MUTATOR_ARGV_2_vector) \
164  o(vector, MUTATOR_ARGV_2_vector) \
165  i(float, MUTATOR_ARGV_3_float) \
166  o(float, MUTATOR_ARGV_3_float) \
167 
168 MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
169 
170 #endif
171 
172 #ifdef CSQC
173 bool Projectile_isnade(int proj); // TODO: remove
174 
175 void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time); // TODO: mutator
176 #endif
#define MUTATOR_HOOKABLE(id, params)
Definition: base.qh:126
const int PROJECTILE_NAPALM_FOUNTAIN
Definition: nades.qh:76
const int PROJECTILE_NADE_NAPALM
Definition: nades.qh:74
REPLICATE_INIT(float, cvar_cl_autotaunt)
const int PROJECTILE_NADE_ENTRAP_BURN
Definition: nades.qh:86
Definition: nades.qh:96
CLASS(Object) Object
Definition: oo.qh:318
const int PROJECTILE_NADE
Definition: nades.qh:72
entity() spawn
void nades_Clear(entity player)
#define REGISTRY_CHECK(id)
Definition: registry.qh:175
entity to
Definition: self.qh:96
const int PROJECTILE_NADE_SPAWN
Definition: nades.qh:80
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
float m_alpha
Definition: weaponsystem.qc:74
const int PROJECTILE_NADE_MONSTER
Definition: nades.qh:83
const int PROJECTILE_NADE_HEAL
Definition: nades.qh:81
const int PROJECTILE_NADE_TRANSLOCATE
Definition: nades.qh:79
const int PROJECTILE_NADE_NAPALM_BURN
Definition: nades.qh:75
#define ATTRIB(...)
Definition: oo.qh:136
#define REGISTER_REGISTRY(id)
Definition: registry.qh:212
const int PROJECTILE_NADE_ENTRAP
Definition: nades.qh:85
Nade Nade_FromProjectile(int proj)
Definition: nades.qh:112
#define REGISTRY_DEFINE_GET(id, null)
Definition: registry.qh:40
const int PROJECTILE_NADE_HEAL_BURN
Definition: nades.qh:82
int m_id
Definition: effect.qh:19
#define REGISTER_NADE(id)
Definition: nades.qh:94
#define REGISTRY(id, max)
Declare a new registry.
Definition: registry.qh:26
float orb_lifetime
Definition: nades.qh:129
const int PROJECTILE_NADE_VEIL
Definition: nades.qh:87
void nades_GiveBonus(entity player, float score)
entity this
Definition: self.qh:83
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float orb_radius
Definition: nades.qh:130
const int PROJECTILE_NADE_BURN
Definition: nades.qh:73
const int PROJECTILE_NADE_ICE
Definition: nades.qh:77
#define ENDCLASS(cname)
Definition: oo.qh:269
#define nade(name, colormin1, colormax1, colormin2, colormax2)
const int PROJECTILE_NADE_ICE_BURN
Definition: nades.qh:78
const int PROJECTILE_NADE_VEIL_BURN
Definition: nades.qh:88
#define ATTRIBARRAY(cname, name, type, cnt)
Definition: oo.qh:254
#define FOREACH(list, cond, body)
Definition: iter.qh:19
const int PROJECTILE_NADE_MONSTER_BURN
Definition: nades.qh:84
#define BITS(n)
Definition: bits.qh:9
string m_name
Definition: scores.qh:135