change ShowHealthBars and ShowHealthIcons to use protoId (#32355)

use protoId
This commit is contained in:
Milon 2024-11-02 17:59:38 +01:00 committed by deltanedas
parent 3d7e121137
commit 07ae96ed2c
5 changed files with 14 additions and 15 deletions

View File

@ -1,6 +1,8 @@
using Content.Shared.Damage.Prototypes;
using Content.Shared.Overlays;
using Robust.Client.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using System.Linq;
namespace Content.Client.Commands;
@ -34,7 +36,7 @@ public sealed class ShowHealthBarsCommand : LocalizedCommands
{
var showHealthBarsComponent = new ShowHealthBarsComponent
{
DamageContainers = args.ToList(),
DamageContainers = args.Select(arg => new ProtoId<DamageContainerPrototype>(arg)).ToList(),
HealthStatusIcon = null,
NetSyncEnabled = false
};

View File

@ -2,7 +2,6 @@ using Content.Shared.Damage.Prototypes;
using Content.Shared.StatusIcon;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Overlays;
@ -15,8 +14,11 @@ public sealed partial class ShowHealthBarsComponent : Component
/// <summary>
/// Displays health bars of the damage containers.
/// </summary>
[DataField("damageContainers", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageContainerPrototype>))]
public List<string> DamageContainers = new();
[DataField]
public List<ProtoId<DamageContainerPrototype>> DamageContainers = new()
{
"Biological"
};
[DataField]
public ProtoId<HealthIconPrototype>? HealthStatusIcon = "HealthIconFine";

View File

@ -1,6 +1,6 @@
using Content.Shared.Damage.Prototypes;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Shared.Overlays;
@ -13,6 +13,9 @@ public sealed partial class ShowHealthIconsComponent : Component
/// <summary>
/// Displays health status icons of the damage containers.
/// </summary>
[DataField("damageContainers", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageContainerPrototype>))]
public List<string> DamageContainers = new();
[DataField]
public List<ProtoId<DamageContainerPrototype>> DamageContainers = new()
{
"Biological"
};
}

View File

@ -13,11 +13,7 @@
categories: [ HideSpawnMenu ]
components:
- type: ShowHealthBars
damageContainers:
- Biological
- type: ShowHealthIcons
damageContainers:
- Biological
- type: entity
parent: ClothingEyesBase
@ -226,8 +222,6 @@
sprite: Clothing/Eyes/Hud/syndagent.rsi
- type: ShowSyndicateIcons
- type: ShowHealthBars
damageContainers:
- Biological
- type: entity
parent: [ClothingEyesGlassesSunglasses, ShowSecurityIcons]

View File

@ -398,8 +398,6 @@
- type: Construction
node: syndicatemedical
- type: ShowHealthBars
damageContainers:
- Biological
- type: InteractionPopup
interactSuccessString: petting-success-syndicate-cyborg
interactFailureString: petting-failure-syndicate-cyborg