Telecom server panel check (#14523)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Wires;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
@@ -14,24 +14,23 @@ namespace Content.Server.Construction.Conditions
|
||||
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
||||
{
|
||||
//if it doesn't have a wire panel, then just let it work.
|
||||
if (!entityManager.TryGetComponent(uid, out WiresComponent? wires))
|
||||
if (!entityManager.TryGetComponent<WiresPanelComponent>(uid, out var wires))
|
||||
return true;
|
||||
|
||||
return wires.IsPanelOpen == Open;
|
||||
return wires.Open == Open;
|
||||
}
|
||||
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
var entity = args.Examined;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out WiresComponent? wires)) return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<WiresPanelComponent>(entity, out var panel)) return false;
|
||||
|
||||
switch (Open)
|
||||
{
|
||||
case true when !wires.IsPanelOpen:
|
||||
case true when !panel.Open:
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-open"));
|
||||
return true;
|
||||
case false when wires.IsPanelOpen:
|
||||
case false when panel.Open:
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-close"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user