diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index a16e7552..24e2e3ba 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -308,6 +308,11 @@ #include "WildGfGlowbug.h" #include "WildAmbientCrab.h" #include "WildMedusa.h" +#include "WildSnake01.h" +#include "WildSnake02.h" +#include "WildSnake03.h" +#include "WildSnake04.h" +#include "WildSnake05.h" #include "WildPants.h" #include "WildNinjaStudent.h" #include "WildNinjaSensei.h" @@ -927,13 +932,13 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_01.lua") script = new WildSnake01(); else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_02.lua") - script = new WildSnake01(); + script = new WildSnake02(); else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_03.lua") - script = new WildSnake01(); + script = new WildSnake03(); else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_04.lua") - script = new WildSnake01(); + script = new WildSnake04(); else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_05.lua") - script = new WildSnake01(); + script = new WildSnake05(); // handle invalid script reporting if the path is greater than zero and it's not an ignored script // information not really needed for sys admins but is for developers diff --git a/dScripts/ai/WILD/CMakeLists.txt b/dScripts/ai/WILD/CMakeLists.txt index 6aaa5b2c..2a283c85 100644 --- a/dScripts/ai/WILD/CMakeLists.txt +++ b/dScripts/ai/WILD/CMakeLists.txt @@ -9,4 +9,9 @@ set(DSCRIPTS_SOURCES_AI_WILD "WildNinjaStudent.cpp" "WildNinjaSensei.cpp" "WildPants.cpp" + "WildSnake01.cpp" + "WildSnake02.cpp" + "WildSnake03.cpp" + "WildSnake04.cpp" + "WildSnake05.cpp" PARENT_SCOPE) diff --git a/dScripts/ai/WILD/WildSnake01.cpp b/dScripts/ai/WILD/WildSnake01.cpp new file mode 100644 index 00000000..6810c116 --- /dev/null +++ b/dScripts/ai/WILD/WildSnake01.cpp @@ -0,0 +1,38 @@ +#include "WildSnake01.h" +#include "EntityManager.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildSnake01::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup",0.2f); + self->AddTimer("SnakeFollow",0.3f); +} + +void WildSnake01::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { + if (name == "next4"){ + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"purple", ""); + } +} + +void WildSnake01::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "SnakeStartup"){ + self->AddToGroup("snakesonaplane"); + } else if (timerName == "SnakeFollow") { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake && snake->GetLOT() == 6602){ + // self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } + } + } + } +} + +void WildSnake01::OnDie(Entity* self, Entity* killer) { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake) snake->NotifyObject(self, "next5"); + } +} diff --git a/dScripts/ai/WILD/WildSnake01.h b/dScripts/ai/WILD/WildSnake01.h new file mode 100644 index 00000000..7b3fb87b --- /dev/null +++ b/dScripts/ai/WILD/WildSnake01.h @@ -0,0 +1,10 @@ +#pragma once +#include "CppScripts.h" + +class WildSnake01 : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; + void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override; + void OnTimerDone(Entity* self, std::string timerName) override; + void OnDie(Entity* self, Entity* killer) override; +}; diff --git a/dScripts/ai/WILD/WildSnake02.cpp b/dScripts/ai/WILD/WildSnake02.cpp new file mode 100644 index 00000000..eb5328fa --- /dev/null +++ b/dScripts/ai/WILD/WildSnake02.cpp @@ -0,0 +1,38 @@ +#include "WildSnake02.h" +#include "EntityManager.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildSnake02::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup",0.2f); + self->AddTimer("SnakeFollow",0.3f); +} + +void WildSnake02::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { + if (name == "next3"){ + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"blue", ""); + } +} + +void WildSnake02::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "SnakeStartup"){ + self->AddToGroup("snakesonaplane"); + } else if (timerName == "SnakeFollow") { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake && snake->GetLOT() == 6564){ + // self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } + } + } + } +} + +void WildSnake02::OnDie(Entity* self, Entity* killer) { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake) snake->NotifyObject(self, "next4"); + } +} diff --git a/dScripts/ai/WILD/WildSnake02.h b/dScripts/ai/WILD/WildSnake02.h new file mode 100644 index 00000000..aa8531dc --- /dev/null +++ b/dScripts/ai/WILD/WildSnake02.h @@ -0,0 +1,10 @@ +#pragma once +#include "CppScripts.h" + +class WildSnake02 : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; + void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override; + void OnTimerDone(Entity* self, std::string timerName) override; + void OnDie(Entity* self, Entity* killer) override; +}; diff --git a/dScripts/ai/WILD/WildSnake03.cpp b/dScripts/ai/WILD/WildSnake03.cpp new file mode 100644 index 00000000..b302a2af --- /dev/null +++ b/dScripts/ai/WILD/WildSnake03.cpp @@ -0,0 +1,38 @@ +#include "WildSnake03.h" +#include "EntityManager.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildSnake03::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup",0.2f); + self->AddTimer("SnakeFollow",0.3f); +} + +void WildSnake03::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { + if (name == "next2"){ + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"green", ""); + } +} + +void WildSnake03::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "SnakeStartup"){ + self->AddToGroup("snakesonaplane"); + } else if (timerName == "SnakeFollow") { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake && snake->GetLOT() == 6565){ + // self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } + } + } + } +} + +void WildSnake03::OnDie(Entity* self, Entity* killer) { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake) snake->NotifyObject(self, "next3"); + } +} diff --git a/dScripts/ai/WILD/WildSnake03.h b/dScripts/ai/WILD/WildSnake03.h new file mode 100644 index 00000000..6380b457 --- /dev/null +++ b/dScripts/ai/WILD/WildSnake03.h @@ -0,0 +1,10 @@ +#pragma once +#include "CppScripts.h" + +class WildSnake03 : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; + void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override; + void OnTimerDone(Entity* self, std::string timerName) override; + void OnDie(Entity* self, Entity* killer) override; +}; diff --git a/dScripts/ai/WILD/WildSnake04.cpp b/dScripts/ai/WILD/WildSnake04.cpp new file mode 100644 index 00000000..cc5fce45 --- /dev/null +++ b/dScripts/ai/WILD/WildSnake04.cpp @@ -0,0 +1,38 @@ +#include "WildSnake04.h" +#include "EntityManager.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildSnake04::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup",0.2f); + self->AddTimer("SnakeFollow",0.3f); +} + +void WildSnake04::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { + if (name == "next1"){ + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"yellow", ""); + } +} + +void WildSnake04::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "SnakeStartup"){ + self->AddToGroup("snakesonaplane"); + } else if (timerName == "SnakeFollow") { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake && snake->GetLOT() == 6566){ + // self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } + } + } + } +} + +void WildSnake04::OnDie(Entity* self, Entity* killer) { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake) snake->NotifyObject(self, "next2"); + } +} diff --git a/dScripts/ai/WILD/WildSnake04.h b/dScripts/ai/WILD/WildSnake04.h new file mode 100644 index 00000000..3339aaba --- /dev/null +++ b/dScripts/ai/WILD/WildSnake04.h @@ -0,0 +1,10 @@ +#pragma once +#include "CppScripts.h" + +class WildSnake04 : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; + void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override; + void OnTimerDone(Entity* self, std::string timerName) override; + void OnDie(Entity* self, Entity* killer) override; +}; diff --git a/dScripts/ai/WILD/WildSnake05.cpp b/dScripts/ai/WILD/WildSnake05.cpp new file mode 100644 index 00000000..e592be3e --- /dev/null +++ b/dScripts/ai/WILD/WildSnake05.cpp @@ -0,0 +1,35 @@ +#include "WildSnake05.h" +#include "EntityManager.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildSnake05::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup",0.2f); + self->AddTimer("SnakeFollow",0.3f); + self->AddTimer("SnakeGlow",2.0f); +} + +void WildSnake05::OnTimerDone(Entity* self, std::string timerName) { + if (timerName == "SnakeStartup"){ + self->AddToGroup("snakesonaplane"); + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + } else if (timerName == "SnakeFollow") { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake && snake->GetLOT() == 6566){ + // self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } + } + } + } else if (timerName == "SnakeGlow") { + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"red", ""); + } +} + +void WildSnake05::OnDie(Entity* self, Entity* killer) { + auto snakes = Game::entityManager->GetEntitiesInGroup("snakesonaplane"); + for (const auto &snake : snakes) { + if (snake) snake->NotifyObject(self, "next1"); + } +} diff --git a/dScripts/ai/WILD/WildSnake05.h b/dScripts/ai/WILD/WildSnake05.h new file mode 100644 index 00000000..6c1bf165 --- /dev/null +++ b/dScripts/ai/WILD/WildSnake05.h @@ -0,0 +1,9 @@ +#pragma once +#include "CppScripts.h" + +class WildSnake05 : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; + void OnTimerDone(Entity* self, std::string timerName) override; + void OnDie(Entity* self, Entity* killer) override; +};