[draft] examine tweaks (#161)
* deathgasps component, clothes examine system * howered entities code w/o ui (#162) Co-authored-by: Mona Hmiza <> * lazy, mb later * fuck * wonderробукс bump * trying to fix уамлики
This commit is contained in:
@@ -387,7 +387,7 @@ namespace Content.Client.Examine
|
|||||||
_lastExaminedEntity = entity;
|
_lastExaminedEntity = entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseTooltip()
|
public void CloseTooltip()
|
||||||
{
|
{
|
||||||
if (_examineTooltipOpen != null)
|
if (_examineTooltipOpen != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
<Control Name="CFlavorText" xmlns="https://spacestation14.io">
|
<Control Name="CFlavorText" xmlns="https://spacestation14.io"
|
||||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
|
||||||
<TextEdit Name="CFlavorTextInput" Access="Public" MinSize="220 100" Margin="10" HorizontalExpand="True" VerticalExpand="True" />
|
<PanelContainer>
|
||||||
</BoxContainer>
|
<PanelContainer.PanelOverride>
|
||||||
|
<graphics:StyleBoxFlat BackgroundColor="#242429" />
|
||||||
|
</PanelContainer.PanelOverride>
|
||||||
|
|
||||||
|
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5">
|
||||||
|
<TextEdit Name="CFlavorTextInput" Access="Public" MinSize="220 100" HorizontalExpand="True" VerticalExpand="True" />
|
||||||
|
</BoxContainer>
|
||||||
|
</PanelContainer>
|
||||||
</Control>
|
</Control>
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Content.Client.Examine;
|
||||||
|
using Content.Client.Inventory;
|
||||||
|
using Content.Shared.Access.Components;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
|
using Content.Shared.PDA;
|
||||||
|
using Content.Shared.Roles;
|
||||||
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.White.CharacterExamine;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Client.White.CharacterExamine;
|
||||||
|
|
||||||
|
|
||||||
|
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<CharacterInformationComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void OnGetExamineVerbs(EntityUid uid, CharacterInformationComponent component, GetVerbsEvent<ExamineVerb> args)
|
||||||
|
{
|
||||||
|
var verb = new ExamineVerb()
|
||||||
|
{
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
// TODO: Better name?
|
||||||
|
Do(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 ResPath("/Textures/Interface/VerbIcons/sentient.svg.192dpi.png")),
|
||||||
|
ClientExclusive = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
args.Verbs.Add(verb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Do(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
|
||||||
|
if (_inventory.TryGetSlotEntity(uid, "id", out var idUid))
|
||||||
|
{
|
||||||
|
var id = GetId(idUid);
|
||||||
|
if (id is not null)
|
||||||
|
{
|
||||||
|
var info = GetNameAndJob(id);
|
||||||
|
|
||||||
|
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<DepartmentPrototype>().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))
|
||||||
|
{
|
||||||
|
flavorText = Loc.GetString("character-information-ui-flavor-text-disabled");
|
||||||
|
}
|
||||||
|
else if (_entity.TryGetComponent<DetailExaminableComponent>(uid, out var detail))
|
||||||
|
{
|
||||||
|
flavorText = detail.Content;
|
||||||
|
}
|
||||||
|
|
||||||
|
_window.OpenCentered();
|
||||||
|
_window.UpdateUi(uid, name, job, flavorText);
|
||||||
|
_examine.CloseTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ID card component from either a PDA or an ID card if the entity has one
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idUid">Entity to check</param>
|
||||||
|
/// <returns>ID card component if they have one on the entity</returns>
|
||||||
|
private IdCardComponent? GetId(EntityUid? idUid)
|
||||||
|
{
|
||||||
|
// PDA
|
||||||
|
if (_entity.TryGetComponent(idUid, out PdaComponent? pda) &&
|
||||||
|
TryComp(pda.ContainedId, out IdCardComponent? idCard))
|
||||||
|
return idCard;
|
||||||
|
// ID Card
|
||||||
|
if (_entity.TryGetComponent(idUid, out IdCardComponent? id))
|
||||||
|
return id;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name and job title from an ID card component
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID card to retrieve the information from</param>
|
||||||
|
/// <returns>Name, Job Title</returns>
|
||||||
|
private static (string, string) GetNameAndJob(IdCardComponent id)
|
||||||
|
{
|
||||||
|
var 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||||
|
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||||
|
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:style="clr-namespace:Content.Client.Stylesheets"
|
||||||
|
Title="{Loc 'character-information-ui-title'}" MinSize="675 384" Resizable="True">
|
||||||
|
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="True" Margin="8">
|
||||||
|
<BoxContainer Orientation="Vertical">
|
||||||
|
<GridContainer Name="SpriteContainer" Columns="2">
|
||||||
|
</GridContainer>
|
||||||
|
<!-- Character name, job title and icon, etc goes here -->
|
||||||
|
<RichTextLabel Name="Name" HorizontalAlignment="Center" />
|
||||||
|
<RichTextLabel Name="Job" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</BoxContainer>
|
||||||
|
|
||||||
|
<PanelContainer MinSize="2 5" MaxWidth="2" Margin="8 0 8 0">
|
||||||
|
<PanelContainer.PanelOverride>
|
||||||
|
<graphics:StyleBoxFlat BackgroundColor="{x:Static style:StyleNano.NanoGold}" ContentMarginTopOverride="2" />
|
||||||
|
</PanelContainer.PanelOverride>
|
||||||
|
</PanelContainer>
|
||||||
|
|
||||||
|
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True">
|
||||||
|
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
|
||||||
|
<!-- Character description goes here -->
|
||||||
|
<RichTextLabel Name="FlavorText" HorizontalExpand="True" />
|
||||||
|
</BoxContainer>
|
||||||
|
</ScrollContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
</controls:FancyWindow>
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
using Content.Client.Message;
|
||||||
|
using Content.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
|
||||||
|
namespace Content.Client.White.CharacterExamine;
|
||||||
|
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public sealed partial class CharacterInformationWindow : FancyWindow
|
||||||
|
{
|
||||||
|
private readonly IEntityManager _entity;
|
||||||
|
|
||||||
|
// 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 RichTextLabel _flavor => FlavorText;
|
||||||
|
|
||||||
|
public CharacterInformationWindow()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
|
_entity = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
ResetUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Placeholder entries
|
||||||
|
/// </summary>
|
||||||
|
public void ResetUi()
|
||||||
|
{
|
||||||
|
_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(Loc.GetString("character-information-ui-flavor-text-placeholder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the UI to show all relevant information about the entity
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examined">The entity to become informed about</param>
|
||||||
|
/// <param name="name">The name of the examined entity, taken from their ID</param>
|
||||||
|
/// <param name="job">The job of the examined entity, taken from their ID</param>
|
||||||
|
/// <param name="flavorText">The flavor text of the examined entity</param>
|
||||||
|
public void UpdateUi(EntityUid examined, string? name = null, string? job = null, string? flavorText = null)
|
||||||
|
{
|
||||||
|
ResetUi();
|
||||||
|
|
||||||
|
// Fill in the omnidirectional sprite views
|
||||||
|
FillSprites(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fills the sprite views with the sprite from the sprite component
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Stupid, redefines the sprite view 4 times, can't find another way to do this
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="sprite">Sprite component to use</param>
|
||||||
|
private void FillSprites(EntityUid uid)
|
||||||
|
{
|
||||||
|
_sprites.AddChild(new SpriteView(uid, _entity)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(4, 4),
|
||||||
|
OverrideDirection = Direction.South,
|
||||||
|
Margin = new Thickness(0, 0, 8, 8),
|
||||||
|
});
|
||||||
|
|
||||||
|
_sprites.AddChild(new SpriteView(uid, _entity)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(4, 4),
|
||||||
|
OverrideDirection = Direction.North,
|
||||||
|
Margin = new Thickness(8, 0, 0, 8),
|
||||||
|
});
|
||||||
|
|
||||||
|
_sprites.AddChild(new SpriteView(uid, _entity)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(4, 4),
|
||||||
|
OverrideDirection = Direction.West,
|
||||||
|
Margin = new Thickness(0, 8, 8, 0),
|
||||||
|
});
|
||||||
|
|
||||||
|
_sprites.AddChild(new SpriteView(uid, _entity)
|
||||||
|
{
|
||||||
|
Scale = new Vector2(4, 4),
|
||||||
|
OverrideDirection = Direction.East,
|
||||||
|
Margin = new Thickness(8, 8, 0, 0),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ public sealed class IdExaminableSystem : EntitySystem
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<IdExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
//SubscribeLocalEvent<IdExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Content.Server.DetailExaminable
|
/*namespace Content.Server.DetailExaminable
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class DetailExaminableComponent : Component
|
public sealed partial class DetailExaminableComponent : Component
|
||||||
@@ -7,3 +7,4 @@
|
|||||||
public string Content = "";
|
public string Content = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Examine;
|
/*using Content.Shared.Examine;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.White.CharacterExamine;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.DetailExaminable
|
namespace Content.Server.DetailExaminable
|
||||||
@@ -42,3 +43,4 @@ namespace Content.Server.DetailExaminable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Server.Access.Systems;
|
using Content.Server.Access.Systems;
|
||||||
using Content.Server.DetailExaminable;
|
|
||||||
using Content.Server.Humanoid;
|
using Content.Server.Humanoid;
|
||||||
using Content.Server.IdentityManagement;
|
using Content.Server.IdentityManagement;
|
||||||
using Content.Server.Mind.Commands;
|
using Content.Server.Mind.Commands;
|
||||||
@@ -18,6 +17,7 @@ using Content.Shared.Roles;
|
|||||||
using Content.Shared.Roles.Jobs;
|
using Content.Shared.Roles.Jobs;
|
||||||
using Content.Shared.Station;
|
using Content.Shared.Station;
|
||||||
using Content.Shared.StatusIcon;
|
using Content.Shared.StatusIcon;
|
||||||
|
using Content.Shared.White.CharacterExamine;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -157,7 +157,9 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
|
|||||||
_metaSystem.SetEntityName(entity.Value, profile.Name);
|
_metaSystem.SetEntityName(entity.Value, profile.Name);
|
||||||
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
|
if (profile.FlavorText != "" && _configurationManager.GetCVar(CCVars.FlavorText))
|
||||||
{
|
{
|
||||||
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
|
var detail = AddComp<DetailExaminableComponent>(entity.Value);
|
||||||
|
detail.Content = profile.FlavorText;
|
||||||
|
Dirty(detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Content.Server.White.Other.DeathGasps;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class DeathGaspsComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ using Robust.Shared.Audio.Systems;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.White.Other;
|
namespace Content.Server.White.Other.DeathGasps;
|
||||||
|
|
||||||
public sealed class OnDeath : EntitySystem
|
public sealed class OnDeath : EntitySystem
|
||||||
{
|
{
|
||||||
@@ -16,8 +16,8 @@ public sealed class OnDeath : EntitySystem
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<HumanoidAppearanceComponent, MobStateChangedEvent>(HandleDeathEvent);
|
SubscribeLocalEvent<DeathGaspsComponent, MobStateChangedEvent>(HandleDeathEvent);
|
||||||
SubscribeLocalEvent<HumanoidAppearanceComponent, PlayerDetachedEvent>(OnDetach);
|
SubscribeLocalEvent<DeathGaspsComponent, PlayerDetachedEvent>(OnDetach);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Dictionary<EntityUid, EntityUid> _playingStreams = new();
|
private readonly Dictionary<EntityUid, EntityUid> _playingStreams = new();
|
||||||
@@ -30,7 +30,7 @@ public sealed class OnDeath : EntitySystem
|
|||||||
"death-gasp-normal"
|
"death-gasp-normal"
|
||||||
};
|
};
|
||||||
|
|
||||||
private void HandleDeathEvent(EntityUid uid, HumanoidAppearanceComponent component, MobStateChangedEvent args)
|
private void HandleDeathEvent(EntityUid uid, DeathGaspsComponent component, MobStateChangedEvent args)
|
||||||
{
|
{
|
||||||
//^.^
|
//^.^
|
||||||
switch (args.NewMobState)
|
switch (args.NewMobState)
|
||||||
@@ -96,7 +96,7 @@ public sealed class OnDeath : EntitySystem
|
|||||||
_audio.PlayEntity(DeathSounds, uid, uid, AudioParams.Default);
|
_audio.PlayEntity(DeathSounds, uid, uid, AudioParams.Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDetach(EntityUid uid, HumanoidAppearanceComponent component, PlayerDetachedEvent args)
|
private void OnDetach(EntityUid uid, DeathGaspsComponent component, PlayerDetachedEvent args)
|
||||||
{
|
{
|
||||||
StopPlayingStream(args.Entity);
|
StopPlayingStream(args.Entity);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Content.Server.White.Other.ExamineSystem;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class ExaminableClothesComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
106
Content.Server/White/Other/ExamineSystem/ExamineSystem.cs
Normal file
106
Content.Server/White/Other/ExamineSystem/ExamineSystem.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using Content.Shared.Access.Components;
|
||||||
|
using Content.Shared.Examine;
|
||||||
|
using Robust.Shared.Enums;
|
||||||
|
using Content.Shared.Humanoid;
|
||||||
|
using Content.Shared.Inventory;
|
||||||
|
using Content.Shared.PDA;
|
||||||
|
|
||||||
|
namespace Content.Server.White.Other.ExamineSystem
|
||||||
|
{
|
||||||
|
public sealed class ExamineSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||||
|
[Dependency] private readonly EntityManager _entityManager = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
SubscribeLocalEvent<ExaminableClothesComponent, ExaminedEvent>(HandleExamine);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleExamine(EntityUid uid, ExaminableClothesComponent comp, ExaminedEvent args)
|
||||||
|
{
|
||||||
|
var slotLabels = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{ "head", "head-" },
|
||||||
|
{ "eyes", "eyes-" },
|
||||||
|
{ "mask", "mask-" },
|
||||||
|
{ "neck", "neck-" },
|
||||||
|
{ "ears", "ears-" },
|
||||||
|
{ "jumpsuit", "jumpsuit-" },
|
||||||
|
{ "outerClothing", "outer-" },
|
||||||
|
{ "back", "back-" },
|
||||||
|
{ "gloves", "gloves-" },
|
||||||
|
{ "belt", "belt-" },
|
||||||
|
{ "shoes", "shoes-" }
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var slotEntry in slotLabels)
|
||||||
|
{
|
||||||
|
var slotName = slotEntry.Key;
|
||||||
|
var slotLabel = slotEntry.Value;
|
||||||
|
|
||||||
|
if (_entityManager.TryGetComponent<HumanoidAppearanceComponent>(uid, out var appearanceComponent))
|
||||||
|
{
|
||||||
|
switch (appearanceComponent.Gender)
|
||||||
|
{
|
||||||
|
case Gender.Male:
|
||||||
|
slotLabel += "he";
|
||||||
|
break;
|
||||||
|
case Gender.Neuter:
|
||||||
|
slotLabel += "it";
|
||||||
|
break;
|
||||||
|
case Gender.Epicene:
|
||||||
|
slotLabel += "they";
|
||||||
|
break;
|
||||||
|
case Gender.Female:
|
||||||
|
slotLabel += "she";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_inventorySystem.TryGetSlotEntity(uid, slotName, out var slotEntity))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (_entityManager.TryGetComponent<MetaDataComponent>(slotEntity, out var metaData))
|
||||||
|
args.PushMarkup($"[color=silver]{Loc.GetString(slotLabel)} [/color][font size=11][bold][color=lightgray]{metaData.EntityName}[/color][/bold][/font].");
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = GetInfo(uid);
|
||||||
|
if (id != null)
|
||||||
|
args.PushMarkup(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? GetInfo(EntityUid uid)
|
||||||
|
{
|
||||||
|
if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
|
||||||
|
{
|
||||||
|
// PDA
|
||||||
|
if (EntityManager.TryGetComponent(idUid, out PdaComponent? pda) &&
|
||||||
|
TryComp(pda.ContainedId, out IdCardComponent? idCard))
|
||||||
|
{
|
||||||
|
return GetNameAndJob(idCard);
|
||||||
|
}
|
||||||
|
// ID Card
|
||||||
|
if (EntityManager.TryGetComponent(idUid, out IdCardComponent? id))
|
||||||
|
{
|
||||||
|
return GetNameAndJob(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetNameAndJob(IdCardComponent id)
|
||||||
|
{
|
||||||
|
var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
|
||||||
|
|
||||||
|
var val = string.IsNullOrWhiteSpace(id.FullName)
|
||||||
|
? Loc.GetString("access-id-card-component-owner-name-job-title-text",
|
||||||
|
("jobSuffix", jobSuffix))
|
||||||
|
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
|
||||||
|
("fullName", id.FullName),
|
||||||
|
("jobSuffix", jobSuffix));
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.White.CharacterExamine;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
public sealed partial class CharacterInformationComponent : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.White.CharacterExamine;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
|
public sealed partial class DetailExaminableComponent : Component
|
||||||
|
{
|
||||||
|
[DataField("content", required: true)]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[AutoNetworkedField]
|
||||||
|
public string Content = "";
|
||||||
|
}
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
|
# Reflect
|
||||||
|
|
||||||
reflect-shot = Отразил!
|
reflect-shot = Отразил!
|
||||||
|
|
||||||
|
# Carry
|
||||||
|
|
||||||
carry-verb = Тащить на руках
|
carry-verb = Тащить на руках
|
||||||
|
|
||||||
chat-manager-entity-say-god-wrap-message = [BubbleHeader][bold]{$entityName}[/bold][/BubbleHeader] командует, "[BubbleContent][color={ $color }][bold]{$message}[/bold][/color][/BubbleContent]"
|
chat-manager-entity-say-god-wrap-message = [BubbleHeader][bold]{$entityName}[/bold][/BubbleHeader] командует, "[BubbleContent][color={ $color }][bold]{$message}[/bold][/color][/BubbleContent]"
|
||||||
|
|
||||||
|
# Stats
|
||||||
eorstats-bloodlost-total = { $bloodLost } единиц крови было потеряно в этом раунде!
|
eorstats-bloodlost-total = { $bloodLost } единиц крови было потеряно в этом раунде!
|
||||||
eorstats-cuffedtime-hasusername = { $username } под именем { $name } провел(а) { $timeCuffedMinutes } минут в наручниках в этом раунде! Что он натворил?
|
eorstats-cuffedtime-hasusername = { $username } под именем { $name } провел(а) { $timeCuffedMinutes } минут в наручниках в этом раунде! Что он натворил?
|
||||||
eorstats-cuffedtime-hasnousername = { $name } провел(а) { $timeCuffedMinutes } минут в наручниках в этом раунде! Что он натворил?
|
eorstats-cuffedtime-hasnousername = { $name } провел(а) { $timeCuffedMinutes } минут в наручниках в этом раунде! Что он натворил?
|
||||||
@@ -14,3 +22,71 @@ eorstats-slippedcount-totalslips = Экипаж поскользнулся { $ti
|
|||||||
eorstats-slippedcount-none = Экипаж не поскользнулся ни разу за эту смену!
|
eorstats-slippedcount-none = Экипаж не поскользнулся ни разу за эту смену!
|
||||||
eorstats-slippedcount-topslipper-hasusername = { $username } под именем { $name } был неуклюжим в эту смену и поскользнулся { $slipcount } раз!
|
eorstats-slippedcount-topslipper-hasusername = { $username } под именем { $name } был неуклюжим в эту смену и поскользнулся { $slipcount } раз!
|
||||||
eorstats-slippedcount-topslipper-hasnousername = { $name } был неуклюжим в эту смену и поскользнулся { $slipcount } раз!
|
eorstats-slippedcount-topslipper-hasnousername = { $name } был неуклюжим в эту смену и поскользнулся { $slipcount } раз!
|
||||||
|
|
||||||
|
|
||||||
|
# Cringers examine system
|
||||||
|
|
||||||
|
# Он
|
||||||
|
|
||||||
|
head-he = На его голове
|
||||||
|
eyes-he = На его глазах надеты
|
||||||
|
mask-he = На его лице
|
||||||
|
neck-he = Вокруг его шеи
|
||||||
|
ears-he = На его ушах
|
||||||
|
jumpsuit-he = На нем
|
||||||
|
outer-he = А так же
|
||||||
|
back-he = На его спине
|
||||||
|
gloves-he = На его руках
|
||||||
|
belt-he = На нем весит
|
||||||
|
shoes-he = На ногах у него
|
||||||
|
|
||||||
|
# Она
|
||||||
|
|
||||||
|
head-she = На ее голове
|
||||||
|
eyes-she = На ее глазах надеты
|
||||||
|
mask-she = На ее лице
|
||||||
|
neck-she = Вокруг ее шеи
|
||||||
|
ears-she = На ее ушах
|
||||||
|
jumpsuit-she = На ней
|
||||||
|
outer-she = А так же
|
||||||
|
back-she = На ее спине
|
||||||
|
gloves-she = На ее руках
|
||||||
|
belt-she = На ней весит
|
||||||
|
shoes-she = На ногах у нее
|
||||||
|
|
||||||
|
# Оно
|
||||||
|
|
||||||
|
head-it = On its head, it wears
|
||||||
|
eyes-it = In its eyes, it has
|
||||||
|
mask-it = It is wearing a mask on its face
|
||||||
|
neck-it = Around its neck, it has
|
||||||
|
ears-it = It has something on its ears
|
||||||
|
jumpsuit-it = It is wearing
|
||||||
|
outer-it = Also
|
||||||
|
back-it = On its back, it carries
|
||||||
|
gloves-it = On its hands
|
||||||
|
belt-it = It is wearing
|
||||||
|
shoes-it = It is wearing
|
||||||
|
|
||||||
|
# Они
|
||||||
|
|
||||||
|
head-they = На их головах
|
||||||
|
eyes-they = На их глазах
|
||||||
|
mask-they = На их лицах
|
||||||
|
neck-they = Вокруг их шеи
|
||||||
|
ears-they = На их ушах
|
||||||
|
jumpsuit-they = Они носят
|
||||||
|
outer-they = А так же
|
||||||
|
back-they = На их спинах
|
||||||
|
gloves-they = На их руках
|
||||||
|
belt-they = На них весит
|
||||||
|
shoes-they = На ногах у них
|
||||||
|
|
||||||
|
# Character information
|
||||||
|
|
||||||
|
character-information-verb-message = Информация о персонаже
|
||||||
|
character-information-ui-title = Информация о персонаже
|
||||||
|
character-information-ui-flavor-text-placeholder =
|
||||||
|
Нет заданного флавора.
|
||||||
|
character-information-ui-flavor-text-disabled =
|
||||||
|
На этом сервере отключен флавор.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -205,7 +205,6 @@
|
|||||||
spawned:
|
spawned:
|
||||||
- id: FoodMeat
|
- id: FoodMeat
|
||||||
amount: 5
|
amount: 5
|
||||||
- type: TTS
|
|
||||||
- type: Speech
|
- type: Speech
|
||||||
speechSounds: Alto
|
speechSounds: Alto
|
||||||
- type: DamageForceSay
|
- type: DamageForceSay
|
||||||
@@ -230,6 +229,10 @@
|
|||||||
- FootstepSound
|
- FootstepSound
|
||||||
- DoorBumpOpener
|
- DoorBumpOpener
|
||||||
- type: Carriable
|
- type: Carriable
|
||||||
|
- type: TTS
|
||||||
|
- type: DeathGasps
|
||||||
|
- type: ExaminableClothes
|
||||||
|
- type: CharacterInformation
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
save: false
|
save: false
|
||||||
|
|||||||
@@ -26,12 +26,6 @@
|
|||||||
collection: Snores
|
collection: Snores
|
||||||
Honk:
|
Honk:
|
||||||
collection: BikeHorn
|
collection: BikeHorn
|
||||||
Sigh:
|
|
||||||
collection: MaleSigh
|
|
||||||
Crying:
|
|
||||||
collection: MaleCry
|
|
||||||
Whistle:
|
|
||||||
collection: Whistles
|
|
||||||
|
|
||||||
- type: emoteSounds
|
- type: emoteSounds
|
||||||
id: FemaleHuman
|
id: FemaleHuman
|
||||||
@@ -60,12 +54,6 @@
|
|||||||
collection: Snores
|
collection: Snores
|
||||||
Honk:
|
Honk:
|
||||||
collection: CluwneHorn
|
collection: CluwneHorn
|
||||||
Sigh:
|
|
||||||
collection: FemaleSigh
|
|
||||||
Crying:
|
|
||||||
collection: FemaleCry
|
|
||||||
Whistle:
|
|
||||||
collection: Whistles
|
|
||||||
|
|
||||||
- type: emoteSounds
|
- type: emoteSounds
|
||||||
id: MaleFelinid
|
id: MaleFelinid
|
||||||
@@ -148,10 +136,6 @@
|
|||||||
path: /Audio/Animals/lizard_happy.ogg
|
path: /Audio/Animals/lizard_happy.ogg
|
||||||
Honk:
|
Honk:
|
||||||
collection: BikeHorn
|
collection: BikeHorn
|
||||||
Whistle:
|
|
||||||
collection: Whistles
|
|
||||||
Crying:
|
|
||||||
collection: MaleCry
|
|
||||||
|
|
||||||
- type: emoteSounds
|
- type: emoteSounds
|
||||||
id: MaleSlime
|
id: MaleSlime
|
||||||
@@ -286,10 +270,6 @@
|
|||||||
collection: MaleSigh
|
collection: MaleSigh
|
||||||
Honk:
|
Honk:
|
||||||
collection: BikeHorn
|
collection: BikeHorn
|
||||||
Crying:
|
|
||||||
collection: MaleCry
|
|
||||||
Whistle:
|
|
||||||
collection: Whistles
|
|
||||||
params:
|
params:
|
||||||
variation: 0.125
|
variation: 0.125
|
||||||
pitch: 0.75
|
pitch: 0.75
|
||||||
@@ -353,8 +333,6 @@
|
|||||||
collection: Snaps
|
collection: Snaps
|
||||||
params:
|
params:
|
||||||
volume: -6
|
volume: -6
|
||||||
Salute:
|
|
||||||
collection: Salutes
|
|
||||||
|
|
||||||
- type: emoteSounds
|
- type: emoteSounds
|
||||||
id: DionaBodyEmotes
|
id: DionaBodyEmotes
|
||||||
|
|||||||
Reference in New Issue
Block a user