mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
feat: multiple components per entity support
This commit is contained in:
parent
a6aa42a521
commit
8f379f2ee7
8 changed files with 120 additions and 65 deletions
|
|
@ -90,12 +90,15 @@ entityid_t Entities::spawn(
|
|||
create_trigger_callback<scripting::on_trigger_exit>(this)
|
||||
};
|
||||
}
|
||||
auto& scripting = registry.emplace<Scripting>(
|
||||
entity, entity_funcs_set {}, nullptr);
|
||||
auto& scripting = registry.emplace<ScriptComponents>(entity);
|
||||
entities[id] = entity;
|
||||
registry.emplace<rigging::Rig>(entity, rig->instance());
|
||||
scripting.env = scripting::on_entity_spawn(
|
||||
def, id, scripting.funcsset, std::move(args));
|
||||
for (auto& componentName : def.components) {
|
||||
auto component = std::make_unique<UserComponent>(
|
||||
componentName, entity_funcs_set {}, nullptr);
|
||||
scripting.components.emplace_back(std::move(component));
|
||||
}
|
||||
scripting::on_entity_spawn(def, id, scripting.components, std::move(args));
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue