]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
GetResourceAmount --> GetResource, SetResourceAmount --> SetResource
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index 13e7138fa43c11b0b25307049a66b81f5d79b7a1..6924947f05c0c821b5558648ef471c42fda5be4b 100644 (file)
@@ -440,7 +440,7 @@ void nade_ice_think(entity this)
 
        float current_freeze_time = this.ltime - time - 0.1;
 
-       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RES_HEALTH) > 0 && current_freeze_time > 0,
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResource(it, RES_HEALTH) > 0 && current_freeze_time > 0,
        {
                if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(it, this.realowner) || it == this.realowner))
                if(!it.revival_time || ((time - it.revival_time) >= 1.5))
@@ -632,7 +632,7 @@ void nade_heal_touch(entity this, entity toucher)
                if ( health_factor > 0 )
                {
                        maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
-                       float hp = GetResourceAmount(toucher, RES_HEALTH);
+                       float hp = GetResource(toucher, RES_HEALTH);
                        if (hp < maxhealth)
                        {
                                if (this.nade_show_particles)
@@ -814,7 +814,7 @@ void nade_touch(entity this, entity toucher)
 
        if(autocvar_g_nades_pickup)
        if(time >= this.spawnshieldtime)
-       if(!toucher.nade && GetResourceAmount(this, RES_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
+       if(!toucher.nade && GetResource(this, RES_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
        if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
        if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
        {
@@ -842,7 +842,7 @@ void nade_touch(entity this, entity toucher)
 
        //setsize(this, '-2 -2 -2', '2 2 2');
        //UpdateCSQCProjectile(this);
-       if(GetResourceAmount(this, RES_HEALTH) == this.max_health)
+       if(GetResource(this, RES_HEALTH) == this.max_health)
        {
                spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTEN_NORM);
                return;
@@ -906,7 +906,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
                return;
 
-       float hp = GetResourceAmount(this, RES_HEALTH);
+       float hp = GetResource(this, RES_HEALTH);
        if(hp == this.max_health)
        {
                sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
@@ -915,7 +915,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        }
 
        hp -= damage;
-       SetResourceAmount(this, RES_HEALTH, hp);
+       SetResource(this, RES_HEALTH, hp);
 
 
        if ( STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
@@ -977,8 +977,8 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 
        settouch(_nade, nade_touch);
        _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
-       SetResourceAmount(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
-       _nade.max_health = GetResourceAmount(_nade, RES_HEALTH);
+       SetResource(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
+       _nade.max_health = GetResource(_nade, RES_HEALTH);
        _nade.takedamage = DAMAGE_AIM;
        _nade.event_damage = nade_damage;
        setcefc(_nade, func_null);
@@ -1359,7 +1359,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
        {
                STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               SetResourceAmount(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+               SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
 
                if(STAT(REVIVE_PROGRESS, player) >= 1)
                {
@@ -1479,7 +1479,7 @@ MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
        if(time - frag_inflictor.toss_time <= 0.1)
        {
                Unfreeze(frag_target, false);
-               SetResourceAmount(frag_target, RES_HEALTH, autocvar_g_freezetag_revive_nade_health);
+               SetResource(frag_target, RES_HEALTH, autocvar_g_freezetag_revive_nade_health);
                Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
                M_ARGV(4, float) = 0;
                M_ARGV(6, vector) = '0 0 0';