Merge branch 'main' into moreMovementAi

This commit is contained in:
David Markowitz
2024-03-07 00:40:26 -08:00
143 changed files with 1769 additions and 1288 deletions

View File

@@ -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)

View File

@@ -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();
}
}

View File

@@ -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__