diff --git a/Content.Client/SimpleStation14/Examine/CharacterInformation/Systems/CharacterInformationSystem.cs b/Content.Client/SimpleStation14/Examine/CharacterInformation/Systems/CharacterInformationSystem.cs deleted file mode 100644 index bf10c4c5c61..00000000000 --- a/Content.Client/SimpleStation14/Examine/CharacterInformation/Systems/CharacterInformationSystem.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System.Linq; -using Content.Client.Examine; -using Content.Client.Inventory; -using Content.Shared.SimpleStation14.Examine.CharacterInformation.Components; -using Content.Client.SimpleStation14.Examine.CharacterInformation.UI; -using Content.Shared.Access.Components; -using Content.Shared.CCVar; -using Content.Shared.SimpleStation14.DetailExaminable; -using Content.Shared.IdentityManagement.Components; -using Content.Shared.PDA; -using Content.Shared.Roles; -using Content.Shared.Verbs; -using Robust.Shared.Configuration; -using Robust.Shared.Prototypes; -using Robust.Shared.Utility; - -namespace Content.Client.SimpleStation14.Examine.CharacterInformation.Systems; - -public sealed class CharacterInformationSystem : EntitySystem -{ - [Dependency] private readonly ExamineSystem _examine = default!; - [Dependency] private readonly ClientInventorySystem _inventory = default!; - [Dependency] private readonly IEntityManager _entity = default!; - [Dependency] private readonly IPrototypeManager _prototype = default!; - [Dependency] private readonly IConfigurationManager _config = default!; - - private CharacterInformationWindow? _window; - - - public override void Initialize() - { - base.Initialize(); - - _window = new CharacterInformationWindow(); - - SubscribeLocalEvent>(OnGetExamineVerbs); - } - - - private void OnGetExamineVerbs(EntityUid uid, CharacterInformationComponent component, GetVerbsEvent args) - { - var verb = new ExamineVerb - { - Act = () => - { - ShowInfoWindow(args.Target); - }, - Text = Loc.GetString("character-information-verb-text"), - Message = Loc.GetString("character-information-verb-message"), - Category = VerbCategory.Examine, - Disabled = !_examine.IsInDetailsRange(args.User, uid), - Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/information.svg.192dpi.png")), - ClientExclusive = true, - }; - - args.Verbs.Add(verb); - } - - - private void ShowInfoWindow(EntityUid uid) - { - if (_window == null) - return; - - string? name = null; - string? job = null; - string? flavorText = null; - - // Get ID from inventory, get name and job from ID - var info = GetNameAndJob(uid); - - name = info.Item1; - job = info.Item2; - - // Fancy job title - if (!string.IsNullOrEmpty(job)) - { - var test = job.Replace(" ", ""); - // Command will be last in the list - // TODO: Make this not revolve around this fact ^ - var departments = _prototype.EnumeratePrototypes().OrderBy(d => d.ID).Reverse(); - var department = departments.FirstOrDefault(d => d.Roles.Contains(test)); - - if (department is not null) - { - // Department (ex: Command or Security) - var dept = string.Join(" ", Loc.GetString($"department-{department.ID}").Split(' ').Select(s => s[0].ToString().ToUpper() + s[1..].ToLower())); - // Redo the job title with the department color and department (ex: Captain (Command) or Security Officer (Security)) - job = $"[color={department.Color.ToHex()}]{job} ({dept})[/color]"; - } - } - - // Get and set flavor text - if (_config.GetCVar(CCVars.FlavorText) && - _entity.TryGetComponent(uid, out var detail)) - flavorText = detail.Content; - - _window.UpdateUi(uid, name, job, flavorText); - _window.Open(); - } - - /// - /// Gets the ID card component from either a PDA or an ID card if the entity has one - /// - /// Entity to check - /// ID card component if they have one on the entity - /// This function should not exist // TODO Remove this function - private IdCardComponent? GetId(EntityUid? idUid) - { - // PDA - if (_entity.TryGetComponent(idUid, out PdaComponent? pda) && pda.ContainedId is not null) - return _entity.GetComponent(pda.ContainedId.Value); - // ID Card - if (_entity.TryGetComponent(idUid, out IdCardComponent? id)) - return id; - - return null; - } - - /// - /// Gets the name and job title from an ID card component - /// - /// The entity to attempt information retrieval from - /// Name, Job Title - /// This function should not exist - private (string, string) GetNameAndJob(EntityUid uid) - { - string? name = null; - - if (_entity.TryGetComponent(uid, out var identity) && - identity.IdentityEntitySlot.ContainedEntity != null) - name = _entity.GetComponent(identity.IdentityEntitySlot.ContainedEntity.Value).EntityName; - - if (_inventory.TryGetSlotEntity(uid, "id", out var idUid)) - { - var id = GetId(idUid); - if (id is not null) - { - name ??= id.FullName; - if (string.IsNullOrEmpty(name)) - name = "Unknown"; - - var jobTitle = id.JobTitle; - if (string.IsNullOrEmpty(jobTitle)) - jobTitle = "Unknown"; - jobTitle = string.Join(" ", jobTitle.Split(' ').Select(s => s[0].ToString().ToUpper() + s[1..].ToLower())); - - return (name, jobTitle); - } - } - - return (name ?? "Unknown", "Unknown"); - } -} diff --git a/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml b/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml deleted file mode 100644 index 029893be5ac..00000000000 --- a/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml.cs b/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml.cs deleted file mode 100644 index bc269ddc24c..00000000000 --- a/Content.Client/SimpleStation14/Examine/CharacterInformation/UI/CharacterInformationWindow.xaml.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System.Linq; -using System.Numerics; -using Content.Client.Message; -using Content.Client.UserInterface.Controls; -using Content.Shared.Humanoid; -using Content.Shared.Inventory; -using Microsoft.CodeAnalysis; -using Robust.Client.AutoGenerated; -using Robust.Client.GameObjects; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.XAML; -using Robust.Shared.Containers; -using Robust.Shared.Map; - -namespace Content.Client.SimpleStation14.Examine.CharacterInformation.UI; - -[GenerateTypedNameReferences] -public sealed partial class CharacterInformationWindow : FancyWindow -{ - private readonly IEntityManager _entity; - private readonly InventorySystem _inventory; - - private EntityUid _dummy = EntityUid.Invalid; - - // ReSharper disable once InconsistentNaming - private FancyWindow _rootWindow => RootWindow; - // ReSharper disable once InconsistentNaming - private GridContainer _sprites => SpriteContainer; - // ReSharper disable once InconsistentNaming - private RichTextLabel _name => Name; - // ReSharper disable once InconsistentNaming - private RichTextLabel _job => Job; - // ReSharper disable once InconsistentNaming - private PanelContainer _separator => Separator; - // ReSharper disable once InconsistentNaming - private ScrollContainer _flavorTextScroll => FlavorTextScroll; - // ReSharper disable once InconsistentNaming - private RichTextLabel _flavor => FlavorText; - - public CharacterInformationWindow() - { - RobustXamlLoader.Load(this); - - _entity = IoCManager.Resolve(); - _inventory = EntitySystem.Get(); - - ResetUi(); - } - - - /// - /// Placeholder entries - /// - private void ResetUi() - { - _entity.DeleteEntity(_dummy); - _sprites.RemoveAllChildren(); - - var unknown = Loc.GetString("generic-unknown"); - // Capitalize the first letter of each word (Title Case) - unknown = string.Join(" ", unknown.Split(' ').Select(s => char.ToUpper(s[0]) + s[1..])); - - _name.SetMarkup(unknown); - _job.SetMarkup(unknown); - - _flavor.SetMarkup("Placeholder flavor text."); - } - - /// - /// Updates the UI to show all relevant information about the entity - /// - /// The entity to become informed about - /// The name of the examined entity, taken from their ID - /// The job of the examined entity, taken from their ID - /// The flavor text of the examined entity - public void UpdateUi(EntityUid examined, string? name = null, string? job = null, string? flavorText = null) - { - ResetUi(); - - // Fill in the omnidirectional sprite views - if (_entity.TryGetComponent(examined, out var sprite)) - FillSprites(sprite, examined); - - // Fill in the name and job - if (!string.IsNullOrEmpty(name)) - _name.SetMarkup(name); - if (!string.IsNullOrEmpty(job)) - _job.SetMarkup(job); - - // Fill in the flavor text - if (!string.IsNullOrEmpty(flavorText)) - { - _flavor.SetMessage(flavorText); - _rootWindow.MinSize = new Vector2(675, 384); - _rootWindow.SetSize = new Vector2(675, 384); - _separator.Visible = true; - _flavorTextScroll.Visible = true; - } - else - { - _rootWindow.MinSize = new Vector2(292, 384); - _rootWindow.SetSize = new Vector2(292, 384); - _separator.Visible = false; - _flavorTextScroll.Visible = false; - } - } - - - /// - /// Fills the sprite views with the sprite from the sprite component - /// - /// Sprite component to use - /// The entity belongs to - private void FillSprites(SpriteComponent sprite, EntityUid entity) - { - // This all should "freeze" the sprite views - // Spawn a dummy entity to get a copy of the sprite component from - _dummy = _entity.SpawnEntity(_entity.GetComponent(entity).EntityPrototype!.ID, MapCoordinates.Nullspace); - - // Ensures the dummy has the same sex as the entity so masks are applied correctly - if (_entity.TryGetComponent(entity, out HumanoidAppearanceComponent? humanoidAppearance)) - { - var newHumanoidAppearance = _entity.EnsureComponent(_dummy); - newHumanoidAppearance.Sex = humanoidAppearance.Sex; - } - - // Spawn and equip a fake jumpsuit (it won't be shown) so the appearance system doesn't destroy reality when applying masks - var clothing = _entity.SpawnEntity("ClothingUniformJumpsuitColorGrey", MapCoordinates.Nullspace); - _inventory.TryEquip(_dummy, _dummy, clothing, "jumpsuit", true, true); - - // Copy the sprite component from the original entity to the dummy - var newSprite = _entity.EnsureComponent(_dummy); - newSprite.CopyFrom(sprite); - newSprite.Scale = Vector2.One; - - - // Create the SpriteViews - // From lists because redefining everything except direction and margin is annoying and hard to edit in the future - var directions = new List {Direction.South, Direction.North, Direction.West, Direction.East}; - var margins = new List - { - new(0, 0, 8, 8), // South - new(8, 0, 0, 8), // North - new(0, 8, 8, 0), // West - new(8, 8, 0, 0), // East - }; - - for (var i = 0; i < directions.Count; i++) - { - var view = new SpriteView - { - Scale = new Vector2(4, 4), - Stretch = SpriteView.StretchMode.None, - MaxSize = new Vector2(128, 128), - OverrideDirection = directions[i], - Margin = margins[i] - }; - view.SetEntity(_dummy); - - _sprites.AddChild(view); - } - } -} diff --git a/Content.Server/DetailExaminable/DetailExaminableComponent.cs b/Content.Server/DetailExaminable/DetailExaminableComponent.cs index 367ca1be6f7..3cefb75869d 100644 --- a/Content.Server/DetailExaminable/DetailExaminableComponent.cs +++ b/Content.Server/DetailExaminable/DetailExaminableComponent.cs @@ -1,11 +1,9 @@ -// Parkstation-CharacterInformation-Start - This was moved to the Shared namespace -// namespace Content.Server.DetailExaminable -// { -// [RegisterComponent] -// public sealed class DetailExaminableComponent : Component -// { -// [DataField("content", required: true)] [ViewVariables(VVAccess.ReadWrite)] -// public string Content = ""; -// } -// } -// Parkstation-CharacterInformation-End +namespace Content.Server.DetailExaminable +{ + [RegisterComponent] + public sealed partial class DetailExaminableComponent : Component + { + [DataField("content", required: true)] [ViewVariables(VVAccess.ReadWrite)] + public string Content = ""; + } +} diff --git a/Content.Server/DetailExaminable/DetailExaminableystem.cs b/Content.Server/DetailExaminable/DetailExaminableystem.cs index 27258155898..c0acd87ca43 100644 --- a/Content.Server/DetailExaminable/DetailExaminableystem.cs +++ b/Content.Server/DetailExaminable/DetailExaminableystem.cs @@ -1,46 +1,44 @@ -// Parkstation-CharacterInformation-Start - This was moved to the Shared namespace -// using Content.Shared.Examine; -// using Content.Shared.IdentityManagement; -// using Content.Shared.Verbs; -// using Robust.Shared.Utility; +using Content.Shared.Examine; +using Content.Shared.IdentityManagement; +using Content.Shared.Verbs; +using Robust.Shared.Utility; -// namespace Content.Server.DetailExaminable -// { -// public sealed class DetailExaminableSystem : EntitySystem -// { -// [Dependency] private readonly ExamineSystemShared _examineSystem = default!; +namespace Content.Server.DetailExaminable +{ + public sealed class DetailExaminableSystem : EntitySystem + { + [Dependency] private readonly ExamineSystemShared _examineSystem = default!; -// public override void Initialize() -// { -// base.Initialize(); + public override void Initialize() + { + base.Initialize(); -// SubscribeLocalEvent>(OnGetExamineVerbs); -// } + SubscribeLocalEvent>(OnGetExamineVerbs); + } -// private void OnGetExamineVerbs(EntityUid uid, DetailExaminableComponent component, GetVerbsEvent args) -// { -// if (Identity.Name(args.Target, EntityManager) != MetaData(args.Target).EntityName) -// return; + private void OnGetExamineVerbs(EntityUid uid, DetailExaminableComponent component, GetVerbsEvent args) + { + if (Identity.Name(args.Target, EntityManager) != MetaData(args.Target).EntityName) + return; -// var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid); + 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 = detailsRange ? null : Loc.GetString("detail-examinable-verb-disabled"), -// Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/examine.svg.192dpi.png")) -// }; + 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 = detailsRange ? null : Loc.GetString("detail-examinable-verb-disabled"), + Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/examine.svg.192dpi.png")) + }; -// args.Verbs.Add(verb); -// } -// } -// } -// Parkstation-CharacterInformation-End + args.Verbs.Add(verb); + } + } +} diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs index 4bb55970c93..b7b7192f40e 100644 --- a/Content.Server/Station/Systems/StationSpawningSystem.cs +++ b/Content.Server/Station/Systems/StationSpawningSystem.cs @@ -1,4 +1,5 @@ using Content.Server.Access.Systems; +using Content.Server.DetailExaminable; using Content.Server.Humanoid; using Content.Server.IdentityManagement; using Content.Server.Mind.Commands; @@ -187,6 +188,10 @@ public EntityUid SpawnPlayerMob( { _humanoidSystem.LoadProfile(entity.Value, profile); _metaSystem.SetEntityName(entity.Value, profile.Name); + if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText)) + { + AddComp(entity.Value).Content = profile.FlavorText; + } } DoJobSpecials(job, entity.Value); diff --git a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs index af13b79afa3..c33f8cfedfc 100644 --- a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs @@ -2,7 +2,7 @@ using System.Numerics; using Content.Shared.CCVar; using Content.Shared.Decals; -using Content.Shared.SimpleStation14.DetailExaminable; +using Content.Shared.Examine; using Content.Shared.Humanoid.Markings; using Content.Shared.Humanoid.Prototypes; using Content.Shared.IdentityManagement; @@ -412,15 +412,6 @@ public virtual void LoadProfile(EntityUid uid, HumanoidCharacterProfile profile, humanoid.LastProfileLoaded = profile; // DeltaV - let paradox anomaly be cloned - // Parkstation-CharacterInformation-Start - if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText)) - { - var detail = EnsureComp(uid); - detail.Content = profile.FlavorText; - Dirty(detail); - } - // Parkstation-CharacterInformation-End - Dirty(uid, humanoid); } diff --git a/Content.Shared/SimpleStation14/DetailExaminable/DetailExaminableComponent.cs b/Content.Shared/SimpleStation14/DetailExaminable/DetailExaminableComponent.cs deleted file mode 100644 index f72754cb46b..00000000000 --- a/Content.Shared/SimpleStation14/DetailExaminable/DetailExaminableComponent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Robust.Shared.GameStates; - -namespace Content.Shared.SimpleStation14.DetailExaminable -{ - [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] - public sealed partial class DetailExaminableComponent : Component - { - [DataField("content", required: true)] - [ViewVariables(VVAccess.ReadWrite)] - [AutoNetworkedField] - public string Content = ""; - } -} diff --git a/Content.Shared/SimpleStation14/Examine/CharacterInformation/Components/CharacterInformationComponent.cs b/Content.Shared/SimpleStation14/Examine/CharacterInformation/Components/CharacterInformationComponent.cs deleted file mode 100644 index 0adbd04a551..00000000000 --- a/Content.Shared/SimpleStation14/Examine/CharacterInformation/Components/CharacterInformationComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Robust.Shared.GameStates; - -namespace Content.Shared.SimpleStation14.Examine.CharacterInformation.Components; - -[RegisterComponent, NetworkedComponent] -public sealed partial class CharacterInformationComponent : Component -{ - -} diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 106a7ff0252..db67ed5f85c 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -291,7 +291,6 @@ normalBodyTemperature: 310.15 thermalRegulationTemperatureThreshold: 25 - type: Perishable - - type: CharacterInformation # Parkstation-CharacterInformation - type: Butcherable butcheringType: Spike # TODO human. spawned: