Moves ExamineSystem to Shared & adds next step info to construction examine (#1567)
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
using Content.Shared.Construction;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Construction
|
||||
@@ -9,8 +15,11 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
/// Holds data about an entity that is in the process of being constructed or destructed.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class ConstructionComponent : Component
|
||||
public class ConstructionComponent : Component, IExamine
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ILocalizationManager _loc;
|
||||
#pragma warning restore 649
|
||||
/// <inheritdoc />
|
||||
public override string Name => "Construction";
|
||||
|
||||
@@ -37,5 +46,10 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
serializer.DataReadWriteFunction("stage", 0,
|
||||
value => Stage = value, () => Stage);
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, Stage, inDetailsRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timers.Timer;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Serialization;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Interfaces.GameObjects.Components.Interaction;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -26,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IAfterInteract))]
|
||||
public class DrinkComponent : Component, IUse, IAfterInteract, ISolutionChange,IExamine, ILand
|
||||
public class DrinkComponent : Component, IUse, IAfterInteract, ISolutionChange, IExamine, ILand
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Interaction;
|
||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -28,6 +28,7 @@ using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
{
|
||||
|
||||
@@ -9,16 +9,6 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
{
|
||||
public interface IExamine
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a status examine value for components appended to the end of the description of the entity
|
||||
/// </summary>
|
||||
/// <param name="message">The message to append to which will be displayed.</param>
|
||||
/// <param name="inDetailsRange">Whether the examiner is within the 'Details' range, allowing you to show information logically only availabe when close to the examined entity.</param>
|
||||
void Examine(FormattedMessage message, bool inDetailsRange);
|
||||
}
|
||||
|
||||
public class ExamineSystem : ExamineSystemShared
|
||||
{
|
||||
#pragma warning disable 649
|
||||
@@ -27,8 +17,6 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
|
||||
private static readonly FormattedMessage _entityNotFoundMessage;
|
||||
|
||||
private const float ExamineDetailsRange = 3f;
|
||||
|
||||
static ExamineSystem()
|
||||
{
|
||||
_entityNotFoundMessage = new FormattedMessage();
|
||||
@@ -44,45 +32,6 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
private static FormattedMessage GetExamineText(IEntity entity, IEntity examiner)
|
||||
{
|
||||
var message = new FormattedMessage();
|
||||
|
||||
var doNewline = false;
|
||||
|
||||
//Add an entity description if one is declared
|
||||
if (!string.IsNullOrEmpty(entity.Description))
|
||||
{
|
||||
message.AddText(entity.Description);
|
||||
doNewline = true;
|
||||
}
|
||||
|
||||
message.PushColor(Color.DarkGray);
|
||||
|
||||
var inDetailsRange = Get<SharedInteractionSystem>()
|
||||
.InRangeUnobstructed(examiner.Transform.MapPosition, entity.Transform.MapPosition,
|
||||
ExamineDetailsRange, predicate: entity0 => entity0 == examiner || entity0 == entity, ignoreInsideBlocker: true);
|
||||
|
||||
//Add component statuses from components that report one
|
||||
foreach (var examineComponent in entity.GetAllComponents<IExamine>())
|
||||
{
|
||||
var subMessage = new FormattedMessage();
|
||||
examineComponent.Examine(subMessage, inDetailsRange);
|
||||
if (subMessage.Tags.Count == 0)
|
||||
continue;
|
||||
|
||||
if (doNewline)
|
||||
message.AddText("\n");
|
||||
|
||||
message.AddMessage(subMessage);
|
||||
doNewline = true;
|
||||
}
|
||||
|
||||
message.Pop();
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
private void ExamineInfoRequest(ExamineSystemMessages.RequestExamineInfoMessage request, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var player = (IPlayerSession) eventArgs.SenderSession;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// The server-side implementation of the construction system, which is used for constructing entities in game.
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
internal class ConstructionSystem : Shared.GameObjects.EntitySystems.ConstructionSystem
|
||||
internal class ConstructionSystem : Shared.GameObjects.EntitySystems.SharedConstructionSystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
|
||||
Reference in New Issue
Block a user