Files
OldThink/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs

54 lines
1.9 KiB
C#
Raw Normal View History

using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Server.Interfaces.Player;
2020-03-25 11:16:57 +01:00
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
{
[UsedImplicitly]
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);
}
2020-03-25 11:16:57 +01:00
private void ExamineInfoRequest(ExamineSystemMessages.RequestExamineInfoMessage request, EntitySessionEventArgs eventArgs)
{
2020-03-25 11:16:57 +01:00
var player = (IPlayerSession) eventArgs.SenderSession;
var session = eventArgs.SenderSession;
var playerEnt = session.AttachedEntity;
2020-03-25 11:16:57 +01:00
var channel = player.ConnectedClient;
if (playerEnt == null
Removed EntityManager member variable from Components and EntitySystems (#2502) * 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>
2020-11-18 15:45:53 +01:00
|| !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);
}
}
}