mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update component parent environment to the pack environment
This commit is contained in:
parent
3fe66e134d
commit
0082a3444e
4 changed files with 27 additions and 32 deletions
|
|
@ -53,20 +53,27 @@ entityid_t Entities::spawn(
|
|||
auto& body = registry.emplace<Rigidbody>(
|
||||
entity, true, Hitbox {pos, def.hitbox}, std::vector<Trigger>{});
|
||||
for (auto& box : def.triggers) {
|
||||
body.triggers.emplace_back(Trigger{true, id, box, AABB{}, {}, {},
|
||||
[=](auto entityid, auto index, auto otherid) {
|
||||
if (auto entity = get(entityid)) {
|
||||
if (entity->isValid()) {
|
||||
scripting::on_trigger_enter(*entity, index, otherid);
|
||||
body.triggers.emplace_back(Trigger{
|
||||
true,
|
||||
id,
|
||||
box,
|
||||
AABB{},
|
||||
{},
|
||||
{},
|
||||
[=](auto entityid, auto index, auto otherid) {
|
||||
if (auto entity = get(entityid)) {
|
||||
if (entity->isValid()) {
|
||||
scripting::on_trigger_enter(*entity, index, otherid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [=](auto entityid, auto index, auto otherid) {
|
||||
if (auto entity = get(entityid)) {
|
||||
if (entity->isValid()) {
|
||||
scripting::on_trigger_exit(*entity, index, otherid);
|
||||
},
|
||||
[=](auto entityid, auto index, auto otherid) {
|
||||
if (auto entity = get(entityid)) {
|
||||
if (entity->isValid()) {
|
||||
scripting::on_trigger_exit(*entity, index, otherid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}});
|
||||
}});
|
||||
}
|
||||
auto& scripting = registry.emplace<Scripting>(
|
||||
entity, entity_funcs_set {}, nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue