mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
to improve (broken)
This commit is contained in:
parent
e4de42659e
commit
a9dc0e0dac
@ -775,15 +775,6 @@ void Entity::Initialize()
|
|||||||
|
|
||||||
TriggerEvent("OnCreate");
|
TriggerEvent("OnCreate");
|
||||||
|
|
||||||
// so basically unless you leave and reenter the moonbase bubble (not something you can do), the physics effect will not trigger on the client
|
|
||||||
// one solution of this was change the OnEnter event to a OnCreate event
|
|
||||||
// but this required changing client files so instead that solution we can bodge
|
|
||||||
if (m_Trigger && Game::server->GetZoneID() == 1603) {
|
|
||||||
if (m_Trigger->id == 11) {
|
|
||||||
TriggerEvent("OnEnter");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_Character) {
|
if (m_Character) {
|
||||||
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
||||||
auto* characterComponent = GetComponent<CharacterComponent>();
|
auto* characterComponent = GetComponent<CharacterComponent>();
|
||||||
|
@ -40,6 +40,18 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Com
|
|||||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
|
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
|
||||||
m_dpEntity->SetCollisionGroup(COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_FRIENDLY);
|
m_dpEntity->SetCollisionGroup(COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_FRIENDLY);
|
||||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
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<PhantomPhysicsComponent>()->GetdpEntity(), this->m_dpEntity)) {
|
||||||
|
trigger->TriggerEvent("OnEnter", this->m_Parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "NiQuaternion.h"
|
#include "NiQuaternion.h"
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
|
#include "dpCollisionChecks.h"
|
||||||
|
#include "PhantomPhysicsComponent.h"
|
||||||
|
|
||||||
class Entity;
|
class Entity;
|
||||||
class dpEntity;
|
class dpEntity;
|
||||||
@ -218,6 +220,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool GetStatic() const { return m_Static; }
|
bool GetStatic() const { return m_Static; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Physics entity for the component
|
||||||
|
* @return Physics entity for the component
|
||||||
|
*/
|
||||||
|
|
||||||
|
dpEntity* GetdpEntity() const { return m_dpEntity; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The entity that owns this component
|
* The entity that owns this component
|
||||||
|
@ -110,6 +110,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetEffectType(uint32_t type);
|
void SetEffectType(uint32_t type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Physics entity for the component
|
||||||
|
* @return Physics entity for the component
|
||||||
|
*/
|
||||||
|
|
||||||
|
dpEntity* GetdpEntity() const { return m_dpEntity; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawns an object at each of the vertices for debugging purposes
|
* Spawns an object at each of the vertices for debugging purposes
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user