From c8991666d2f01ecee5bdaa4ce53c80e6f9fd6f91 Mon Sep 17 00:00:00 2001 From: Jett <55758076+Jettford@users.noreply.github.com> Date: Sat, 11 Dec 2021 10:46:45 +0000 Subject: [PATCH] Potential solution --- dGame/Entity.cpp | 5 +++++ dGame/dComponents/ControllablePhysicsComponent.cpp | 12 ------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index c98323a9..a0c19aa0 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -1768,6 +1768,7 @@ void Entity::HandleTriggerCommand(std::string id, std::string target, std::strin else if (argArray[0] == "repulse") effectType = 2; else if (argArray[0] == "gravity") effectType = 3; else if (argArray[0] == "friction") effectType = 4; + phanPhys->SetEffectType(effectType); phanPhys->SetDirectionalMultiplier(std::stof(argArray[1])); if (argArray.size() > 4) { @@ -1781,6 +1782,10 @@ void Entity::HandleTriggerCommand(std::string id, std::string target, std::strin phanPhys->SetMin(std::stoi(argArray[6])); phanPhys->SetMax(std::stoi(argArray[7])); } + + if (target == "self") { + EntityManager::Instance()->ConstructEntity(this); + } } else if (id == "updateMission") { CDMissionTasksTable* missionTasksTable = CDClientManager::Instance()->GetTable("MissionTasks"); diff --git a/dGame/dComponents/ControllablePhysicsComponent.cpp b/dGame/dComponents/ControllablePhysicsComponent.cpp index 7fe19acc..922ae55d 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.cpp +++ b/dGame/dComponents/ControllablePhysicsComponent.cpp @@ -40,18 +40,6 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Com m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false); m_dpEntity->SetCollisionGroup(COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_FRIENDLY); dpWorld::Instance().AddEntity(m_dpEntity); - - auto triggers = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_PHANTOM_PHYSICS); - - for (auto* trigger : triggers) { - for (const auto* event : trigger->GetTrigger()->events) { - if (event->eventID == "OnEnter") { - if (dpCollisionChecks::AreColliding(trigger->GetComponent()->GetdpEntity(), this->m_dpEntity)) { - trigger->TriggerEvent("OnEnter", this->m_Parent); - } - } - } - } } }