Files
dota_factory/src/lib/ecs/system/RepairSystem.h

37 lines
950 B
C++

#pragma once
#include <vector>
#include "BeamFiredEvent.h"
#include "Tick.h"
#include "entt/entity/entity.hpp"
class EntityAdmin;
// World-mutation system for repair modules: each tool runs a cycle on its own
// cooldown. When a cycle starts it picks a target (the RepairExecutor-set target,
// else the nearest damaged friendly in range), emits a repair beam, and schedules
// the heal for mid-beam (kBeamImpactDelayTicks later) — mirroring weapon firing.
// Runs every tick, independent of behavior selection.
class RepairSystem
{
public:
explicit RepairSystem(EntityAdmin& admin);
void tick(Tick currentTick, std::vector<BeamFiredEvent>& outBeamFiredEvents);
private:
struct PendingHeal
{
entt::entity target;
float amountHp;
Tick appliesAt;
};
void applyPendingHeals(Tick currentTick);
EntityAdmin& m_admin;
std::vector<PendingHeal> m_pendingHeals;
};