* Removed EntityManager member variable from Components and EntitySystems * Removed EntityManager with minor corecctions * Update PathfindingSystem.cs * Update InteractionSystem.cs * Update Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> * Update Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/PDA/PDAComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs Co-authored-by: Clyybber <darkmine956@gmail.com> * Update Content.Server/GameObjects/Components/Stack/StackComponent.cs Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using Content.Shared.GameObjects.EntitySystemMessages;
|
|
using Content.Shared.GameObjects.EntitySystems;
|
|
using Robust.Server.Interfaces.Player;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems.Click
|
|
{
|
|
public class ExamineSystem : ExamineSystemShared
|
|
{
|
|
private static readonly FormattedMessage _entityNotFoundMessage;
|
|
|
|
static ExamineSystem()
|
|
{
|
|
_entityNotFoundMessage = new FormattedMessage();
|
|
_entityNotFoundMessage.AddText(Loc.GetString("That entity doesn't exist"));
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeNetworkEvent<ExamineSystemMessages.RequestExamineInfoMessage>(ExamineInfoRequest);
|
|
|
|
IoCManager.InjectDependencies(this);
|
|
}
|
|
|
|
private void ExamineInfoRequest(ExamineSystemMessages.RequestExamineInfoMessage request, EntitySessionEventArgs eventArgs)
|
|
{
|
|
var player = (IPlayerSession) eventArgs.SenderSession;
|
|
var session = eventArgs.SenderSession;
|
|
var playerEnt = session.AttachedEntity;
|
|
var channel = player.ConnectedClient;
|
|
|
|
if (playerEnt == null
|
|
|| !EntityManager.TryGetEntity(request.EntityUid, out var entity)
|
|
|| !CanExamine(playerEnt, entity))
|
|
{
|
|
RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
|
|
request.EntityUid, _entityNotFoundMessage), channel);
|
|
return;
|
|
}
|
|
|
|
var text = GetExamineText(entity, player.AttachedEntity);
|
|
RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(request.EntityUid, text), channel);
|
|
}
|
|
}
|
|
}
|