]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/nades/nades.qh
Merge branch 'master' into terencehill/menu_optimization
[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 "../../../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
21 REGISTRY(Nades, BITS(4))
22 #define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
23 REGISTER_REGISTRY(Nades)
24 REGISTRY_CHECK(Nades)
25
26 #define REGISTER_NADE(id) REGISTER(Nades, NADE_TYPE, id, m_id, NEW(Nade))
27
28 CLASS(Nade, Object)
29     ATTRIB(Nade, m_id, int, 0)
30     ATTRIB(Nade, m_color, vector, '0 0 0')
31     ATTRIB(Nade, m_name, string, _("Grenade"))
32     ATTRIB(Nade, m_icon, string, "nade_normal")
33     ATTRIBARRAY(Nade, m_projectile, int, 2)
34     ATTRIBARRAY(Nade, m_trail, entity, 2)
35     METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
36         returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
37     }
38 ENDCLASS(Nade)
39
40 REGISTER_NADE(Null);
41
42 Nade Nade_FromProjectile(int proj)
43 {
44     FOREACH(Nades, true, LAMBDA(
45         for (int j = 0; j < 2; j++)
46         {
47             if (it.m_projectile[j] == proj) return it;
48         }
49     ));
50     return NADE_TYPE_Null;
51 }
52
53 #ifndef MENUQC
54 #include "effects.inc"
55 #endif
56
57 #include "nades.inc"
58
59 .float healer_lifetime;
60 .float healer_radius;
61
62 #ifdef SVQC
63
64 .entity nade;
65 .entity fake_nade;
66 .float nade_timer = _STAT(NADE_TIMER);
67 .float nade_refire;
68 .float bonus_nades = _STAT(NADE_BONUS);
69 .float nade_special_time;
70 .float bonus_nade_score = _STAT(NADE_BONUS_SCORE);
71 .int nade_type = _STAT(NADE_BONUS_TYPE);
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 stat_healing_orb = _STAT(HEALING_ORB);
78 .float stat_healing_orb_alpha = _STAT(HEALING_ORB_ALPHA);
79 .float nade_show_particles;
80
81 bool healer_send(entity this, entity to, int sf);
82
83 // Remove nades that are being thrown
84 void nades_Clear(entity player);
85
86 // Give a bonus grenade to a player
87 void(entity player, float score) nades_GiveBonus;
88
89 /**
90  * called to adjust nade damage and force on hit
91  */
92 #define EV_Nade_Damage(i, o) \
93         /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \
94     /** force */  i(vector, MUTATOR_ARGV_0_vector) \
95     /**/          o(vector, MUTATOR_ARGV_0_vector) \
96         /** damage */ i(float,  MUTATOR_ARGV_0_float) \
97     /**/          o(float,  MUTATOR_ARGV_0_float) \
98     /**/
99 MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
100
101 #endif
102
103 #endif