mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +00:00
remove singleton for dpWorld (#1427)
Removes the singleton inheritance from dpWorld. Tested that crux prime, nimbus station, avant gardens and nexus tower still use navmeshes and physics and that physics volumes are still collided with.
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
|
||||
#include "dNavMesh.h"
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* Cache of all lots and their respective speeds
|
||||
@@ -169,8 +171,8 @@ NiPoint3 MovementAIComponent::ApproximateLocation() const {
|
||||
|
||||
auto approximation = source + ((destination - source) * percentageToWaypoint);
|
||||
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
approximation.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(approximation);
|
||||
if (dpWorld::IsLoaded()) {
|
||||
approximation.y = dpWorld::GetNavMesh()->GetHeightAtPoint(approximation);
|
||||
}
|
||||
|
||||
return approximation;
|
||||
@@ -181,8 +183,8 @@ bool MovementAIComponent::Warp(const NiPoint3& point) {
|
||||
|
||||
NiPoint3 destination = point;
|
||||
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
destination.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(point);
|
||||
if (dpWorld::IsLoaded()) {
|
||||
destination.y = dpWorld::GetNavMesh()->GetHeightAtPoint(point);
|
||||
|
||||
if (std::abs(destination.y - point.y) > 3) {
|
||||
return false;
|
||||
@@ -302,8 +304,8 @@ void MovementAIComponent::SetDestination(const NiPoint3& destination) {
|
||||
}
|
||||
|
||||
std::vector<NiPoint3> computedPath;
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
computedPath = dpWorld::Instance().GetNavMesh()->GetPath(m_Parent->GetPosition(), destination, m_Info.wanderSpeed);
|
||||
if (dpWorld::IsLoaded()) {
|
||||
computedPath = dpWorld::GetNavMesh()->GetPath(m_Parent->GetPosition(), destination, m_Info.wanderSpeed);
|
||||
}
|
||||
|
||||
// Somehow failed
|
||||
@@ -328,8 +330,8 @@ void MovementAIComponent::SetDestination(const NiPoint3& destination) {
|
||||
|
||||
// Simply path
|
||||
for (auto& point : computedPath) {
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
point.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(point);
|
||||
if (dpWorld::IsLoaded()) {
|
||||
point.y = dpWorld::GetNavMesh()->GetHeightAtPoint(point);
|
||||
}
|
||||
|
||||
m_InterpolatedWaypoints.push_back(point);
|
||||
|
Reference in New Issue
Block a user