Add GF geyser script (#749)

* Add GF geyser script

* remove uneeeded include

* const
This commit is contained in:
Aaron Kimbrell 2022-08-25 15:51:22 -05:00 committed by GitHub
parent e707207ffa
commit 47f0830483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 2 deletions

View File

@ -114,6 +114,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp"
"GfCaptainsCannon.cpp" "GfCaptainsCannon.cpp"
"GfJailkeepMission.cpp" "GfJailkeepMission.cpp"
"GfJailWalls.cpp" "GfJailWalls.cpp"
"GfMaelstromGeyser.cpp"
"GfOrgan.cpp" "GfOrgan.cpp"
"GfTikiTorch.cpp" "GfTikiTorch.cpp"
"GrowingFlower.cpp" "GrowingFlower.cpp"

View File

@ -117,6 +117,7 @@
#include "GfApeSmashingQB.h" #include "GfApeSmashingQB.h"
#include "ZoneGfProperty.h" #include "ZoneGfProperty.h"
#include "GfArchway.h" #include "GfArchway.h"
#include "GfMaelstromGeyser.h"
// SG Scripts // SG Scripts
#include "SGCannon.h" #include "SGCannon.h"
@ -496,9 +497,10 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new GfApeSmashingQB(); script = new GfApeSmashingQB();
else if (scriptName == "scripts\\zone\\PROPERTY\\GF\\L_ZONE_GF_PROPERTY.lua") else if (scriptName == "scripts\\zone\\PROPERTY\\GF\\L_ZONE_GF_PROPERTY.lua")
script = new ZoneGfProperty(); 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(); script = new GfArchway();
} else if (scriptName == "scripts\\ai\\GF\\L_GF_MAELSTROM_GEYSER.lua")
script = new GfMaelstromGeyser();
// SG // SG
else if (scriptName == "scripts\\ai\\MINIGAME\\SG_GF\\SERVER\\SG_CANNON.lua") else if (scriptName == "scripts\\ai\\MINIGAME\\SG_GF\\SERVER\\SG_CANNON.lua")

View File

@ -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>();
skillComponent->CalculateBehavior(m_SkillID, m_BehaviorID, LWOOBJID_EMPTY, true);
}
if (timerName == m_KillSelfTimerName) {
self->Smash(LWOOBJID_EMPTY, eKillType::SILENT);
}
}

View File

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