From 828c457614b3e672e5c146e345129613c605fa23 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 5 Feb 2022 04:00:10 -0800 Subject: [PATCH] Added script for Friend of the Ninja mission (#406) * Added script for Friend of the Ninja mission * Added comments --- dScripts/CppScripts.cpp | 3 +++ dScripts/FvPassThroughWall.cpp | 17 +++++++++++++++++ dScripts/FvPassThroughWall.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 dScripts/FvPassThroughWall.cpp create mode 100644 dScripts/FvPassThroughWall.h diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 1201af6d..ca8f95cc 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -145,6 +145,7 @@ #include "ImgBrickConsoleQB.h" #include "ActParadoxPipeFix.h" #include "FvNinjaGuard.h" +#include "FvPassThroughWall.h" #include "FvBounceOverWall.h" // FB Scripts @@ -557,6 +558,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new ActParadoxPipeFix(); else if (scriptName == "scripts\\ai\\FV\\L_FV_NINJA_GUARDS.lua") script = new FvNinjaGuard(); + else if (scriptName == "scripts\\ai\\FV\\L_ACT_PASS_THROUGH_WALL.lua") + script = new FvPassThroughWall(); else if (scriptName == "scripts\\ai\\FV\\L_ACT_BOUNCE_OVER_WALL.lua") script = new FvBounceOverWall(); diff --git a/dScripts/FvPassThroughWall.cpp b/dScripts/FvPassThroughWall.cpp new file mode 100644 index 00000000..66130a9f --- /dev/null +++ b/dScripts/FvPassThroughWall.cpp @@ -0,0 +1,17 @@ +#include "FvPassThroughWall.h" +#include "InventoryComponent.h" + +void FvPassThroughWall::OnCollisionPhantom(Entity* self, Entity* target) { + auto missionComponent = target->GetComponent(); + if (missionComponent == nullptr) return; + + //Because at the moment we do not have an ItemComponent component, we check to make sure a Maelstrom-Infused hood is equipped. There are only three in the game right now. + auto inventoryComponent = target->GetComponent(); + // If no inventory component is found then abort. + if (inventoryComponent == nullptr) return; + // If no Maelstrom hoods are equipped then abort. + if (!inventoryComponent->IsEquipped(WhiteMaelstromHood) && !inventoryComponent->IsEquipped(BlackMaelstromHood) && !inventoryComponent->IsEquipped(RedMaelstromHood)) return; + + // Progress mission Friend of the Ninja since all prerequisites are met. + missionComponent->ForceProgress(friendOfTheNinjaMissionId, friendOfTheNinjaMissionUid, 1); +} \ No newline at end of file diff --git a/dScripts/FvPassThroughWall.h b/dScripts/FvPassThroughWall.h new file mode 100644 index 00000000..4dacc74e --- /dev/null +++ b/dScripts/FvPassThroughWall.h @@ -0,0 +1,34 @@ +#pragma once +#include "CppScripts.h" + +class FvPassThroughWall : public CppScripts::Script +{ + /** + * @brief This method is called when there is a collision with self from target. + * + * @param self The Entity that called this method. + * @param target The Entity that self is targetting. + */ + void OnCollisionPhantom(Entity* self, Entity* target) override; +private: + /** + * Mission ID for Friend of the Ninjas. + */ + int32_t friendOfTheNinjaMissionId = 848; + /** + * Mission UID for Friend of the Ninjas. + */ + int32_t friendOfTheNinjaMissionUid = 1221; + /** + * Item LOT for Maelstrom-Infused White Ninja Hood + */ + int32_t WhiteMaelstromHood = 2641; + /** + * Item LOT for Maelstrom-Infused Black Ninja Hood + */ + int32_t BlackMaelstromHood = 2642; + /** + * Item LOT for Red Ninja Hood - Maelstrom Infused + */ + int32_t RedMaelstromHood = 1889; +}; \ No newline at end of file