Refactor ExaminableDamage (#38978)

* Remove prototype caching in ExaminableDamageComponent

* Replace ExaminableDamagePrototype with LocalizedDatasetPrototype

* Allow null
This commit is contained in:
Tayrtahn
2025-07-14 00:35:47 -04:00
committed by GitHub
parent bd2212beff
commit 4f766f199c
4 changed files with 34 additions and 77 deletions

View File

@@ -1,16 +1,18 @@
using Content.Shared.Damage.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Content.Shared.Dataset;
using Robust.Shared.Prototypes;
namespace Content.Server.Damage.Components;
/// <summary>
/// This component shows entity damage severity when it is examined by player.
/// This component shows entity damage severity when it is examined by player.
/// </summary>
[RegisterComponent]
public sealed partial class ExaminableDamageComponent : Component
{
[DataField("messages", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<ExaminableDamagePrototype>))]
public string? MessagesProtoId;
public ExaminableDamagePrototype? MessagesProto;
/// <summary>
/// ID of the <see cref="LocalizedDatasetPrototype"/> containing messages to display a different damage levels.
/// The first message will be used at 0 damage with the others equally distributed across the range from undamaged to fully damaged.
/// </summary>
[DataField]
public ProtoId<LocalizedDatasetPrototype>? Messages;
}