mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
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>
39 lines
1.3 KiB
C++
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();
|
|
}
|