_friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
_enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, bound(0, GetResourceAmount(this, RESOURCE_HEALTH) + (_friendly_count - _enemy_count), this.max_health));
+ GiveResourceWithLimit(this, RESOURCE_HEALTH, (_friendly_count - _enemy_count), this.max_health);
this.SendFlags |= CPSF_STATUS;
if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
{
if(!a)
return;
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) + this.count);
+ GiveResource(this, RESOURCE_HEALTH, this.count);
this.SendFlags |= CPSF_STATUS;
if(take)
{
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) - take);
+ TakeResource(this, RESOURCE_HEALTH, take);
Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
}
thehook.owner.damage_dealt += autocvar_g_vampirehook_damage;
Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, DMG_NOWEP, thehook.origin, '0 0 0');
if(SAME_TEAM(thehook.owner, thehook.aiment))
- SetResourceAmountExplicit(thehook.aiment, RESOURCE_HEALTH, min(GetResourceAmount(thehook.aiment, RESOURCE_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
+ GiveResourceWithLimit(thehook.aiment, RESOURCE_HEALTH, autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
else
- SetResourceAmountExplicit(thehook.owner, RESOURCE_HEALTH, min(GetResourceAmount(thehook.owner, RESOURCE_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
+ GiveResourceWithLimit(thehook.owner, RESOURCE_HEALTH, autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
if(dmgent == thehook.owner)
- SetResourceAmountExplicit(dmgent, RESOURCE_HEALTH, GetResourceAmount(dmgent, RESOURCE_HEALTH) - autocvar_g_vampirehook_damage); // FIXME: friendly fire?!s
+ TakeResource(dmgent, RESOURCE_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
}
}
#ifdef SVQC
if (!(ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO))
- SetResourceAmountExplicit(this, RESOURCE_FUEL, GetResourceAmount(this, RESOURCE_FUEL) - PHYS_JETPACK_FUEL(this) * dt * fvel * f);
+ TakeResource(this, RESOURCE_FUEL, PHYS_JETPACK_FUEL(this) * dt * fvel * f);
ITEMS_STAT(this) |= IT_USING_JETPACK;
else if(IS_CLIENT(trace_ent))
{
if(GetResourceAmount(trace_ent, RESOURCE_HEALTH) <= autocvar_g_vehicle_bumblebee_healgun_hmax && autocvar_g_vehicle_bumblebee_healgun_hps)
- SetResourceAmountExplicit(trace_ent, RESOURCE_HEALTH, min(GetResourceAmount(trace_ent, RESOURCE_HEALTH) + autocvar_g_vehicle_bumblebee_healgun_hps * dt, autocvar_g_vehicle_bumblebee_healgun_hmax));
+ GiveResourceWithLimit(trace_ent, RESOURCE_HEALTH, autocvar_g_vehicle_bumblebee_healgun_hps * dt, autocvar_g_vehicle_bumblebee_healgun_hmax);
if(GetResourceAmount(trace_ent, RESOURCE_ARMOR) <= autocvar_g_vehicle_bumblebee_healgun_amax && autocvar_g_vehicle_bumblebee_healgun_aps)
- SetResourceAmountExplicit(trace_ent, RESOURCE_ARMOR, min(GetResourceAmount(trace_ent, RESOURCE_ARMOR) + autocvar_g_vehicle_bumblebee_healgun_aps * dt, autocvar_g_vehicle_bumblebee_healgun_amax));
+ GiveResourceWithLimit(trace_ent, RESOURCE_ARMOR, autocvar_g_vehicle_bumblebee_healgun_aps * dt, autocvar_g_vehicle_bumblebee_healgun_amax);
- SetResourceAmountExplicit(trace_ent, RESOURCE_HEALTH, min(GetResourceAmount(trace_ent, RESOURCE_HEALTH) + autocvar_g_vehicle_bumblebee_healgun_hps * dt, autocvar_g_vehicle_bumblebee_healgun_hmax));
+ GiveResourceWithLimit(trace_ent, RESOURCE_HEALTH, autocvar_g_vehicle_bumblebee_healgun_hps * dt, autocvar_g_vehicle_bumblebee_healgun_hmax);
}
else if(IS_TURRET(trace_ent))
{
if(GetResourceAmount(trace_ent, RESOURCE_HEALTH) <= trace_ent.max_health && autocvar_g_vehicle_bumblebee_healgun_hps)
- SetResourceAmountExplicit(trace_ent, RESOURCE_HEALTH, min(GetResourceAmount(trace_ent, RESOURCE_HEALTH) + autocvar_g_vehicle_bumblebee_healgun_hps * dt, trace_ent.max_health));
+ GiveResourceWithLimit(trace_ent, RESOURCE_HEALTH, autocvar_g_vehicle_bumblebee_healgun_hps * dt, trace_ent.max_health);
//else ..hmmm what? ammo?
trace_ent.SendFlags |= TNSF_STATUS;
return; // g_projectiles_damage says to halt
if(this.realowner == attacker)
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) - (damage * 0.25));
+ TakeResource(this, RESOURCE_HEALTH, (damage * 0.25));
else
TakeResource(this, RESOURCE_HEALTH, damage);