CatStation/Content.Server/Destructible/DestructibleComponent.cs
Connor Huffine 07802c2d66
Destructible Automatic Overkill (#43113)
* Change to file scoped namespace

* Improve variable naming

* Remove unnecessary audiosystem

* Add automatic overkill

* Small cleanups

* Alphabetize dependencies

* Change to file scoped namespace

* Change to OnMapInit

* Fix overkill if no destruction node present

* Add overkill test

* Example cleanup

* Performance improvements

* Tuple event subscriptions

* Correct comment

* Realphabetize

I might be dyslexic. Or just stupid.

* Invert toggle behavior and rename

* Change from MapInit to ComponentInit

* Revert "Change from MapInit to ComponentInit"

This reverts commit 1ed9fa0ad49be00becd9adca5cfee45cf4fef3a2.

* Change to use index instead of raw int

* Explicit check not required

* Clean up overkill test

* Improve commenting

* Overhaul the test

* Little more

* Improve commenting

* Update DestructibleOverkillTest.cs

* Typo

* Change to tuple assignment

* Alphabetize dependencies

* Update Content.IntegrationTests/Tests/Destructible/DestructibleOverkillTest.cs

* Update Content.IntegrationTests/Tests/Destructible/DestructibleOverkillTest.cs

* Update Content.IntegrationTests/Tests/Destructible/DestructibleOverkillTest.cs

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2026-05-24 05:32:23 +00:00

31 lines
1,020 B
C#

using Content.Server.Destructible.Thresholds;
namespace Content.Server.Destructible;
/// <summary>
/// When attached to an <see cref="Robust.Shared.GameObjects.EntityUid"/>, allows it to take damage
/// and triggers thresholds when reached.
/// </summary>
[RegisterComponent]
public sealed partial class DestructibleComponent : Component
{
/// <summary>
/// A list of damage thresholds for the entity;
/// includes their triggers and resultant behaviors.
/// </summary>
[DataField]
public List<DamageThreshold> Thresholds = new();
/// <summary>
/// Specifies whether the entity has passed a damage threshold that causes it to break.
/// </summary>
[DataField]
public bool IsBroken = false;
/// <summary>
/// Specifies if the entity should be silently destroyed when receiving damage significantly in excess of
/// its normal destructible threshold.
/// </summary>
[DataField(readOnly: true)]
public bool GenerateOverkillThreshold = true;
}