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