]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/nades/nades.qh
c5a1967e0b53ffa14bd4e0e756070cf7fb584802
[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
22 REGISTRY(Nades, BITS(4))
23 #define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
24 REGISTER_REGISTRY(Nades)
25 REGISTRY_CHECK(Nades)
26
27 #define REGISTER_NADE(id) REGISTER(Nades, NADE_TYPE, id, m_id, NEW(Nade))
28
29 CLASS(Nade, Object)
30     ATTRIB(Nade, m_id, int, 0);
31     ATTRIB(Nade, m_color, vector, '0 0 0');
32     ATTRIB(Nade, m_name, string, _("Grenade"));
33     ATTRIB(Nade, m_icon, string, "nade_normal");
34     ATTRIBARRAY(Nade, m_projectile, int, 2);
35     ATTRIBARRAY(Nade, m_trail, entity, 2);
36     METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
37         returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
38     }
39 ENDCLASS(Nade)
40
41 REGISTER_NADE(Null);
42
43 Nade Nade_FromProjectile(int proj)
44 {
45     FOREACH(Nades, true, {
46         for (int j = 0; j < 2; j++)
47         {
48             if (it.m_projectile[j] == proj) return it;
49         }
50     });
51     return NADE_TYPE_Null;
52 }
53
54 #ifdef GAMEQC
55 #include "effects.inc"
56 #endif
57
58 #include "nades.inc"
59
60 .float orb_lifetime;
61 .float orb_radius;
62
63 #ifdef SVQC
64
65 .entity nade;
66 .entity fake_nade;
67 .float nade_refire;
68 .float nade_special_time;
69 .string pokenade_type;
70 .entity nade_damage_target;
71 .float cvar_cl_nade_type;
72 .string cvar_cl_pokenade_type;
73 .float toss_time;
74 .float nade_show_particles;
75
76 bool orb_send(entity this, entity to, int sf);
77
78 // Remove nades that are being thrown
79 void nades_Clear(entity player);
80
81 // Give a bonus grenade to a player
82 void nades_GiveBonus(entity player, float score);
83
84 /**
85  * called to adjust nade damage and force on hit
86  */
87 #define EV_Nade_Damage(i, o) \
88     /** nade */   i(entity, MUTATOR_ARGV_0_entity) \
89         /** weapon */ i(entity, MUTATOR_ARGV_1_entity) \
90     /** force */  i(vector, MUTATOR_ARGV_2_vector) \
91     /**/          o(vector, MUTATOR_ARGV_2_vector) \
92         /** damage */ i(float,  MUTATOR_ARGV_3_float) \
93     /**/          o(float,  MUTATOR_ARGV_3_float) \
94     /**/
95 MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
96
97 #endif