* Transfer most Instrument UI logic to a new component, ActivatableUIComponent * Move more ActivatableUIComponent stuff to ECS * ActivatableUI component ignore on client * ActivatableUI: Get rid of component interfaces where possible * Add in adminOnly attribute for activatable UIs This is so that porting #4926 to this will be easier * Transition Solar Control Computer to ActivatableUI * Move communications console to ActivatableUI * Move cargo console to ActivatableUI * Move ID card console to ActivatableUI * ActivatableUI: Make things more amiable to entity tests adding components weirdly * ActivatableUI: Use handling or lack thereof of events properly * ActivatableUI: component dependency issue resolution stuffs * ActivatableUISystem: Fix #5258 * More fixes because master did stuffo * Check for HandDeselectedEvent again because otherwise active-hand check doesn't work * Move just a bit more code into the system, introduce a workaround for #5258 * Purge the player status detection stuff * Oh and some obsolete stuff too
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Content.Server.WireHacking;
|
|
using Content.Shared.Construction;
|
|
using Content.Shared.Examine;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Construction.Conditions
|
|
{
|
|
[UsedImplicitly]
|
|
[DataDefinition]
|
|
public class WirePanel : IGraphCondition
|
|
{
|
|
[DataField("open")] public bool Open { get; private set; } = true;
|
|
|
|
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
|
{
|
|
if (!entityManager.TryGetComponent(uid, out WiresComponent? wires))
|
|
return false;
|
|
|
|
return wires.IsPanelOpen == Open;
|
|
}
|
|
|
|
public bool DoExamine(ExaminedEvent args)
|
|
{
|
|
var entity = args.Examined;
|
|
|
|
if (!entity.TryGetComponent(out WiresComponent? wires)) return false;
|
|
|
|
switch (Open)
|
|
{
|
|
case true when !wires.IsPanelOpen:
|
|
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-open"));
|
|
return true;
|
|
case false when wires.IsPanelOpen:
|
|
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-close"));
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
|
{
|
|
yield return new ConstructionGuideEntry()
|
|
{
|
|
Localization = Open
|
|
? "construction-step-condition-wire-panel-open"
|
|
: "construction-step-condition-wire-panel-close"
|
|
};
|
|
}
|
|
}
|
|
}
|