diff --git a/dGame/EntityManager.cpp b/dGame/EntityManager.cpp index 86737dd49..cfbd71d95 100644 --- a/dGame/EntityManager.cpp +++ b/dGame/EntityManager.cpp @@ -47,10 +47,6 @@ std::vector EntityManager::m_GhostingExcludedZones = { // Configure some exceptions for ghosting, nessesary for some special objects. std::vector EntityManager::m_GhostingExcludedLOTs = { - // NT - Pipes - 9524, - 12408, - // AG - Footrace 4967 }; diff --git a/dScripts/02_server/Map/General/CMakeLists.txt b/dScripts/02_server/Map/General/CMakeLists.txt index fae617a2c..797b53ed6 100644 --- a/dScripts/02_server/Map/General/CMakeLists.txt +++ b/dScripts/02_server/Map/General/CMakeLists.txt @@ -18,6 +18,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL "StoryBoxInteractServer.cpp" "TokenConsoleServer.cpp" "TouchMissionUpdateServer.cpp" + "VisToggleNotifierServer.cpp" + "NTNaomiDirtServer.cpp" "WishingWellServer.cpp") add_subdirectory(Ninjago) diff --git a/dScripts/02_server/Map/General/FrictionVolumeServer.h b/dScripts/02_server/Map/General/FrictionVolumeServer.h index b76ed04de..9824daefd 100644 --- a/dScripts/02_server/Map/General/FrictionVolumeServer.h +++ b/dScripts/02_server/Map/General/FrictionVolumeServer.h @@ -1,3 +1,6 @@ +#ifndef __FRICTIONVOLUMESERVER__H__ +#define __FRICTIONVOLUMESERVER__H__ + #include "CppScripts.h" class FrictionVolumeServer : public CppScripts::Script { @@ -6,3 +9,5 @@ class FrictionVolumeServer : public CppScripts::Script { private: const float DefaultFrictionAmount = 1.5f; }; + +#endif //!__FRICTIONVOLUMESERVER__H__ diff --git a/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp b/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp new file mode 100644 index 000000000..cf00326a5 --- /dev/null +++ b/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp @@ -0,0 +1,14 @@ +#include "NTNaomiDirtServer.h" + +namespace { + std::map VisibilityMissionTable = { + {1253, std::string("Dirt_Clouds_Sent")}, + {1276, std::string("Dirt_Clouds_Assem")}, + {1277, std::string("Dirt_Clouds_Para")}, + {1283, std::string("Dirt_Clouds_Halls")} + }; +}; + +void NTNaomiDirtServer::OnStartup(Entity* self) { + SetGameVariables(VisibilityMissionTable); +} diff --git a/dScripts/02_server/Map/General/NTNaomiDirtServer.h b/dScripts/02_server/Map/General/NTNaomiDirtServer.h new file mode 100644 index 000000000..ed03df471 --- /dev/null +++ b/dScripts/02_server/Map/General/NTNaomiDirtServer.h @@ -0,0 +1,11 @@ +#ifndef __NTNAOMIDIRTSERVER__H__ +#define __NTNAOMIDIRTSERVER__H__ + +#include "VisToggleNotifierServer.h" + +class NTNaomiDirtServer : public VisToggleNotifierServer { +public: + void OnStartup(Entity* self) override; +}; + +#endif //!__NTNAOMIDIRTSERVER__H__ diff --git a/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp b/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp new file mode 100644 index 000000000..a02856ef7 --- /dev/null +++ b/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp @@ -0,0 +1,23 @@ +#include "VisToggleNotifierServer.h" +#include "eMissionState.h" +#include "Game.h" +#include "dZoneManager.h" + +void VisToggleNotifierServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionId, eMissionState missionState) { + auto itr = m_GameVariables.find(missionId); + if (itr != m_GameVariables.end()) { + bool visible = true; + if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { + visible = false; + } + + auto spawners = Game::zoneManager->GetSpawnersByName(itr->second); + if (spawners.empty()) return; + for (const auto spawner : spawners) { + auto spawnedObjIds = spawner->GetSpawnedObjectIDs(); + for (const auto& objId : spawnedObjIds) { + GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible); + } + } + } +} diff --git a/dScripts/02_server/Map/General/VisToggleNotifierServer.h b/dScripts/02_server/Map/General/VisToggleNotifierServer.h new file mode 100644 index 000000000..c19b65dfd --- /dev/null +++ b/dScripts/02_server/Map/General/VisToggleNotifierServer.h @@ -0,0 +1,15 @@ +#ifndef __VISTOGGLENOTIFIERSERVER__H__ +#define __VISTOGGLENOTIFIERSERVER__H__ + +#include "CppScripts.h" + +class VisToggleNotifierServer : public CppScripts::Script { +public: + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; +protected: + void SetGameVariables(std::map& gameVariables) { m_GameVariables = gameVariables; } +private: + std::map m_GameVariables; +}; + +#endif //!__VISTOGGLENOTIFIERSERVER__H__ diff --git a/dScripts/02_server/Map/NT/CMakeLists.txt b/dScripts/02_server/Map/NT/CMakeLists.txt index ede9b003c..e0d18fde4 100644 --- a/dScripts/02_server/Map/NT/CMakeLists.txt +++ b/dScripts/02_server/Map/NT/CMakeLists.txt @@ -18,6 +18,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT "NtXRayServer.cpp" "NtSleepingGuard.cpp" "NtImagimeterVisibility.cpp" + "NTPipeVisibilityServer.cpp" "NtSentinelWalkwayServer.cpp" "NtDarkitectRevealServer.cpp" "NtParadoxTeleServer.cpp" diff --git a/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp new file mode 100644 index 000000000..d8d7d1d93 --- /dev/null +++ b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp @@ -0,0 +1,15 @@ +#include "NTPipeVisibilityServer.h" +#include "Entity.h" +#include "Character.h" + +void NTPipeVisibilityServer::OnRebuildComplete(Entity* self, Entity* target) { + const auto flag = self->GetVar(u"flag"); + if (flag == 0) return; + + auto* character = target->GetCharacter(); + if (!character) return; + + character->SetPlayerFlag(flag, true); + + GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PipeBuilt"); +} diff --git a/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h new file mode 100644 index 000000000..2694af8b0 --- /dev/null +++ b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h @@ -0,0 +1,11 @@ +#ifndef __NTPIPEVISIBILITYSERVER__H__ +#define __NTPIPEVISIBILITYSERVER__H__ + +#include "CppScripts.h" + +class NTPipeVisibilityServer : public CppScripts::Script { +public: + void OnRebuildComplete(Entity* self, Entity* target) override; +}; + +#endif //!__NTPIPEVISIBILITYSERVER__H__ diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 87e7d9bd8..cadb8fada 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -210,6 +210,8 @@ #include "NtSleepingGuard.h" #include "NtImagimeterVisibility.h" #include "FrictionVolumeServer.h" +#include "NTPipeVisibilityServer.h" +#include "NTNaomiDirtServer.h" // DLU Scripts #include "DLUVanityNPC.h" @@ -312,6 +314,7 @@ #include "WildNinjaStudent.h" #include "WildNinjaSensei.h" #include "WildNinjaBricks.h" +#include "VisToggleNotifierServer.h" namespace { InvalidScript* invalidToReturn = new InvalidScript(); @@ -707,9 +710,12 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new NtXRayServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_SLEEPING_GUARD.lua") script = new NtSleepingGuard(); - else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_IMAGIMETER_VISIBILITY_SERVER.lua") { + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_IMAGIMETER_VISIBILITY_SERVER.lua") script = new NTImagimeterVisibility(); - } + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_PIPE_VISIBILITY_SERVER.lua") + script = new NTPipeVisibilityServer(); + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_NAOMI_DIRT_SERVER.lua") + script = new NTNaomiDirtServer(); //AM: else if (scriptName == "scripts\\02_server\\Map\\AM\\L_AM_CONSOLE_TELEPORT_SERVER.lua") diff --git a/dZoneManager/Spawner.cpp b/dZoneManager/Spawner.cpp index 8cf7b809b..b602c17c4 100644 --- a/dZoneManager/Spawner.cpp +++ b/dZoneManager/Spawner.cpp @@ -205,6 +205,15 @@ void Spawner::Update(const float deltaTime) { } } +std::vector Spawner::GetSpawnedObjectIDs() const { + std::vector ids; + ids.reserve(m_Entities.size()); + for (const auto& [objId, spawnerNode] : m_Entities) { + ids.push_back(objId); + } + return ids; +} + void Spawner::NotifyOfEntityDeath(const LWOOBJID& objectID) { for (std::function cb : m_SpawnedEntityDieCallbacks) { cb(); diff --git a/dZoneManager/Spawner.h b/dZoneManager/Spawner.h index 1f610b712..79ba40d1d 100644 --- a/dZoneManager/Spawner.h +++ b/dZoneManager/Spawner.h @@ -66,6 +66,7 @@ class Spawner { void SetRespawnTime(float time); void SetNumToMaintain(int32_t value); bool GetIsSpawnSmashGroup() const { return m_SpawnSmashFoundGroup; }; + std::vector GetSpawnedObjectIDs() const; SpawnerInfo m_Info; bool m_Active = true;