using Content.Shared.Changeling.Components;
using Content.Shared.Destructible;
namespace Content.Shared.Changeling.Systems;
public sealed partial class DestructionResistanceSystem : EntitySystem
{
///
/// Prevent destruction via non-ashing sources, if appropriate.
///
/// The entity.
/// The destruction event args. Canceled if the component is set to disable gibbing.
[SubscribeLocalEvent]
private void OnDestruction(Entity ent, ref DestructionAttemptEvent args)
{
if (ent.Comp.Enabled)
args.Cancel();
}
///
/// Enable or disable the DestructionResistanceComponent.
///
/// The entity that has the component.
/// If it is enabled or not.
public void SetEnabled(Entity ent, bool enabled)
{
if (!Resolve(ent, ref ent.Comp, false))
return;
ent.Comp.Enabled = enabled;
Dirty(ent);
}
}