From f56f0a48fd02f4a0db8c82b79d991c5e1d6b8136 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Thu, 21 Dec 2023 23:21:20 -0600 Subject: [PATCH] WIP --- dScripts/CppScripts.cpp | 13 ++++++++ dScripts/ai/WILD/CMakeLists.txt | 1 + dScripts/ai/WILD/WildMedusa.cpp | 55 +++++++++++++++++++++++++++++++++ dScripts/ai/WILD/WildMedusa.h | 8 +++++ thirdparty/magic_enum | 1 + 5 files changed, 78 insertions(+) create mode 100644 dScripts/ai/WILD/WildMedusa.cpp create mode 100644 dScripts/ai/WILD/WildMedusa.h create mode 160000 thirdparty/magic_enum diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 24fe7b5b..a16e7552 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -307,6 +307,7 @@ #include "WildAndScared.h" #include "WildGfGlowbug.h" #include "WildAmbientCrab.h" +#include "WildMedusa.h" #include "WildPants.h" #include "WildNinjaStudent.h" #include "WildNinjaSensei.h" @@ -921,6 +922,18 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new WildNinjaStudent(); else if (scriptName == "scripts\\ai\\WILD\\L_WILD_NINJA_SENSEI.lua") script = new WildNinjaSensei(); + else if (scriptName == "scripts\\ai\\WILD\\L_WILD_MEDUSA.lua") + script = new WildMedusa(); + 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(); + else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_03.lua") + script = new WildSnake01(); + else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_04.lua") + script = new WildSnake01(); + else if (scriptName == "scripts\\ai\\WILD\\L_WILD_snake_05.lua") + script = new WildSnake01(); // 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 446ce0d4..6aaa5b2c 100644 --- a/dScripts/ai/WILD/CMakeLists.txt +++ b/dScripts/ai/WILD/CMakeLists.txt @@ -4,6 +4,7 @@ set(DSCRIPTS_SOURCES_AI_WILD "WildAmbientCrab.cpp" "WildAndScared.cpp" "WildGfGlowbug.cpp" + "WildMedusa.cpp" "WildNinjaBricks.cpp" "WildNinjaStudent.cpp" "WildNinjaSensei.cpp" diff --git a/dScripts/ai/WILD/WildMedusa.cpp b/dScripts/ai/WILD/WildMedusa.cpp new file mode 100644 index 00000000..caf73c6f --- /dev/null +++ b/dScripts/ai/WILD/WildMedusa.cpp @@ -0,0 +1,55 @@ +#include "WildMedusa.h" +#include "EntityInfo.h" +#include "DestroyableComponent.h" +#include "RenderComponent.h" + +void WildMedusa::OnStartup(Entity* self) { + self->AddTimer("SnakeStartup", 0.2); + self->AddToGroup("snakesonaplane"); + + auto pos = self->GetPosition(); + + EntityInfo snake1{}; + snake1.lot = 6564; + snake1.spawnerID = self->GetObjectID(); + snake1.pos = NiPoint3(pos.x, pos.y, pos.z + 5); + auto* snake1_entity = Game::entityManager->CreateEntity(snake1); + Game::entityManager->ConstructEntity(snake1_entity); + + EntityInfo snake2{}; + snake2.lot = 6565; + snake2.spawnerID = self->GetObjectID(); + snake2.pos = NiPoint3(pos.x, pos.y, pos.z - 5); + auto* snake2_entity = Game::entityManager->CreateEntity(snake2); + Game::entityManager->ConstructEntity(snake2_entity); + + EntityInfo snake3{}; + snake3.lot = 6566; + snake3.spawnerID = self->GetObjectID(); + snake3.pos = NiPoint3(pos.x + 5, pos.y, pos.z); + auto* snake3_entity = Game::entityManager->CreateEntity(snake3); + Game::entityManager->ConstructEntity(snake3_entity); + + EntityInfo snake4{}; + snake4.lot = 6567; + snake4.spawnerID = self->GetObjectID(); + snake4.pos = NiPoint3(pos.x - 5, pos.y, pos.z); + auto* snake4_entity = Game::entityManager->CreateEntity(snake4); + Game::entityManager->ConstructEntity(snake4_entity); + + EntityInfo snake5{}; + snake5.lot = 6568; + snake5.spawnerID = self->GetObjectID(); + snake5.pos = NiPoint3(pos.x + 5, pos.y, pos.z - 5); + auto* snake5_entity = Game::entityManager->CreateEntity(snake5); + Game::entityManager->ConstructEntity(snake5_entity); +} + +void WildMedusa:: OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { + if (name == "next5"){ + auto* destroyableComponent = self->GetComponent(); + if (destroyableComponent) destroyableComponent->SetFaction(4); + auto* renderComponent = self->GetComponent(); + if (renderComponent) renderComponent->PlayEffect(634, u"medusa", ""); + } +} \ No newline at end of file diff --git a/dScripts/ai/WILD/WildMedusa.h b/dScripts/ai/WILD/WildMedusa.h new file mode 100644 index 00000000..999472a2 --- /dev/null +++ b/dScripts/ai/WILD/WildMedusa.h @@ -0,0 +1,8 @@ +#pragma once +#include "CppScripts.h" + +class WildMedusa : 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; +}; diff --git a/thirdparty/magic_enum b/thirdparty/magic_enum new file mode 160000 index 00000000..e26b05e0 --- /dev/null +++ b/thirdparty/magic_enum @@ -0,0 +1 @@ +Subproject commit e26b05e0a04529ed2ac2571919f9755ba0afee18