63 error(
"GetResourceLimit: Invalid resource type.");
78 return e.(GetResourceField(res_type));
83 .float res_field = GetResourceField(res_type);
84 if (e.(res_field) != amount)
86 e.(res_field) = amount;
100 amount =
M_ARGV(2,
float);
102 float amount_wasted = 0;
105 amount_wasted = amount - max_amount;
113 if (amount_wasted == 0)
132 amount =
M_ARGV(2,
float);
143 receiver.pauserothealth_finished =
144 max(receiver.pauserothealth_finished,
time +
150 receiver.pauserotarmor_finished =
151 max(receiver.pauserotarmor_finished,
time +
157 receiver.pauserotfuel_finished =
max(receiver.pauserotfuel_finished,
176 amount =
M_ARGV(2,
float);
182 float current_amount =
GetResource(receiver, res_type);
185 amount = limit - current_amount;
202 amount =
M_ARGV(2,
float);
222 amount =
M_ARGV(2,
float);
228 float current_amount =
GetResource(receiver, res_type);
229 if (current_amount - amount < -limit)
231 amount = -limit + current_amount;
float autocvar_g_balance_pause_armor_rot
Header file that describes the resource system.
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
const int RES_AMOUNT_HARD_LIMIT
Unconditional maximum amount of resources the entity can have.
float autocvar_g_balance_fuel_limit
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
float g_pickup_rockets_max
float g_pickup_shells_max
int autocvar_g_balance_armor_limit
float GetResourceLimit(entity e, Resource res_type)
Returns the maximum amount of the given resource.
float autocvar_g_balance_pause_health_rot
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
void TakeResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Takes an entity some resource but not less than a limit.
float g_pickup_plasma_max
#define MUTATOR_CALLHOOK(id,...)
float autocvar_g_balance_health_limit
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float autocvar_g_balance_pause_fuel_rot