Files
DarkflameServer/dScripts/02_server/Map/General/KillCounterUtil.h
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

25 lines
1.2 KiB
C++

#pragma once
#include "CppScripts.h"
class Spawner;
// L_KILL_COUNTER_UTIL.lua: counts the deaths of what its spawner networks (spawnNw1, spawnNw2, ...) spawn, from min
// (0) to max (the networks' max_to_spawn when not set). At max it fires maxHit_event at maxHit_group and stops
// listening (unless bAutoShutoff is false); back at min it fires minHit_event at minHit_group. Events it is sent by
// name (a config value: increment, decrement, stopNotifies, startNotifies, reset) work the counter. Scripts that extend
// it act on the limits in ProcessEvent.
class KillCounterUtil : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
protected:
// Reached max (true) or min (false)
virtual void ProcessEvent(Entity* self, bool upperLimitReached) {}
void ModifyCounter(Entity* self, const std::string& modType);
private:
void SpawnerNotifies(Entity* self, bool subscribe);
void ResetCounter(Entity* self);
void SendEvent(Entity* self, bool upperLimitReached);
static std::vector<Spawner*> SpawnNetworks(Entity* self);
};