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