Add arms destructor (cleans up attached components
This commit is contained in:
@@ -28,6 +28,13 @@ ECS_MOVE(Path, dst, src, {
|
|||||||
*dst = *src;
|
*dst = *src;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ECS_DTOR(Arms, arms, {
|
||||||
|
if (arms->primary)
|
||||||
|
ecs_delete(ECS, arms->primary);
|
||||||
|
if (arms->secondary)
|
||||||
|
ecs_delete(ECS, arms->secondary);
|
||||||
|
});
|
||||||
|
|
||||||
void setupSystems() {
|
void setupSystems() {
|
||||||
ecs_set_hooks(ECS, SpatialGridID, {
|
ecs_set_hooks(ECS, SpatialGridID, {
|
||||||
.dtor = ecs_dtor(SpatialGridID),
|
.dtor = ecs_dtor(SpatialGridID),
|
||||||
@@ -37,6 +44,9 @@ void setupSystems() {
|
|||||||
.dtor = ecs_dtor(Path),
|
.dtor = ecs_dtor(Path),
|
||||||
.move_dtor = ecs_move(Path)
|
.move_dtor = ecs_move(Path)
|
||||||
});
|
});
|
||||||
|
ecs_set_hooks(ECS, Arms, {
|
||||||
|
.dtor = ecs_dtor(Arms)
|
||||||
|
});
|
||||||
|
|
||||||
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user