From 2a5f3b8072e809c853d6c539161cf7a3284feb0a Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:20:24 -0800 Subject: [PATCH 1/6] Added script for Avant Gardens Survival buff station --- dScripts/BaseSurvivalServer.cpp | 1 + dScripts/CppScripts.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/dScripts/BaseSurvivalServer.cpp b/dScripts/BaseSurvivalServer.cpp index 45ed22e3..1174f00b 100644 --- a/dScripts/BaseSurvivalServer.cpp +++ b/dScripts/BaseSurvivalServer.cpp @@ -302,6 +302,7 @@ void BaseSurvivalServer::StartWaves(Entity *self) { self->SetVar(FirstTimeDoneVariable, true); self->SetVar(MissionTypeVariable, state.players.size() == 1 ? "survival_time_solo" : "survival_time_team"); + ActivateSpawnerNetwork(spawnerNetworks.rewardNetworks); ActivateSpawnerNetwork(spawnerNetworks.smashNetworks); self->SetNetworkVar(WavesStartedVariable, true); self->SetNetworkVar(StartWaveMessageVariable, "Start!"); diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index f6029076..27f5e225 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -62,6 +62,7 @@ #include "VeMech.h" #include "VeMissionConsole.h" #include "VeEpsilonServer.h" +#include "AgSurvivalBuffStation.h" // NS Scripts #include "NsModularBuild.h" @@ -319,6 +320,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new BaseEnemyMech(); else if (scriptName == "scripts\\zone\\AG\\L_ZONE_AG_SURVIVAL.lua") script = new ZoneAgSurvival(); + else if (scriptName == "scripts\\02_server\\Objects\\L_BUFF_STATION_SERVER.lua") + script = new AgSurvivalBuffStation(); else if (scriptName == "scripts\\ai\\AG\\L_AG_BUS_DOOR.lua") script = new AgBusDoor(); else if (scriptName == "scripts\\02_server\\Equipment\\L_MAESTROM_EXTRACTICATOR_SERVER.lua") From 15831e8d6c75324650c34bc4424ee45c8dd3e7e3 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:20:39 -0800 Subject: [PATCH 2/6] Added Script files for Avant Gardens Buff Station --- dScripts/AgSurvivalBuffStation.cpp | 15 +++++++++++++++ dScripts/AgSurvivalBuffStation.h | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 dScripts/AgSurvivalBuffStation.cpp create mode 100644 dScripts/AgSurvivalBuffStation.h diff --git a/dScripts/AgSurvivalBuffStation.cpp b/dScripts/AgSurvivalBuffStation.cpp new file mode 100644 index 00000000..a792a9d0 --- /dev/null +++ b/dScripts/AgSurvivalBuffStation.cpp @@ -0,0 +1,15 @@ +#include "AgSurvivalBuffStation.h" +#include "SkillComponent.h" +#include "dLogger.h" + +void AgSurvivalBuffStation::OnStartup(Entity* self) { + Game::logger->Log("AgSurvivalBuffStation", "Spawning survival buff station!\n"); +} + +void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) { + auto skillComponent = self->GetComponent(); + + if (skillComponent == nullptr) return; + + skillComponent->CalculateBehavior(201, 1784, self->GetObjectID()); +} diff --git a/dScripts/AgSurvivalBuffStation.h b/dScripts/AgSurvivalBuffStation.h new file mode 100644 index 00000000..abddbdcd --- /dev/null +++ b/dScripts/AgSurvivalBuffStation.h @@ -0,0 +1,9 @@ +#pragma once +#include "CppScripts.h" + +class AgSurvivalBuffStation : public CppScripts::Script +{ +public: + void OnStartup(Entity* self) override; + void OnRebuildComplete(Entity* self, Entity* target) override; +}; \ No newline at end of file From 6fc0683ce969dd40f1a4a1c787442482ef412089 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:26:41 -0800 Subject: [PATCH 3/6] Added comments --- dScripts/AgSurvivalBuffStation.cpp | 6 +----- dScripts/AgSurvivalBuffStation.h | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dScripts/AgSurvivalBuffStation.cpp b/dScripts/AgSurvivalBuffStation.cpp index a792a9d0..0525686e 100644 --- a/dScripts/AgSurvivalBuffStation.cpp +++ b/dScripts/AgSurvivalBuffStation.cpp @@ -2,14 +2,10 @@ #include "SkillComponent.h" #include "dLogger.h" -void AgSurvivalBuffStation::OnStartup(Entity* self) { - Game::logger->Log("AgSurvivalBuffStation", "Spawning survival buff station!\n"); -} - void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) { auto skillComponent = self->GetComponent(); if (skillComponent == nullptr) return; - skillComponent->CalculateBehavior(201, 1784, self->GetObjectID()); + skillComponent->CalculateBehavior(skillIdForBuffStation, behaviorIdForBuffStation, self->GetObjectID()); } diff --git a/dScripts/AgSurvivalBuffStation.h b/dScripts/AgSurvivalBuffStation.h index abddbdcd..0b4d1865 100644 --- a/dScripts/AgSurvivalBuffStation.h +++ b/dScripts/AgSurvivalBuffStation.h @@ -4,6 +4,20 @@ class AgSurvivalBuffStation : public CppScripts::Script { public: - void OnStartup(Entity* self) override; + /** + * @brief When the rebuild of self is complete, we calculate the behavior that is assigned to self in the database. + * + * @param self The Entity that called this script. + * @param target The target of the self that called this script. + */ void OnRebuildComplete(Entity* self, Entity* target) override; +private: + /** + * Skill ID for the buff station. + */ + uint32_t skillIdForBuffStation = 201; + /** + * Behavior ID for the buff station. + */ + uint32_t behaviorIdForBuffStation = 1784; }; \ No newline at end of file From 24f8ea21db51cbdb1cf37adeacaf0d7b6e3b8a78 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:48:43 -0800 Subject: [PATCH 4/6] Added redundancy for smashing buff station --- dScripts/AgSurvivalBuffStation.cpp | 10 +++++++++- dScripts/AgSurvivalBuffStation.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dScripts/AgSurvivalBuffStation.cpp b/dScripts/AgSurvivalBuffStation.cpp index 0525686e..2bd8e72f 100644 --- a/dScripts/AgSurvivalBuffStation.cpp +++ b/dScripts/AgSurvivalBuffStation.cpp @@ -7,5 +7,13 @@ void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) { if (skillComponent == nullptr) return; - skillComponent->CalculateBehavior(skillIdForBuffStation, behaviorIdForBuffStation, self->GetObjectID()); + skillComponent->CalculateBehavior(201, 1784, self->GetObjectID()); + + self->AddTimer("DestroyAfter10Seconds", 10.0f); } + +void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "DestroyAfter10Seconds") { + self->Smash(); + } +} \ No newline at end of file diff --git a/dScripts/AgSurvivalBuffStation.h b/dScripts/AgSurvivalBuffStation.h index 0b4d1865..0528f2ac 100644 --- a/dScripts/AgSurvivalBuffStation.h +++ b/dScripts/AgSurvivalBuffStation.h @@ -11,6 +11,7 @@ public: * @param target The target of the self that called this script. */ void OnRebuildComplete(Entity* self, Entity* target) override; + void OnTimerDone(Entity* self, std::string timerName) override; private: /** * Skill ID for the buff station. From e11260a2fe3eebe1f8e998c71d07da5df0c4ffbb Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:54:58 -0800 Subject: [PATCH 5/6] Added comment --- dScripts/AgSurvivalBuffStation.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dScripts/AgSurvivalBuffStation.h b/dScripts/AgSurvivalBuffStation.h index 0528f2ac..bddb16b5 100644 --- a/dScripts/AgSurvivalBuffStation.h +++ b/dScripts/AgSurvivalBuffStation.h @@ -11,6 +11,12 @@ public: * @param target The target of the self that called this script. */ void OnRebuildComplete(Entity* self, Entity* target) override; + /** + * @brief When 10 seconds have passed, smash self. + * + * @param self The Entity whos timer has done. + * @param timerName The name of the done timer + */ void OnTimerDone(Entity* self, std::string timerName) override; private: /** From 20789bab7fb05e777a3265ed682781de9addabe6 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 20 Jan 2022 16:00:45 -0800 Subject: [PATCH 6/6] Changed out Timer for CallBackTimer --- dScripts/AgSurvivalBuffStation.cpp | 10 +++------- dScripts/AgSurvivalBuffStation.h | 7 ------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/dScripts/AgSurvivalBuffStation.cpp b/dScripts/AgSurvivalBuffStation.cpp index 2bd8e72f..41a754d6 100644 --- a/dScripts/AgSurvivalBuffStation.cpp +++ b/dScripts/AgSurvivalBuffStation.cpp @@ -8,12 +8,8 @@ void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) { if (skillComponent == nullptr) return; skillComponent->CalculateBehavior(201, 1784, self->GetObjectID()); - - self->AddTimer("DestroyAfter10Seconds", 10.0f); -} -void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) { - if (timerName == "DestroyAfter10Seconds") { + self->AddCallbackTimer(10.0f, [self]() { self->Smash(); - } -} \ No newline at end of file + }); +} diff --git a/dScripts/AgSurvivalBuffStation.h b/dScripts/AgSurvivalBuffStation.h index bddb16b5..0b4d1865 100644 --- a/dScripts/AgSurvivalBuffStation.h +++ b/dScripts/AgSurvivalBuffStation.h @@ -11,13 +11,6 @@ public: * @param target The target of the self that called this script. */ void OnRebuildComplete(Entity* self, Entity* target) override; - /** - * @brief When 10 seconds have passed, smash self. - * - * @param self The Entity whos timer has done. - * @param timerName The name of the done timer - */ - void OnTimerDone(Entity* self, std::string timerName) override; private: /** * Skill ID for the buff station.