mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
Merge branch 'main' into moreMovementAi
This commit is contained in:
@@ -19,6 +19,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"WanderingVendor.cpp"
|
||||
)
|
||||
|
||||
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
add_library(dScriptsServerMapAM OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)
|
||||
|
@@ -5,7 +5,7 @@
|
||||
void WanderingVendor::OnStartup(Entity* self) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
movementAIComponent->Resume();
|
||||
// movementAIComponent->Resume();
|
||||
self->SetProximityRadius(10, "playermonitor");
|
||||
}
|
||||
|
||||
@@ -13,14 +13,12 @@ void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::str
|
||||
if (status == "ENTER" && entering->IsPlayer()) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
movementAIComponent->Pause();
|
||||
// movementAIComponent->Pause();
|
||||
self->CancelTimer("startWalking");
|
||||
} else if (status == "LEAVE") {
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
if (!proximityMonitorComponent) {
|
||||
LOG("Proximity monitor component not found!");
|
||||
return;
|
||||
}
|
||||
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
|
||||
|
||||
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
||||
if (proxObjs.empty()) self->AddTimer("startWalking", 1.5);
|
||||
}
|
||||
@@ -30,6 +28,6 @@ void WanderingVendor::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "startWalking") {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
movementAIComponent->Resume();
|
||||
// movementAIComponent->Resume();
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef __WANDERINGVENDOR__H__
|
||||
#define __WANDERINGVENDOR__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WanderingVendor : public CppScripts::Script {
|
||||
@@ -8,3 +10,4 @@ public:
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
#endif //!__WANDERINGVENDOR__H__
|
||||
|
Reference in New Issue
Block a user