mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
fix stewblaster stopping for non-players
fixes an issue when stew blaster would stop for non-players and would stand still permanently due to enemy hitboxes being removed. Tested that stewblaster only stops for players and starts moving when there are no players in the vicinity
This commit is contained in:
parent
150031861d
commit
0036b71d94
@ -68,6 +68,7 @@ void MovementAIComponent::SetPath(const std::string pathName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MovementAIComponent::Pause() {
|
void MovementAIComponent::Pause() {
|
||||||
|
if (m_Paused) return;
|
||||||
m_Paused = true;
|
m_Paused = true;
|
||||||
SetPosition(ApproximateLocation());
|
SetPosition(ApproximateLocation());
|
||||||
m_SavedVelocity = GetVelocity();
|
m_SavedVelocity = GetVelocity();
|
||||||
@ -76,6 +77,7 @@ void MovementAIComponent::Pause() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MovementAIComponent::Resume() {
|
void MovementAIComponent::Resume() {
|
||||||
|
if (!m_Paused) return;
|
||||||
m_Paused = false;
|
m_Paused = false;
|
||||||
SetVelocity(m_SavedVelocity);
|
SetVelocity(m_SavedVelocity);
|
||||||
m_SavedVelocity = NiPoint3Constant::ZERO;
|
m_SavedVelocity = NiPoint3Constant::ZERO;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "WanderingVendor.h"
|
#include "WanderingVendor.h"
|
||||||
#include "MovementAIComponent.h"
|
#include "MovementAIComponent.h"
|
||||||
#include "ProximityMonitorComponent.h"
|
#include "ProximityMonitorComponent.h"
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
void WanderingVendor::OnStartup(Entity* self) {
|
void WanderingVendor::OnStartup(Entity* self) {
|
||||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||||
@ -19,7 +20,16 @@ void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::str
|
|||||||
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
|
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
|
||||||
|
|
||||||
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
||||||
if (proxObjs.empty()) self->AddTimer("startWalking", 1.5);
|
bool foundPlayer = false;
|
||||||
|
for (const auto id : proxObjs | std::views::keys) {
|
||||||
|
auto* entity = Game::entityManager->GetEntity(id);
|
||||||
|
if (entity && entity->IsPlayer()) {
|
||||||
|
foundPlayer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundPlayer) self->AddTimer("startWalking", 1.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user