]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/nades/nades.qh
Merge branch 'master' into Lyberta/TeamplayOverhaul
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qh
1 #pragma once
2
3 #include <common/teams.qh>
4
5 // use slots 70-100
6 const int PROJECTILE_NADE = 71;
7 const int PROJECTILE_NADE_BURN = 72;
8 const int PROJECTILE_NADE_NAPALM = 73;
9 const int PROJECTILE_NADE_NAPALM_BURN = 74;
10 const int PROJECTILE_NAPALM_FOUNTAIN = 75;
11 const int PROJECTILE_NADE_ICE = 76;
12 const int PROJECTILE_NADE_ICE_BURN = 77;
13 const int PROJECTILE_NADE_TRANSLOCATE = 78;
14 const int PROJECTILE_NADE_SPAWN = 79;
15 const int PROJECTILE_NADE_HEAL = 80;
16 const int PROJECTILE_NADE_HEAL_BURN = 81;
17 const int PROJECTILE_NADE_MONSTER = 82;
18 const int PROJECTILE_NADE_MONSTER_BURN = 83;
19 const int PROJECTILE_NADE_ENTRAP = 84;
20 const int PROJECTILE_NADE_ENTRAP_BURN = 85;
21 const int PROJECTILE_NADE_VEIL = 86;
22 const int PROJECTILE_NADE_VEIL_BURN = 87;
23
24 REGISTRY(Nades, BITS(4))
25 #define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
26 REGISTER_REGISTRY(Nades)
27 REGISTRY_CHECK(Nades)
28
29 #define REGISTER_NADE(id) REGISTER(Nades, NADE_TYPE, id, m_id, NEW(Nade))
30
31 CLASS(Nade, Object)
32     ATTRIB(Nade, m_id, int, 0);
33     ATTRIB(Nade, m_color, vector, '0 0 0');
34     ATTRIB(Nade, m_name, string, _("Grenade"));
35     ATTRIB(Nade, m_icon, string, "nade_normal");
36     ATTRIB(Nade, m_alpha, float, 1);
37     ATTRIBARRAY(Nade, m_projectile, int, 2);
38     ATTRIBARRAY(Nade, m_trail, entity, 2);
39     METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
40         returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
41     }
42 ENDCLASS(Nade)
43
44 REGISTER_NADE(Null);
45
46 Nade Nade_FromProjectile(int proj)
47 {
48     FOREACH(Nades, true, {
49         for (int j = 0; j < 2; j++)
50         {
51             if (it.m_projectile[j] == proj) return it;
52         }
53     });
54     return NADE_TYPE_Null;
55 }
56
57 #ifdef GAMEQC
58 #include "effects.inc"
59 #endif
60
61 #include "nades.inc"
62
63 .float orb_lifetime;
64 .float orb_radius;
65
66 #ifdef SVQC
67
68 .entity nade;
69 .entity fake_nade;
70 .float nade_refire;
71 .float nade_special_time;
72 .string pokenade_type;
73 .entity nade_damage_target;
74 .float cvar_cl_nade_type;
75 .string cvar_cl_pokenade_type;
76 .float toss_time;
77 .float nade_show_particles;
78 .float nade_veil_prevalpha;
79
80 bool orb_send(entity this, entity to, int sf);
81
82 // Remove nades that are being thrown
83 void nades_Clear(entity player);
84
85 // Give a bonus grenade to a player
86 void nades_GiveBonus(entity player, float score);
87
88 /**
89  * called to adjust nade damage and force on hit
90  */
91 #define EV_Nade_Damage(i, o) \
92     /** nade */   i(entity, MUTATOR_ARGV_0_entity) \
93         /** weapon */ i(entity, MUTATOR_ARGV_1_entity) \
94     /** force */  i(vector, MUTATOR_ARGV_2_vector) \
95     /**/          o(vector, MUTATOR_ARGV_2_vector) \
96         /** damage */ i(float,  MUTATOR_ARGV_3_float) \
97     /**/          o(float,  MUTATOR_ARGV_3_float) \
98     /**/
99 MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
100
101 #endif
102
103 #ifdef CSQC
104 bool Projectile_isnade(int proj); // TODO: remove
105
106 void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time); // TODO: mutator
107 #endif