12 return e.(GetResourceField(res_type));
18 if (e.(res_field) != amount)
20 e.(res_field) = amount;
46 float current_amount =
GetResource(receiver, res_type);
47 if (current_amount - amount < limit)
49 amount = limit + current_amount;
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.
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.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Header file that describes the resource system.
float GetResourceField(Resource res_type)
Converts resource type (a RES_* constant) to entity field.