mirror of
https://github.com/Squareville/wonderland-server.git
synced 2026-01-06 09:10:09 -06:00
Update ControllablePhysicsComponent.cpp
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "eStateChangeType.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
|
||||
ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity, int32_t componentId) : PhysicsComponent(entity, componentId) {
|
||||
m_Velocity = {};
|
||||
@@ -69,11 +70,13 @@ ControllablePhysicsComponent::~ControllablePhysicsComponent() {
|
||||
void ControllablePhysicsComponent::Update(float deltaTime) {
|
||||
if (m_Parent->IsPlayer()) return;
|
||||
|
||||
if (m_Parent->GetComponent<BaseCombatAIComponent>()) return; // let combat ai take care of this
|
||||
|
||||
auto* movementAI = m_Parent->GetComponent<MovementAIComponent>();
|
||||
if (movementAI && (!movementAI->AtFinalWaypoint() || movementAI->IsPaused())) return;
|
||||
if (movementAI && (!movementAI->AtFinalWaypoint() || movementAI->IsPaused())) return; // let movement ai handle it
|
||||
|
||||
auto* const quickBuildComponent = m_Parent->GetComponent<QuickBuildComponent>();
|
||||
if (quickBuildComponent && quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) return;
|
||||
if (quickBuildComponent && quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) return; // quickbulds dont move while not built
|
||||
|
||||
SetPosition(m_Position + m_Velocity * deltaTime);
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
|
||||
Reference in New Issue
Block a user