@@ -9,20 +9,19 @@ public sealed class RoleplayInfoSystem : SharedRoleplaySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<RoleplayInfoComponent,ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<RoleplayInfoComponent, ExaminedEvent>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace Content.Shared._Amour.RoleplayInfo;
|
||||
[RegisterComponent]
|
||||
public sealed partial class RoleplayInfoComponent : Component
|
||||
{
|
||||
[DataField] public List<RoleplayInfo> Data = new();
|
||||
[ViewVariables] public List<RoleplayInfo> Data { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,5 +15,11 @@ public abstract class SharedRoleplaySystem : EntitySystem
|
||||
private void OnHumanoidLoading(EntityUid uid, RoleplayInfoComponent component, HumanoidAppearanceLoadingEvent args)
|
||||
{
|
||||
component.Data = new List<RoleplayInfo>(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<RoleplayInfo> { erp, noncon };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user