]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/buffs/module.inc
Remove flight buff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / module.inc
1 #include "all.qc"
2 #ifdef SVQC
3 #include "buffs.qc"
4 #endif
5
6 #ifdef IMPLEMENTATION
7
8 string BUFF_NAME(int i)
9 {
10     Buff b = Buffs_from(i);
11     return sprintf("%s%s", rgb_to_hexcolor(b.m_color), b.m_prettyName);
12 }
13
14 #ifdef CSQC
15 REGISTER_MUTATOR(cl_buffs, true);
16 MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
17 {
18     int allBuffs = STAT(BUFFS);
19     FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
20                 addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
21         ));
22 }
23 MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
24 {
25     entity this = MUTATOR_ARGV(0, entity);
26     string s = MUTATOR_ARGV(0, string);
27     if (s == WP_Buff.netname || s == RADARICON_Buff.netname)
28     {
29         Buff b = Buffs_from(this.wp_extra);
30         MUTATOR_ARGV(0, vector) = b.m_color;
31         MUTATOR_ARGV(0, string) = b.m_prettyName;
32         return true;
33     }
34 }
35
36 #endif
37 #endif