]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Clear out .health and .armorvalue from the client side
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 24a0e0e1aab630da7ba311515a7aeb5a778482d1..d0e2074856e55dbeac63782faaf9811f0ac16cd8 100644 (file)
@@ -1756,13 +1756,13 @@ void player_regen(entity this)
        // Ugly hack to make sure the health and armor don't go beyond hard limit.
        // TODO: Remove this hack when all code uses GivePlayerHealth and
        // GivePlayerArmor.
-       if (this.health > RESOURCE_AMOUNT_HARD_LIMIT)
+       if (GetResourceAmount(this, RESOURCE_HEALTH) > RESOURCE_AMOUNT_HARD_LIMIT)
        {
-               this.health = RESOURCE_AMOUNT_HARD_LIMIT;
+               SetResourceAmountExplicit(this, RESOURCE_HEALTH, RESOURCE_AMOUNT_HARD_LIMIT);
        }
-       if (this.armorvalue > RESOURCE_AMOUNT_HARD_LIMIT)
+       if (GetResourceAmount(this, RESOURCE_ARMOR) > RESOURCE_AMOUNT_HARD_LIMIT)
        {
-               this.armorvalue = RESOURCE_AMOUNT_HARD_LIMIT;
+               SetResourceAmountExplicit(this, RESOURCE_ARMOR, RESOURCE_AMOUNT_HARD_LIMIT);
        }
        // End hack.
 }