eco2d/code/foundation/src/models/prefabs/furnace.c

27 lines
731 B
C
Raw Normal View History

2022-09-29 14:05:07 +00:00
#include "furnace.h"
2022-09-29 14:16:06 +00:00
#include "models/device.h"
2022-09-29 14:29:31 +00:00
#include "world/world.h"
2022-09-28 05:29:32 +00:00
2022-09-29 14:33:36 +00:00
#include "models/entity.h"
2022-09-29 14:16:06 +00:00
#include "models/components.h"
2022-09-28 05:29:32 +00:00
uint64_t furnace_spawn(void) {
ecs_entity_t e = device_spawn(ASSET_FURNACE);
2022-10-17 17:44:28 +00:00
2022-09-28 05:29:32 +00:00
ItemContainer *storage = ecs_get_mut(world_ecs(), e, ItemContainer);
*storage = (ItemContainer){0};
2022-10-17 17:44:28 +00:00
2022-09-29 15:35:43 +00:00
Producer *producer = ecs_get_mut(world_ecs(), e, Producer);
*producer = (Producer){0};
producer->energy_level = 69.0f;
producer->pending_task = PRODUCER_CRAFT_AUTO;
producer->push_filter = PRODUCER_PUSH_ANY;
2022-10-17 17:44:28 +00:00
2023-01-22 23:58:07 +00:00
ecs_set(world_ecs(), e, ItemRouter, {.push_qty = 1, .counter = 0});
2022-09-28 05:29:32 +00:00
return (uint64_t)e;
}
void furnace_despawn(uint64_t ent_id) {
entity_despawn(ent_id);
}