/**/
MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
+/** Called when the amount of resource of an entity changes. See RESOURCE_*
+constants for resource types. Return true to forbid the change. */
+#define EV_SetResourceAmount(i, o) \
+ /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** resource type */ i(int, MUTATOR_ARGV_1_int) \
+ /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** amount */ i(float, MUTATOR_ARGV_2_float) \
+ /**/ o(float, MUTATOR_ARGV_2_float) \
+ /**/
+MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
+
/** Called when entity is being given some resource. See RESOURCE_* constants
for resource types. Return true to forbid giving. */
#define EV_GiveResource(i, o) \
void SetResourceAmount(entity e, int resource_type, float amount)
{
+ bool forbid = MUTATOR_CALLHOOK(SetResourceAmount, e, resource_type, amount);
+ if (forbid)
+ {
+ return;
+ }
+ resource_type = M_ARGV(1, int);
+ amount = M_ARGV(2, float);
.float resource_field = GetResourceField(resource_type);
if (e.(resource_field) == amount)
{