]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/buffs/cl_buffs.qc
Merge branch 'master' into Mario/csqc_muzzleflash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / cl_buffs.qc
1 #include "cl_buffs.qh"
2
3 REGISTER_MUTATOR(cl_buffs, true);
4 MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
5 {
6         int allBuffs = STAT(BUFFS);
7         if (allBuffs)
8                 FOREACH(Buffs, it.m_itemid & allBuffs, {
9                         addPowerupItem(it.m_name, strcat("buff_", it.netname), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
10                 });
11 }
12 MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
13 {
14     entity this = M_ARGV(0, entity);
15     string s = M_ARGV(1, string);
16     if (s == WP_Buff.netname || s == RADARICON_Buff.netname)
17     {
18         Buff b = REGISTRY_GET(Buffs, this.wp_extra);
19         M_ARGV(2, vector) = b.m_color;
20         M_ARGV(3, string) = b.m_name;
21         M_ARGV(4, string) = strcat("buff_", b.netname);
22         return true;
23     }
24 }