Telecom server panel check (#14523)

This commit is contained in:
Slava0135
2023-03-24 03:09:45 +03:00
committed by GitHub
parent 8c7e917038
commit d03ca61da1
17 changed files with 226 additions and 138 deletions

View File

@@ -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;
}