Validate prototype ids in c# fields (#18224)
This commit is contained in:
@@ -14,6 +14,9 @@ public abstract class ClothingSystem : EntitySystem
|
||||
[Dependency] private readonly SharedHumanoidAppearanceSystem _humanoidSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
|
||||
[ValidatePrototypeId<TagPrototype>]
|
||||
private const string HairTag = "HidesHair";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -27,14 +30,14 @@ public abstract class ClothingSystem : EntitySystem
|
||||
protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
|
||||
{
|
||||
component.InSlot = args.Slot;
|
||||
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, "HidesHair"))
|
||||
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag))
|
||||
_humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, false);
|
||||
}
|
||||
|
||||
protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
|
||||
{
|
||||
component.InSlot = null;
|
||||
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, "HidesHair"))
|
||||
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag))
|
||||
_humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user