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 GitHub
parent 65462d8ca5
commit 6f1eeba191
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 Content.Shared.Overlays;
using Robust.Client.Player; using Robust.Client.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using System.Linq; using System.Linq;
namespace Content.Client.Commands; namespace Content.Client.Commands;
@@ -34,7 +36,7 @@ public sealed class ShowHealthBarsCommand : LocalizedCommands
{ {
var showHealthBarsComponent = new ShowHealthBarsComponent var showHealthBarsComponent = new ShowHealthBarsComponent
{ {
DamageContainers = args.ToList(), DamageContainers = args.Select(arg => new ProtoId<DamageContainerPrototype>(arg)).ToList(),
HealthStatusIcon = null, HealthStatusIcon = null,
NetSyncEnabled = false NetSyncEnabled = false
}; };

View File

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

View File

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

View File

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

View File

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