using Content.Shared.FixedPoint;
using Content.Shared.Mobs;
using Robust.Shared.Network;
namespace Content.Server.KillTracking;
///
/// This is used for entities that track player damage sources and killers.
///
[RegisterComponent, Access(typeof(KillTrackingSystem))]
public sealed partial class KillTrackerComponent : Component
{
///
/// The mobstate that registers as a "kill"
///
[DataField("killState")]
public MobState KillState = MobState.Critical;
///
/// A dictionary of sources and how much damage they've done to this entity over time.
///
[DataField("lifetimeDamage")]
public Dictionary LifetimeDamage = new();
}
public abstract record KillSource;
///
/// A kill source for players
///
[DataDefinition, Serializable]
public sealed partial record KillPlayerSource : KillSource
{
[DataField("playerId")]
public NetUserId PlayerId;
public KillPlayerSource(NetUserId playerId)
{
PlayerId = playerId;
}
}
///
/// A kill source for non-player controlled entities
///
[DataDefinition, Serializable]
public sealed partial record KillNpcSource : KillSource
{
[DataField("npcEnt")]
public EntityUid NpcEnt;
public KillNpcSource(EntityUid npcEnt)
{
NpcEnt = npcEnt;
}
}
///
/// A kill source for kills with no damage origin
///
[DataDefinition, Serializable]
public sealed partial record KillEnvironmentSource : KillSource;