From eadcc227d5e4da62b926e16c2b0802002593768b Mon Sep 17 00:00:00 2001 From: BIGZi0348 <118811750+BIGZi0348@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:47:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=BD=D0=9A=D0=BE=D0=BD=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=D1=82=20+=20=D0=B7=D0=B0=D1=89=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=20=D0=BE=D1=82=20=D1=85=D0=B8=D1=82=D1=80=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BF=D0=B5=D0=B4=D0=B0=D0=BB=D0=B5=D0=B9=20(#169)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MassiveCok --- Content.Server/_Amour/RoleplayInfo/RoleplayInfoSystem.cs | 9 ++++----- .../_Amour/RoleplayInfo/RoleplayInfoComponent.cs | 2 +- Content.Shared/_Amour/RoleplayInfo/RoleplayInfoData.cs | 4 ++-- .../_Amour/RoleplayInfo/SharedRoleplaySystem.cs | 6 ++++++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Content.Server/_Amour/RoleplayInfo/RoleplayInfoSystem.cs b/Content.Server/_Amour/RoleplayInfo/RoleplayInfoSystem.cs index fe5cf6f082..fdc1f75d8f 100644 --- a/Content.Server/_Amour/RoleplayInfo/RoleplayInfoSystem.cs +++ b/Content.Server/_Amour/RoleplayInfo/RoleplayInfoSystem.cs @@ -9,20 +9,19 @@ public sealed class RoleplayInfoSystem : SharedRoleplaySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnExamined); } private void OnExamined(EntityUid uid, RoleplayInfoComponent component, ExaminedEvent args) { - if(component.Data.Count == 0) + if (component.Data.Count == 0) return; - - args.PushText($"\n{Loc.GetString("roleplay-info")}",-1); + args.PushText($"\n{Loc.GetString("roleplay-info")}", -1); foreach (var data in component.Data) { - args.PushMarkup($"[bold]{Loc.GetString("roleplay-name-" + data.Name.ToLower())}[/bold] - {Loc.GetString("roleplay-" + data.RoleplaySelection.ToString().ToLower())}",-1); + args.PushMarkup($"[bold]{Loc.GetString("roleplay-name-" + data.Name.ToLower())}[/bold] - {Loc.GetString("roleplay-" + data.RoleplaySelection.ToString().ToLower())}", -1); } } } diff --git a/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoComponent.cs b/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoComponent.cs index e93253b09f..878a3ab5e6 100644 --- a/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoComponent.cs +++ b/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoComponent.cs @@ -3,5 +3,5 @@ namespace Content.Shared._Amour.RoleplayInfo; [RegisterComponent] public sealed partial class RoleplayInfoComponent : Component { - [DataField] public List Data = new(); + [ViewVariables] public List Data { get; set; } = []; } diff --git a/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoData.cs b/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoData.cs index 03405be62f..2c15b694c5 100644 --- a/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoData.cs +++ b/Content.Shared/_Amour/RoleplayInfo/RoleplayInfoData.cs @@ -5,8 +5,8 @@ namespace Content.Shared._Amour.RoleplayInfo; [Serializable, NetSerializable, DataDefinition] public sealed partial class RoleplayInfo { - [DataField] public string Name ; - [DataField] public RoleplaySelection RoleplaySelection; + [ViewVariables] public string Name; + [ViewVariables] public RoleplaySelection RoleplaySelection; public RoleplayInfo(string name, RoleplaySelection roleplaySelection) { Name = name; diff --git a/Content.Shared/_Amour/RoleplayInfo/SharedRoleplaySystem.cs b/Content.Shared/_Amour/RoleplayInfo/SharedRoleplaySystem.cs index 8f7948d192..aa593e3fbc 100644 --- a/Content.Shared/_Amour/RoleplayInfo/SharedRoleplaySystem.cs +++ b/Content.Shared/_Amour/RoleplayInfo/SharedRoleplaySystem.cs @@ -15,5 +15,11 @@ public abstract class SharedRoleplaySystem : EntitySystem private void OnHumanoidLoading(EntityUid uid, RoleplayInfoComponent component, HumanoidAppearanceLoadingEvent args) { component.Data = new List(args.Profile.RoleplayInfoData.Select(p => p.Value)); + if (component.Data.Count == 0) + { + var erp = new RoleplayInfo(name: "erp", roleplaySelection: RoleplaySelection.No); + var noncon = new RoleplayInfo(name: "noncon", roleplaySelection: RoleplaySelection.No); + component.Data = new List { erp, noncon }; + } } }