Port all construction conditions to the new examine.

This commit is contained in:
Vera Aguilera Puerto
2021-10-01 15:27:42 +02:00
parent f21c921c56
commit 3b14c21396
15 changed files with 85 additions and 40 deletions

View File

@@ -2,6 +2,7 @@ using System.Threading.Tasks;
using Content.Server.GameObjects.Components;
using Content.Server.WireHacking;
using Content.Shared.Construction;
using Content.Shared.Examine;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
@@ -23,17 +24,19 @@ namespace Content.Server.Construction.Conditions
return wires.IsPanelOpen == Open;
}
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
public bool DoExamine(ExaminedEvent args)
{
var entity = args.Examined;
if (!entity.TryGetComponent(out WiresComponent? wires)) return false;
switch (Open)
{
case true when !wires.IsPanelOpen:
message.AddMarkup(Loc.GetString("construction-condition-wire-panel-open") + "\n");
args.PushMarkup(Loc.GetString("construction-condition-wire-panel-open"));
return true;
case false when wires.IsPanelOpen:
message.AddMarkup(Loc.GetString("construction-condition-wire-panel-close") + "\n");
args.PushMarkup(Loc.GetString("construction-condition-wire-panel-close"));
return true;
}