Flavor text (#8070)

This commit is contained in:
Veritius
2022-05-14 08:58:45 +10:00
committed by GitHub
parent 83da49e1be
commit 3b7e202044
23 changed files with 2705 additions and 14 deletions

View File

@@ -192,6 +192,7 @@ namespace Content.Server.Database
return new HumanoidCharacterProfile(
profile.CharacterName,
profile.FlavorText,
profile.Species,
profile.Age,
sex,
@@ -227,6 +228,7 @@ namespace Content.Server.Database
var entity = new Profile
{
CharacterName = humanoid.Name,
FlavorText = humanoid.FlavorText,
Species = humanoid.Species,
Age = humanoid.Age,
Sex = humanoid.Sex.ToString(),

View File

@@ -0,0 +1,9 @@
namespace Content.Server.DetailExaminable
{
[RegisterComponent]
public sealed class DetailExaminableComponent : Component
{
[DataField("content", required: true)] [ViewVariables(VVAccess.ReadWrite)]
public string Content = "";
}
}

View File

@@ -0,0 +1,41 @@
using Content.Shared.Examine;
using Content.Shared.Verbs;
using Robust.Shared.Utility;
namespace Content.Server.DetailExaminable
{
public sealed class DetailExaminableSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DetailExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
}
private void OnGetExamineVerbs(EntityUid uid, DetailExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
{
// TODO: Hide if identity isn't visible (when identity is merged)
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
var verb = new ExamineVerb()
{
Act = () =>
{
var markup = new FormattedMessage();
markup.AddMarkup(component.Content);
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
},
Text = Loc.GetString("detail-examinable-verb-text"),
Category = VerbCategory.Examine,
Disabled = !detailsRange,
Message = Loc.GetString("detail-examinable-verb-disabled"),
IconTexture = "/Textures/Interface/VerbIcons/examine.svg.192dpi.png"
};
args.Verbs.Add(verb);
}
}
}

View File

@@ -1,17 +1,20 @@
using Content.Server.Access.Systems;
using Content.Server.Access.Systems;
using Content.Server.CharacterAppearance.Systems;
using Content.Server.DetailExaminable;
using Content.Server.Hands.Components;
using Content.Server.Hands.Systems;
using Content.Server.PDA;
using Content.Server.Roles;
using Content.Server.Station.Components;
using Content.Shared.Access.Components;
using Content.Shared.CCVar;
using Content.Shared.Inventory;
using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Species;
using JetBrains.Annotations;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -26,6 +29,7 @@ namespace Content.Server.Station.Systems;
public sealed class StationSpawningSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearanceSystem = default!;
[Dependency] private readonly IdCardSystem _cardSystem = default!;
@@ -97,6 +101,10 @@ public sealed class StationSpawningSystem : EntitySystem
{
_humanoidAppearanceSystem.UpdateFromProfile(entity, profile);
EntityManager.GetComponent<MetaDataComponent>(entity).EntityName = profile.Name;
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
{
EntityManager.AddComponent<DetailExaminableComponent>(entity).Content = profile.FlavorText;
}
}
foreach (var jobSpecial in job?.Prototype.Special ?? Array.Empty<JobSpecial>())