#include "component_action_on_delete_give_goodies.h"

/* DEPENDENCIES: Goodies, ActEntity */
/* On deletion, give goodies to the ID belonging to ActEntity. */

/* Initializes action on delete give goodies component. */
void
component_action_on_delete_give_goodies_init(ComponentActionOnDeleteGiveGoodies* self, u32 value)
{
	self->value = value;
}

/* Ticks aciton on delete give goodies component. */
void
component_action_on_delete_give_goodies_delete(ComponentActionOnDeleteGiveGoodies* self, ECS* ecs)
{
	ComponentActEntity* actEntity;
	ComponentGoodies* goodies;

	actEntity = ecs_component_get(ecs, ECS_COMPONENT_ACT_ENTITY, self->component.id);
	goodies = ecs_component_get(ecs, ECS_COMPONENT_GOODIES, actEntity->id);

	goodies->value += self->value;
}
