58 error(
"GetResourceLimit: Invalid resource type.");
73 return e.(GetResourceField(res_type));
79 if (e.(res_field) != amount)
81 e.(res_field) = amount;
97 float amount_wasted = 0;
100 amount_wasted = amount - max_amount;
108 if (amount_wasted == 0)
127 amount =
M_ARGV(9,
float);
138 receiver.pauserothealth_finished =
139 max(receiver.pauserothealth_finished,
time +
145 receiver.pauserotarmor_finished =
146 max(receiver.pauserotarmor_finished,
time +
152 receiver.pauserotfuel_finished =
max(receiver.pauserotfuel_finished,
171 amount =
M_ARGV(9,
float);
172 limit =
M_ARGV(10,
float);
177 float current_amount =
GetResource(receiver, res_type);
180 amount = limit - current_amount;
197 amount =
M_ARGV(9,
float);
217 amount =
M_ARGV(9,
float);
218 limit =
M_ARGV(10,
float);
223 float current_amount =
GetResource(receiver, res_type);
224 if (current_amount - amount < -limit)
226 amount = -limit + current_amount;
233 if (wpn.ammo_type == RES_NONE)
return 0;
236 case WEP_ARC:
return WEP_CVAR(WEP_ARC, beam_ammo);
237 case WEP_DEVASTATOR:
return WEP_CVAR(WEP_DEVASTATOR,
ammo);
238 case WEP_MACHINEGUN:
return WEP_CVAR(WEP_MACHINEGUN, sustained_ammo);
239 case WEP_MINE_LAYER:
return WEP_CVAR(WEP_MINE_LAYER,
ammo);
240 case WEP_SEEKER:
return WEP_CVAR(WEP_SEEKER, tag_ammo);
#define MUTATOR_CALLHOOK(id,...)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void TakeResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Takes an entity some resource but not less than a limit.
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
int autocvar_g_pickup_rockets_max
int autocvar_g_pickup_shells_max
int autocvar_g_pickup_cells_max
int autocvar_g_pickup_nails_max
float GetResourceField(Resource res_type)
Converts resource type (a RES_* constant) to entity field.
const int RES_AMOUNT_HARD_LIMIT
Unconditional maximum amount of resources the entity can have.
void TakeResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Takes an entity some resource but not less than a limit.
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
float GetResourceLimit(entity e, Resource res_type)
Returns the maximum amount of the given resource.
int GetAmmoConsumption(entity wpn)
Returns ammo consumed per shot by the primary/default fire mode.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
Header file that describes the resource system.
float autocvar_g_balance_fuel_limit
int autocvar_g_balance_armor_limit
float autocvar_g_balance_pause_armor_rot
float autocvar_g_balance_pause_health_rot
float autocvar_g_balance_health_limit
float autocvar_g_balance_pause_fuel_rot
#define WEP_CVAR_PRI(wep, name)
#define WEP_CVAR(wep, name)