Move BarSign appearance logic to client. (#11524)

* git mv

* Client-side bar sign appearance

* fix yaml
This commit is contained in:
Leon Friedrich
2022-09-27 20:59:47 +13:00
committed by GitHub
parent 2016a8ace7
commit f69ddf451e
7 changed files with 91 additions and 62 deletions

View File

@@ -0,0 +1,24 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.BarSign
{
[RegisterComponent, NetworkedComponent]
public sealed class BarSignComponent : Component
{
[DataField("current", customTypeSerializer:typeof(PrototypeIdSerializer<BarSignPrototype>))]
public string? CurrentSign;
}
[Serializable, NetSerializable]
public sealed class BarSignComponentState : ComponentState
{
public string? CurrentSign;
public BarSignComponentState(string? current)
{
CurrentSign = current;
}
}
}

View File

@@ -0,0 +1,37 @@
using Robust.Shared.Prototypes;
namespace Content.Shared.BarSign
{
[Prototype("barSign")]
public sealed class BarSignPrototype : IPrototype
{
private string _description = string.Empty;
private string _name = string.Empty;
[ViewVariables]
[IdDataFieldAttribute]
public string ID { get; } = default!;
[DataField("icon")] public string Icon { get; private set; } = string.Empty;
[DataField("name")]
public string Name
{
get => _name;
private set => _name = Loc.GetString(value);
}
[DataField("description")]
public string Description
{
get => _description;
private set => _description = Loc.GetString(value);
}
[DataField("renameArea")]
public bool RenameArea { get; private set; } = true;
[DataField("hidden")]
public bool Hidden { get; private set; }
}
}