]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Apply strength sound and buff shield stats to the entity directly rather than player...
authorMario <mario.mario@y7mail.com>
Sun, 30 May 2021 23:59:44 +0000 (09:59 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 30 May 2021 23:59:44 +0000 (09:59 +1000)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/powerups/sv_powerups.qc
qcsrc/server/client.qh

index 7bc6cd71286d28e24d86ae1f12762a99e06ff223..c2eb01618d5e62828b62b8246b48fb0e2088b2d0 100644 (file)
@@ -208,7 +208,7 @@ void buff_Touch(entity this, entity toucher)
        || (STAT(FROZEN, toucher))
        || (toucher.vehicle)
        || (!this.buffdef) // TODO: error out or maybe reset type if this occurs?
-       || (time < PS(toucher).buff_shield)
+       || (time < toucher.buff_shield)
        )
        {
                // can't touch this
@@ -527,8 +527,7 @@ METHOD(Buff, m_remove, void(StatusEffects this, entity actor, int removal_type))
                }
                else if(removal_type == STATUSEFFECT_REMOVE_NORMAL && !IS_INDEPENDENT_PLAYER(actor))
                        Send_Notification(NOTIF_ALL_EXCEPT, actor, MSG_INFO, INFO_ITEM_BUFF_LOST, actor.netname, buffid);
-               entity store = IS_PLAYER(actor) ? PS(actor) : actor;
-               store.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
+               actor.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
        }
        if(IS_PLAYER(actor))
                actor.effects &= ~EF_NOSHADOW;
@@ -804,7 +803,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST)
                        Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
 
                buff_RemoveAll(player, STATUSEFFECT_REMOVE_NORMAL);
-               PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
+               player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
                sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                return true;
        }
index e727d493f899cd9a75cd8ff8c789fe4935f4e636..c4b79eb9c2a09ac5617367cb56efa03883965f78 100644 (file)
@@ -3,16 +3,15 @@
 MUTATOR_HOOKFUNCTION(powerups, W_PlayStrengthSound)
 {
        entity player = M_ARGV(0, entity);
-       entity store = IS_PLAYER(player) ? PS(player) : player; // because non-player entities can fire weapons
 
        if(StatusEffects_active(STATUSEFFECT_Strength, player)
-               && ((time > store.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
-               || (time > store.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
                {
                        sound(player, CH_TRIGGER, SND_STRENGTH_FIRE, VOL_BASE, ATTEN_NORM);
-                       store.prevstrengthsound = time;
+                       player.prevstrengthsound = time;
                }
-       store.prevstrengthsoundattempt = time;
+       player.prevstrengthsoundattempt = time;
 }
 
 MUTATOR_HOOKFUNCTION(powerups, LogDeath_AppendItemCodes)
index 31d65f948608c1ba8e394b11970f73bd3c4f1412..3199d155a9c853c17d82cf67b5c26c3d7b467fe1 100644 (file)
@@ -275,9 +275,6 @@ CLASS(Player, Client)
     ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
     ATTRIB(Player, itemkeys, int, this.itemkeys);
     ATTRIB(Player, ballistics_density, float, this.ballistics_density);
-    ATTRIB(Player, prevstrengthsound, float, this.prevstrengthsound);
-    ATTRIB(Player, prevstrengthsoundattempt, float, this.prevstrengthsoundattempt);
-    ATTRIB(Player, buff_shield, float, this.buff_shield);
 
     INIT(Player) {
         this.classname = STR_PLAYER;