diff --git a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs index 3994592b11..3dc50085b7 100644 --- a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs @@ -266,7 +266,7 @@ namespace Content.Server.GameObjects.Components.Chemistry } } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { if (NoExamine) { @@ -282,7 +282,26 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) { - message.AddText($"{proto.Name}: {reagent.Quantity}u\n"); + if (inDetailsRange) + { + message.AddText($"{proto.Name}: {reagent.Quantity}u\n"); + } + else + { + //This is trash but it shows the general idea + var color = proto.SubstanceColor; + var colorIsh = "Red"; + if (color.G > color.R) + { + colorIsh = "Green"; + } + if (color.B > color.G && color.B > color.R) + { + colorIsh = "Blue"; + } + + message.AddText(_loc.GetString("A {0} liquid\n", colorIsh)); + } } else { diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index 1af9f3cdea..8fb40fabe1 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -76,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Interactable return true; } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { var loc = IoCManager.Resolve(); diff --git a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs index c58c2bc7f9..4b3b049b4f 100644 --- a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs @@ -163,7 +163,7 @@ namespace Content.Server.GameObjects.Components.Interactable return ToggleWelderStatus(eventArgs.User); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { if (WelderLit) { @@ -174,8 +174,11 @@ namespace Content.Server.GameObjects.Components.Interactable message.AddText(Loc.GetString("Not lit\n")); } - message.AddMarkup(Loc.GetString("Fuel: [color={0}]{1}/{2}[/color].", - Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity)); + if (inDetailsRange) + { + message.AddMarkup(Loc.GetString("Fuel: [color={0}]{1}/{2}[/color].", + Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity)); + } } public void OnUpdate(float frameTime) diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index 6fc0407b37..f1da53d8f9 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.Components.Sound; +using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; using Content.Server.Utility; using Content.Shared.Audio; @@ -84,8 +84,9 @@ namespace Content.Server.GameObjects.Components.Items Roll(); } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { + //No details check, since the sprite updates to show the side. var loc = IoCManager.Resolve(); message.AddMarkup(loc.GetString("A dice with [color=lightgray]{0}[/color] sides.\n" + "It has landed on a [color=white]{1}[/color].", _sides, _currentSide)); diff --git a/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs b/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs index 62cafa7799..05ed281f67 100644 --- a/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/WarpPointComponent.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Serialization; @@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Markers serializer.DataField(this, x => x.Location, "location", null); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { var loc = Location == null ? "" : $"'{Location}'"; message.AddText(Loc.GetString("This one's location ID is {0}", loc)); diff --git a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs index f47e01541d..6272bc8464 100644 --- a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs @@ -114,9 +114,9 @@ namespace Content.Server.GameObjects.Components.Mobs serializer.DataField(ref _showExamineInfo, "show_examine_info", false); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { - if (!ShowExamineInfo) + if (!ShowExamineInfo || !inDetailsRange) return; var dead = false; diff --git a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs index 3c7f5e8c39..96cc82c607 100644 --- a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; @@ -106,9 +106,9 @@ namespace Content.Server.GameObjects.Components.Nutrition TryUseDrink(eventArgs.Target); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { - if (!Opened) + if (!Opened || !inDetailsRange) { return; } diff --git a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs index 1c2fd6044e..1cb46cece3 100644 --- a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs +++ b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs @@ -32,8 +32,11 @@ namespace Content.Server.GameObjects.Components.Interactable _userInterface.SetState(new PaperBoundUserInterfaceState(_content, _mode)); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { + if (!inDetailsRange) + return; + message.AddMarkup(_content); } diff --git a/Content.Server/GameObjects/Components/Power/PowerDevice.cs b/Content.Server/GameObjects/Components/Power/PowerDevice.cs index 45c508f6d8..ba986fa324 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDevice.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDevice.cs @@ -221,11 +221,11 @@ namespace Content.Server.GameObjects.Components.Power } } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { var loc = IoCManager.Resolve(); - if (!Powered) + if (!Powered && inDetailsRange) { message.AddMarkup(loc.GetString("The device is [color=orange]not powered[/color].")); } diff --git a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs index ad07f6ebfc..d4810679f4 100644 --- a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs @@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Power } /// - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { var loc = IoCManager.Resolve(); diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index ff6cc6a3b5..3db7729d5c 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -110,12 +110,15 @@ namespace Content.Server.GameObjects.Components.Stack return false; } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { - var loc = IoCManager.Resolve(); - message.AddMarkup(loc.GetPluralString( - "There is [color=lightgray]1[/color] thing in the stack", - "There are [color=lightgray]{0}[/color] things in the stack.", Count, Count)); + if (inDetailsRange) + { + var loc = IoCManager.Resolve(); + message.AddMarkup(loc.GetPluralString( + "There is [color=lightgray]1[/color] thing in the stack", + "There are [color=lightgray]{0}[/color] things in the stack.", Count, Count)); + } } } } diff --git a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs index 352b3f9e65..baccbf957d 100644 --- a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs @@ -139,7 +139,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines } } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { if(_description == null) { return; } message.AddText(_description); diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs index 9b95978d11..642cf54a1f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs @@ -226,7 +226,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee EntitySystem.Get().Play("/Audio/items/weapons/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); } - public void Examine(FormattedMessage message) + public void Examine(FormattedMessage message, bool inDetailsRange) { var loc = IoCManager.Resolve(); diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 48892c7855..57b02423a4 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Interactable; @@ -479,7 +479,7 @@ namespace Content.Server.GameObjects.Components return true; } - void IExamine.Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { var loc = IoCManager.Resolve(); diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index b8f2d3cd76..fa7fdbaf4b 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -1,7 +1,9 @@ -using Content.Shared.GameObjects.EntitySystemMessages; +using Content.Server.Utility; +using Content.Shared.GameObjects.EntitySystemMessages; using Content.Shared.GameObjects.EntitySystems; using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; +using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; @@ -12,9 +14,10 @@ namespace Content.Server.GameObjects.EntitySystems public interface IExamine { /// - /// Returns an status examine value for components appended to the end of the description of the entity + /// Returns a status examine value for components appended to the end of the description of the entity /// - void Examine(FormattedMessage message); + /// Whether the examiner is within the 'Details' range, allowing you to show information logically only availabe when close to the examined entity. + void Examine(FormattedMessage message, bool inDetailsRange); } public class ExamineSystem : ExamineSystemShared @@ -25,6 +28,8 @@ namespace Content.Server.GameObjects.EntitySystems private static readonly FormattedMessage _entityNotFoundMessage; + private const float ExamineDetailsRange = 3f; + static ExamineSystem() { _entityNotFoundMessage = new FormattedMessage(); @@ -40,7 +45,7 @@ namespace Content.Server.GameObjects.EntitySystems IoCManager.InjectDependencies(this); } - private static FormattedMessage GetExamineText(IEntity entity) + private static FormattedMessage GetExamineText(IEntity entity, IEntity examiner) { var message = new FormattedMessage(); @@ -55,11 +60,15 @@ namespace Content.Server.GameObjects.EntitySystems message.PushColor(Color.DarkGray); + var inDetailsRange = Get() + .InRangeUnobstructed(examiner.Transform.MapPosition, entity.Transform.MapPosition, + ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, insideBlockerValid: true); + //Add component statuses from components that report one - foreach (var examineComponents in entity.GetAllComponents()) + foreach (var examineComponent in entity.GetAllComponents()) { var subMessage = new FormattedMessage(); - examineComponents.Examine(subMessage); + examineComponent.Examine(subMessage, inDetailsRange); if (subMessage.Tags.Count == 0) continue; @@ -91,7 +100,7 @@ namespace Content.Server.GameObjects.EntitySystems return; } - var text = GetExamineText(entity); + var text = GetExamineText(entity, player.AttachedEntity); RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(request.EntityUid, text), channel); } }