mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-21 15:38:52 +03:00
## Mirror of PR #26027: [Improves Medical Hud interface and functionality](https://github.com/space-wizards/space-station-14/pull/26027) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `8d40bc36a93d3d5c6d3ece6c662ac9747f7837ae` PR opened by <img src="https://avatars.githubusercontent.com/u/68350815?v=4" width="16"/><a href="https://github.com/DoutorWhite"> DoutorWhite</a> at 2024-03-12 07:00:06 UTC --- PR changed 8 files with 78 additions and 13 deletions. The PR had the following labels: - Changes: Sprites - Status: Awaiting Changes --- <details open="true"><summary><h1>Original Body</h1></summary> > ## About the PR > > There are some changes to the Medical Hud interface: The icon has been changed and now there is one for each mob state, making it easier to recognize whether the mob is rotting, dead or crit. > > ## Why / Balance > > It's more visually pleasing and helps with discerning mob states. > > ## Technical details > > There is a decision structure for determining which icon is appropriate for the mob's state. It's the only relevant code change. > > ## Media > >  > > - [X] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase > > > **Changelog** > > 🆑 > - add: Introduce new health status icons. > - tweak: Enhance the Medical HUD to display the health status of players and mobs using the newly added icons. </details> Co-authored-by: SimpleStation14 <Unknown>
97 lines
4.0 KiB
C#
97 lines
4.0 KiB
C#
using Content.Shared.Damage.Prototypes;
|
|
using Content.Shared.FixedPoint;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.StatusIcon;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
|
|
|
namespace Content.Shared.Damage
|
|
{
|
|
/// <summary>
|
|
/// Component that allows entities to take damage.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The supported damage types are specified using a <see cref="DamageContainerPrototype"/>s. DamageContainers
|
|
/// may also have resistances to certain damage types, defined via a <see cref="DamageModifierSetPrototype"/>.
|
|
/// </remarks>
|
|
[RegisterComponent]
|
|
[NetworkedComponent()]
|
|
[Access(typeof(DamageableSystem), Other = AccessPermissions.ReadExecute)]
|
|
public sealed partial class DamageableComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// This <see cref="DamageContainerPrototype"/> specifies what damage types are supported by this component.
|
|
/// If null, all damage types will be supported.
|
|
/// </summary>
|
|
[DataField("damageContainer", customTypeSerializer: typeof(PrototypeIdSerializer<DamageContainerPrototype>))]
|
|
public string? DamageContainerID;
|
|
|
|
/// <summary>
|
|
/// This <see cref="DamageModifierSetPrototype"/> will be applied to any damage that is dealt to this container,
|
|
/// unless the damage explicitly ignores resistances.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Though DamageModifierSets can be deserialized directly, we only want to use the prototype version here
|
|
/// to reduce duplication.
|
|
/// </remarks>
|
|
[DataField("damageModifierSet", customTypeSerializer: typeof(PrototypeIdSerializer<DamageModifierSetPrototype>))]
|
|
public string? DamageModifierSetId;
|
|
|
|
/// <summary>
|
|
/// All the damage information is stored in this <see cref="DamageSpecifier"/>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// If this data-field is specified, this allows damageable components to be initialized with non-zero damage.
|
|
/// </remarks>
|
|
[DataField("damage", readOnly: true)] //todo remove this readonly when implementing writing to damagespecifier
|
|
public DamageSpecifier Damage = new();
|
|
|
|
/// <summary>
|
|
/// Damage, indexed by <see cref="DamageGroupPrototype"/> ID keys.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Groups which have no members that are supported by this component will not be present in this
|
|
/// dictionary.
|
|
/// </remarks>
|
|
[ViewVariables] public Dictionary<string, FixedPoint2> DamagePerGroup = new();
|
|
|
|
/// <summary>
|
|
/// The sum of all damages in the DamageableComponent.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public FixedPoint2 TotalDamage;
|
|
|
|
[DataField("radiationDamageTypes", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageTypePrototype>))]
|
|
public List<string> RadiationDamageTypeIDs = new() { "Radiation" };
|
|
|
|
[DataField]
|
|
public Dictionary<MobState, ProtoId<StatusIconPrototype>> HealthIcons = new()
|
|
{
|
|
{ MobState.Alive, "HealthIconFine" },
|
|
{ MobState.Critical, "HealthIconCritical" },
|
|
{ MobState.Dead, "HealthIconDead" },
|
|
};
|
|
|
|
[DataField]
|
|
public ProtoId<StatusIconPrototype> RottingIcon = "HealthIconRotting";
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed class DamageableComponentState : ComponentState
|
|
{
|
|
public readonly Dictionary<string, FixedPoint2> DamageDict;
|
|
public readonly string? ModifierSetId;
|
|
|
|
public DamageableComponentState(
|
|
Dictionary<string, FixedPoint2> damageDict,
|
|
string? modifierSetId)
|
|
{
|
|
DamageDict = damageDict;
|
|
ModifierSetId = modifierSetId;
|
|
}
|
|
}
|
|
}
|