return limit;
}
-float GetResourceAmount(entity e, int res_type)
+float GetResource(entity e, int res_type)
{
return e.(GetResourceField(res_type));
}
-void SetResourceAmount(entity e, int res_type, float amount)
+void SetResource(entity e, int res_type, float amount)
{
- bool forbid = MUTATOR_CALLHOOK(SetResourceAmount, e, res_type, amount);
+ bool forbid = MUTATOR_CALLHOOK(SetResource, e, res_type, amount);
if (forbid)
{
return;
{
return;
}
- SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) + amount);
+ SetResource(receiver, res_type, GetResource(receiver, res_type) + amount);
switch (res_type)
{
case RES_HEALTH:
{
return;
}
- float current_amount = GetResourceAmount(receiver, res_type);
+ float current_amount = GetResource(receiver, res_type);
if (current_amount + amount > limit && limit != RES_LIMIT_NONE)
{
amount = limit - current_amount;
{
return;
}
- SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) - amount);
+ SetResource(receiver, res_type, GetResource(receiver, res_type) - amount);
}
void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
{
return;
}
- float current_amount = GetResourceAmount(receiver, res_type);
+ float current_amount = GetResource(receiver, res_type);
if (current_amount - amount < -limit)
{
amount = -limit + current_amount;