update component parent environment to the pack environment
This commit is contained in:
+19
-12
@@ -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);
|
||||
|
||||
@@ -73,6 +73,13 @@ namespace rigging {
|
||||
class RigConfig {
|
||||
std::unique_ptr<RigNode> root;
|
||||
std::unordered_map<std::string, size_t> indices;
|
||||
|
||||
/// Nodes and indices are ordered from root to subnodes.
|
||||
/// Example:
|
||||
/// 0 - root
|
||||
/// 1 --- sub1
|
||||
/// 2 ----- subsub1
|
||||
/// 3 --- sub2
|
||||
std::vector<RigNode*> nodes;
|
||||
|
||||
size_t update(
|
||||
|
||||
Reference in New Issue
Block a user