Skip to content

Commit

Permalink
fix: Remove hard coded groups for spawners (#1454)
Browse files Browse the repository at this point in the history
* fix macros not trimming newline

* Remove hardcoded spawner groups

Was just missing an inline script implementation and using the wrong name
  • Loading branch information
EmosewaMC authored Feb 11, 2024
1 parent f7e4a32 commit ddaac27
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
3 changes: 3 additions & 0 deletions dGame/dUtilities/SlashCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (infile.good()) {
std::string line;
while (std::getline(infile, line)) {
// Do this in two separate calls to catch both \n and \r\n
line.erase(std::remove(line.begin(), line.end(), '\n'), line.end());
line.erase(std::remove(line.begin(), line.end(), '\r'), line.end());
SlashCommandHandler::HandleChatCommand(GeneralUtils::ASCIIToUTF16(line), entity, sysAddr);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {

std::vector<LWOOBJID> spiderEggs{};

auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
auto spooders = Game::entityManager->GetEntitiesInGroup("SpiderEggs");
for (auto spodder : spooders) {
spiderEggs.push_back(spodder->GetObjectID());
}
Expand Down
14 changes: 14 additions & 0 deletions dScripts/02_server/Map/AG/NpcCowboyServer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "NpcCowboyServer.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
#include "dZoneManager.h"

void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1880) {
Expand All @@ -23,4 +24,17 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(14378, 1);
}

// Next up hide or show the samples based on the mission state
int32_t visible = 1;
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0;
}

auto spawners = Game::zoneManager->GetSpawnersByName("PlungerGunTargets");
for (auto* spawner : spawners) {
for (const auto entity : spawner->GetSpawnedObjectIDs())
GameMessages::SendNotifyClientObject(entity, u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress());
}
}
12 changes: 7 additions & 5 deletions dScripts/02_server/Map/AG/NpcWispServer.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "NpcWispServer.h"
#include "InventoryComponent.h"
#include "EntityManager.h"
#include "dZoneManager.h"
#include "Entity.h"
#include "GameMessages.h"
#include "eMissionState.h"
#include "Spawner.h"

void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1849 && missionID != 1883)
Expand All @@ -25,7 +26,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
}

// Next up hide or show the samples based on the mission state
auto visible = 1;
int32_t visible = 1;
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0;
}
Expand All @@ -35,9 +36,10 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };

for (const auto& group : groups) {
auto samples = Game::entityManager->GetEntitiesInGroup(group);
for (auto* sample : samples) {
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
auto spawners = Game::zoneManager->GetSpawnersByName(group);
for (const auto* spawner : spawners) {
for (const auto objId : spawner->GetSpawnedObjectIDs())
GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress());
}
}
Expand Down
10 changes: 0 additions & 10 deletions dZoneManager/Spawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ Spawner::Spawner(const SpawnerInfo info) {

m_Start = m_Info.noTimedSpawn;

//ssssh...
if (m_EntityInfo.lot == 14718) { //AG - MAELSTROM SAMPLE
m_Info.groups.emplace_back("MaelstromSamples");
}

if (m_EntityInfo.lot == 14375) //AG - SPIDER BOSS EGG
{
m_Info.groups.emplace_back("EGG");
}

int timerCount = m_Info.amountMaintained;

if (m_Info.amountMaintained > m_Info.nodes.size()) {
Expand Down

0 comments on commit ddaac27

Please sign in to comment.