From 47f0830483ac1c82cee2ea74b20de7f8b3d7f8f4 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 25 Aug 2022 15:51:22 -0500 Subject: [PATCH] Add GF geyser script (#749) * Add GF geyser script * remove uneeeded include * const --- dScripts/CMakeLists.txt | 1 + dScripts/CppScripts.cpp | 6 ++++-- dScripts/GfMaelstromGeyser.cpp | 18 ++++++++++++++++++ dScripts/GfMaelstromGeyser.h | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 dScripts/GfMaelstromGeyser.cpp create mode 100644 dScripts/GfMaelstromGeyser.h diff --git a/dScripts/CMakeLists.txt b/dScripts/CMakeLists.txt index 9bc088cb..47400891 100644 --- a/dScripts/CMakeLists.txt +++ b/dScripts/CMakeLists.txt @@ -114,6 +114,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp" "GfCaptainsCannon.cpp" "GfJailkeepMission.cpp" "GfJailWalls.cpp" + "GfMaelstromGeyser.cpp" "GfOrgan.cpp" "GfTikiTorch.cpp" "GrowingFlower.cpp" diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 5f10a2a5..f8481de1 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -117,6 +117,7 @@ #include "GfApeSmashingQB.h" #include "ZoneGfProperty.h" #include "GfArchway.h" +#include "GfMaelstromGeyser.h" // SG Scripts #include "SGCannon.h" @@ -496,9 +497,10 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new GfApeSmashingQB(); else if (scriptName == "scripts\\zone\\PROPERTY\\GF\\L_ZONE_GF_PROPERTY.lua") script = new ZoneGfProperty(); - else if (scriptName == "scripts\\ai\\GF\\L_GF_ARCHWAY.lua") { + else if (scriptName == "scripts\\ai\\GF\\L_GF_ARCHWAY.lua") script = new GfArchway(); - } + else if (scriptName == "scripts\\ai\\GF\\L_GF_MAELSTROM_GEYSER.lua") + script = new GfMaelstromGeyser(); // SG else if (scriptName == "scripts\\ai\\MINIGAME\\SG_GF\\SERVER\\SG_CANNON.lua") diff --git a/dScripts/GfMaelstromGeyser.cpp b/dScripts/GfMaelstromGeyser.cpp new file mode 100644 index 00000000..825307a7 --- /dev/null +++ b/dScripts/GfMaelstromGeyser.cpp @@ -0,0 +1,18 @@ +#include "GfMaelstromGeyser.h" +#include "SkillComponent.h" + +void GfMaelstromGeyser::OnStartup(Entity* self) { + self->AddTimer(m_StartSkillTimerName, m_StartSkillTimerTime); + self->AddTimer(m_KillSelfTimerName, m_KillSelfTimerTime); +} + +void GfMaelstromGeyser::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == m_StartSkillTimerName) { + auto* skillComponent = self->GetComponent(); + skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true); + } + if (timerName == m_KillSelfTimerName) { + self->Smash(LWOOBJID_EMPTY, eKillType::SILENT); + } +} + diff --git a/dScripts/GfMaelstromGeyser.h b/dScripts/GfMaelstromGeyser.h new file mode 100644 index 00000000..60e42798 --- /dev/null +++ b/dScripts/GfMaelstromGeyser.h @@ -0,0 +1,17 @@ +#pragma once +#include "CppScripts.h" + +class GfMaelstromGeyser final : public CppScripts::Script +{ +public: + void OnStartup(Entity* self) override; + void OnTimerDone(Entity* self, std::string timerName) override; + +private: + const std::string m_StartSkillTimerName = "startSkill"; + const float m_StartSkillTimerTime = 2.0; + const std::string m_KillSelfTimerName = "killSelf"; + const float m_KillSelfTimerTime = 7.5; + const uint32_t m_SkillID = 607; + const uint32_t m_BehaviorID = 10500; +};