mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Initial decoupling pass on Damageable * ope * e * mroaw * ok sure on the medibot thing * no medibot bounds * okidooks * arcryox era * cryox moment
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using Content.Shared.Damage.Systems;
|
|
|
|
namespace Content.Shared.Destructible;
|
|
|
|
public abstract class SharedDestructibleSystem : EntitySystem
|
|
{
|
|
// TODO: I don't really like this but this is out of scope to re-do destructible triggers while refactoring damageable
|
|
[Dependency] public readonly DamageableSystem Damageable = default!;
|
|
|
|
/// <summary>
|
|
/// Force entity to be destroyed and deleted.
|
|
/// </summary>
|
|
public bool DestroyEntity(Entity<MetaDataComponent?> owner)
|
|
{
|
|
var ev = new DestructionAttemptEvent();
|
|
RaiseLocalEvent(owner, ev);
|
|
if (ev.Cancelled)
|
|
return false;
|
|
|
|
var eventArgs = new DestructionEventArgs();
|
|
RaiseLocalEvent(owner, eventArgs);
|
|
|
|
PredictedQueueDel(owner);
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Force entity to break.
|
|
/// </summary>
|
|
public void BreakEntity(EntityUid owner)
|
|
{
|
|
var eventArgs = new BreakageEventArgs();
|
|
RaiseLocalEvent(owner, eventArgs);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised before an entity is about to be destroyed and deleted
|
|
/// </summary>
|
|
public sealed class DestructionAttemptEvent : CancellableEntityEventArgs
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised when entity is destroyed and about to be deleted.
|
|
/// </summary>
|
|
public sealed class DestructionEventArgs : EntityEventArgs
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised when entity was heavy damage and about to break.
|
|
/// </summary>
|
|
public sealed class BreakageEventArgs : EntityEventArgs
|
|
{
|
|
|
|
}
|