Files
DarkflameServer/dScripts/02_server/Map/General/SpinnersVol.cpp
Aaron Kimbrell 6ad3168659 feat(scripts): L_KILL_COUNTER_UTIL and the Fire Temple spinner volumes
The kill counter counts its spawn networks' deaths (or the events its config names) to max and back to min and fires
the limit events at their groups. L_BSPINNERS_VOL and L_DSPINNERS_VOL extend it: at max each player in the volume sees
the room's cinematic and 2 s later the rail quick build's network is activated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:32:10 -06:00

39 lines
1.3 KiB
C++

#include "SpinnersVol.h"
#include "Entity.h"
#include "EntityManager.h"
#include "dZoneManager.h"
#include "Spawner.h"
#include "EffectsMessages.h"
#include "PhantomPhysicsComponent.h"
#include "dpEntity.h"
namespace {
// The wait before the rail's network is activated
constexpr float SpawnDelay = 2.0f;
}
void SpinnersVol::ProcessEvent(Entity* self, const bool upperLimitReached) {
if (!upperLimitReached) return;
// Each player in the volume sees the cinematic
auto* const phantomPhysics = self->GetComponent<PhantomPhysicsComponent>();
if (phantomPhysics && phantomPhysics->GetdpEntity()) {
for (const auto id : phantomPhysics->GetdpEntity()->GetCurrentlyCollidingObjects()) {
auto* const player = Game::entityManager->GetEntity(id);
if (!player || !player->IsPlayer()) continue;
GameMessages::PlayCinematic cinematic;
cinematic.target = player->GetObjectID();
cinematic.pathName = m_TargetCine;
cinematic.Send(player->GetSystemAddress());
}
}
// (a timer with cancel: a second one replaces the first)
self->CancelTimer(m_TimerName);
self->AddTimer(m_TimerName, SpawnDelay);
}
void SpinnersVol::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != m_TimerName) return;
const auto spawners = Game::zoneManager->GetSpawnersByName(m_TargetNetwork);
if (!spawners.empty() && spawners.front()) spawners.front()->Activate();
}