CatStation/Content.Shared/Destructible/SharedDestructibleSystem.cs
ScarKy0 3c0f62c006
Changeling Resilience (#44421)
* boom

TODO:
- actual organs

* silly! silly! silly! silly!

* consentual murder

* cleaning

* how woke

* fuck everything

* remove organ replacement, do metabolizer instead

* oops

* thank you, comment i left for myself!

* no ammonia immunity

* whitespace

* Handle a few small things myself

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* some requested changes

* Remove TryGib and Friends

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Make changelings indestructible

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Recycler

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Fix recycler

* Add comments

* Opps!

* Remove metabolizer

* Opps metabolizer system and remove systems!

* Forgot to add them...

* typo

Co-authored-by: SnappingOpossum <snappingopossum@outlook.com>

* Renamed component, fix various systems

* stuff

---------

Signed-off-by: Connor Huffine <chuffine@gmail.com>
Co-authored-by: Connor Huffine <chuffine@gmail.com>
Co-authored-by: beck-thompson <beck314159@hotmail.com>
Co-authored-by: SnappingOpossum <snappingopossum@outlook.com>
2026-07-23 17:49:52 +00:00

69 lines
1.7 KiB
C#

using Content.Shared.Damage.Systems;
namespace Content.Shared.Destructible;
public abstract partial 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 DamageableSystem Damageable = default!;
/// <summary>
/// Force entity to be destroyed and deleted.
/// </summary>
public bool DestroyEntity(EntityUid owner)
{
if (!CanDestroy(owner))
return false;
var eventArgs = new DestructionEventArgs();
RaiseLocalEvent(owner, eventArgs);
PredictedQueueDel(owner);
return true;
}
/// <param name="owner">Entity that your checking.</param>
/// <returns>If it can be destroyed</returns>
public bool CanDestroy(EntityUid owner)
{
var ev = new DestructionAttemptEvent();
RaiseLocalEvent(owner, ev);
if (ev.Cancelled)
return false;
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
{
}