Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Content.Client.Access.UI
|
|||||||
{
|
{
|
||||||
private AgentIDCardWindow? _window;
|
private AgentIDCardWindow? _window;
|
||||||
|
|
||||||
public AgentIDCardBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public AgentIDCardBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,19 +10,21 @@ namespace Content.Client.Access.UI
|
|||||||
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
|
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
private readonly SharedIdCardConsoleSystem _idCardConsoleSystem = default!;
|
||||||
|
|
||||||
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
private IdCardConsoleWindow? _window;
|
private IdCardConsoleWindow? _window;
|
||||||
|
|
||||||
|
public IdCardConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
_idCardConsoleSystem = EntMan.System<SharedIdCardConsoleSystem>();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
List<string> accessLevels;
|
List<string> accessLevels;
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent<IdCardConsoleComponent>(Owner.Owner, out var idCard))
|
if (EntMan.TryGetComponent<IdCardConsoleComponent>(Owner, out var idCard))
|
||||||
{
|
{
|
||||||
accessLevels = idCard.AccessLevels;
|
accessLevels = idCard.AccessLevels;
|
||||||
accessLevels.Sort();
|
accessLevels.Sort();
|
||||||
@@ -30,10 +32,13 @@ namespace Content.Client.Access.UI
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
accessLevels = new List<string>();
|
accessLevels = new List<string>();
|
||||||
Logger.ErrorS(SharedIdCardConsoleSystem.Sawmill, $"No IdCardConsole component found for {_entityManager.ToPrettyString(Owner.Owner)}!");
|
_idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!");
|
||||||
}
|
}
|
||||||
|
|
||||||
_window = new IdCardConsoleWindow(this, _prototypeManager, accessLevels) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
_window = new IdCardConsoleWindow(this, _prototypeManager, accessLevels)
|
||||||
|
{
|
||||||
|
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName
|
||||||
|
};
|
||||||
|
|
||||||
_window.CrewManifestButton.OnPressed += _ => SendMessage(new CrewManifestOpenUiMessage());
|
_window.CrewManifestButton.OnPressed += _ => SendMessage(new CrewManifestOpenUiMessage());
|
||||||
_window.PrivilegedIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(PrivilegedIdCardSlotId));
|
_window.PrivilegedIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(PrivilegedIdCardSlotId));
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ namespace Content.Client.AirlockPainter.UI
|
|||||||
{
|
{
|
||||||
public sealed class AirlockPainterBoundUserInterface : BoundUserInterface
|
public sealed class AirlockPainterBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private AirlockPainterWindow? _window;
|
private AirlockPainterWindow? _window;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private AirlockPainterSystem? _painter;
|
private AirlockPainterSystem? _painter;
|
||||||
|
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystems = default!;
|
public AirlockPainterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
|
||||||
public AirlockPainterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ namespace Content.Client.AirlockPainter.UI
|
|||||||
|
|
||||||
_window = new AirlockPainterWindow();
|
_window = new AirlockPainterWindow();
|
||||||
|
|
||||||
_painter = _entitySystems.GetEntitySystem<AirlockPainterSystem>();
|
_painter = EntMan.System<AirlockPainterSystem>();
|
||||||
|
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Content.Client.Ame.UI
|
|||||||
{
|
{
|
||||||
private AmeWindow? _window;
|
private AmeWindow? _window;
|
||||||
|
|
||||||
public AmeControllerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public AmeControllerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public sealed class AnomalyGeneratorBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
private AnomalyGeneratorWindow? _window;
|
private AnomalyGeneratorWindow? _window;
|
||||||
|
|
||||||
public AnomalyGeneratorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base (owner, uiKey)
|
public AnomalyGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ public sealed class AnomalyGeneratorBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_window = new (Owner.Owner);
|
_window = new(Owner);
|
||||||
|
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public sealed class AnomalyScannerBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
private AnomalyScannerMenu? _menu;
|
private AnomalyScannerMenu? _menu;
|
||||||
|
|
||||||
public AnomalyScannerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public AnomalyScannerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public sealed class BlockGameBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
private BlockGameMenu? _menu;
|
private BlockGameMenu? _menu;
|
||||||
|
|
||||||
public BlockGameBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public BlockGameBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public sealed class SpaceVillainArcadeBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
//public SharedSpaceVillainArcadeComponent SpaceVillainArcade;
|
//public SharedSpaceVillainArcadeComponent SpaceVillainArcade;
|
||||||
|
|
||||||
public SpaceVillainArcadeBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public SpaceVillainArcadeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
SendAction(PlayerAction.RequestData);
|
SendAction(PlayerAction.RequestData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
private AirAlarmWindow? _window;
|
private AirAlarmWindow? _window;
|
||||||
|
|
||||||
public AirAlarmBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public AirAlarmBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ public sealed class AirAlarmBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_window = new AirAlarmWindow(Owner);
|
_window = new AirAlarmWindow(this);
|
||||||
|
|
||||||
if (State != null)
|
if (State != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed partial class AirAlarmWindow : FancyWindow
|
|||||||
|
|
||||||
private OptionButton _modes => CModeButton;
|
private OptionButton _modes => CModeButton;
|
||||||
|
|
||||||
public AirAlarmWindow(ClientUserInterfaceComponent component)
|
public AirAlarmWindow(BoundUserInterface owner)
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public sealed partial class AirAlarmWindow : FancyWindow
|
|||||||
ResyncAllRequested!.Invoke();
|
ResyncAllRequested!.Invoke();
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityView.Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner);
|
EntityView.SetEntity(owner.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateState(AirAlarmUIState state)
|
public void UpdateState(AirAlarmUIState state)
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ namespace Content.Client.Atmos.UI
|
|||||||
{
|
{
|
||||||
public sealed class GasAnalyzerBoundUserInterface : BoundUserInterface
|
public sealed class GasAnalyzerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
public GasAnalyzerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private GasAnalyzerWindow? _window;
|
||||||
|
|
||||||
|
public GasAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private GasAnalyzerWindow? _window;
|
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Atmos.UI
|
namespace Content.Client.Atmos.UI
|
||||||
{
|
{
|
||||||
@@ -11,10 +10,10 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasCanisterBoundUserInterface : BoundUserInterface
|
public sealed class GasCanisterBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GasCanisterWindow? _window;
|
private GasCanisterWindow? _window;
|
||||||
|
|
||||||
public GasCanisterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public GasCanisterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasFilterBoundUserInterface : BoundUserInterface
|
public sealed class GasFilterBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
|
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private GasFilterWindow? _window;
|
private GasFilterWindow? _window;
|
||||||
|
|
||||||
public GasFilterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public GasFilterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +26,7 @@ namespace Content.Client.Atmos.UI
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
var atmosSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
|
var atmosSystem = EntMan.System<AtmosphereSystem>();
|
||||||
|
|
||||||
_window = new GasFilterWindow(atmosSystem.Gases);
|
_window = new GasFilterWindow(atmosSystem.Gases);
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ namespace Content.Client.Atmos.UI
|
|||||||
_window.SetTransferRate(cast.TransferRate);
|
_window.SetTransferRate(cast.TransferRate);
|
||||||
if (cast.FilteredGas is not null)
|
if (cast.FilteredGas is not null)
|
||||||
{
|
{
|
||||||
var atmos = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
|
var atmos = EntMan.System<AtmosphereSystem>();
|
||||||
var gas = atmos.GetGas((Gas) cast.FilteredGas);
|
var gas = atmos.GetGas((Gas) cast.FilteredGas);
|
||||||
var gasName = Loc.GetString(gas.Name);
|
var gasName = Loc.GetString(gas.Name);
|
||||||
_window.SetGasFiltered(gas.ID, gasName);
|
_window.SetGasFiltered(gas.ID, gasName);
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
using System;
|
|
||||||
using Content.Client.Atmos.EntitySystems;
|
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
|
||||||
using Content.Shared.Atmos.Piping.Trinary.Components;
|
using Content.Shared.Atmos.Piping.Trinary.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Atmos.UI
|
namespace Content.Client.Atmos.UI
|
||||||
{
|
{
|
||||||
@@ -15,11 +11,13 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasMixerBoundUserInterface : BoundUserInterface
|
public sealed class GasMixerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GasMixerWindow? _window;
|
|
||||||
private const float MaxPressure = Atmospherics.MaxOutputPressure;
|
private const float MaxPressure = Atmospherics.MaxOutputPressure;
|
||||||
|
|
||||||
public GasMixerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private GasMixerWindow? _window;
|
||||||
|
|
||||||
|
public GasMixerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +47,9 @@ namespace Content.Client.Atmos.UI
|
|||||||
|
|
||||||
private void OnMixerOutputPressurePressed(string value)
|
private void OnMixerOutputPressurePressed(string value)
|
||||||
{
|
{
|
||||||
float pressure = float.TryParse(value, out var parsed) ? parsed : 0f;
|
var pressure = float.TryParse(value, out var parsed) ? parsed : 0f;
|
||||||
if (pressure > MaxPressure) pressure = MaxPressure;
|
if (pressure > MaxPressure)
|
||||||
|
pressure = MaxPressure;
|
||||||
|
|
||||||
SendMessage(new GasMixerChangeOutputPressureMessage(pressure));
|
SendMessage(new GasMixerChangeOutputPressureMessage(pressure));
|
||||||
}
|
}
|
||||||
@@ -58,11 +57,12 @@ namespace Content.Client.Atmos.UI
|
|||||||
private void OnMixerSetPercentagePressed(string value)
|
private void OnMixerSetPercentagePressed(string value)
|
||||||
{
|
{
|
||||||
// We don't need to send both nodes because it's just 100.0f - node
|
// We don't need to send both nodes because it's just 100.0f - node
|
||||||
float node = float.TryParse(value, out var parsed) ? parsed : 1.0f;
|
var node = float.TryParse(value, out var parsed) ? parsed : 1.0f;
|
||||||
|
|
||||||
node = Math.Clamp(node, 0f, 100.0f);
|
node = Math.Clamp(node, 0f, 100.0f);
|
||||||
|
|
||||||
if (_window is not null) node = _window.NodeOneLastEdited ? node : 100.0f - node;
|
if (_window is not null)
|
||||||
|
node = _window.NodeOneLastEdited ? node : 100.0f - node;
|
||||||
|
|
||||||
SendMessage(new GasMixerChangeNodePercentageMessage(node));
|
SendMessage(new GasMixerChangeNodePercentageMessage(node));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
using System;
|
using Content.Shared.Atmos;
|
||||||
using Content.Client.Atmos.EntitySystems;
|
|
||||||
using Content.Shared.Atmos;
|
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using Content.Shared.Atmos.Piping.Trinary.Components;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Atmos.UI
|
namespace Content.Client.Atmos.UI
|
||||||
{
|
{
|
||||||
@@ -15,11 +11,13 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
|
public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GasPressurePumpWindow? _window;
|
|
||||||
private const float MaxPressure = Atmospherics.MaxOutputPressure;
|
private const float MaxPressure = Atmospherics.MaxOutputPressure;
|
||||||
|
|
||||||
public GasPressurePumpBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private GasPressurePumpWindow? _window;
|
||||||
|
|
||||||
|
public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos.Piping.Unary.Components;
|
||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
|
||||||
using Content.Shared.Atmos.Piping.Unary.Components;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Atmos.UI
|
namespace Content.Client.Atmos.UI
|
||||||
{
|
{
|
||||||
@@ -13,12 +10,16 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasThermomachineBoundUserInterface : BoundUserInterface
|
public sealed class GasThermomachineBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GasThermomachineWindow? _window;
|
private GasThermomachineWindow? _window;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private float _minTemp = 0.0f;
|
private float _minTemp = 0.0f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private float _maxTemp = 0.0f;
|
private float _maxTemp = 0.0f;
|
||||||
|
|
||||||
public GasThermomachineBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public GasThermomachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using Content.Shared.Atmos.Piping.Binary.Components;
|
using Content.Shared.Atmos.Piping.Binary.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Atmos.UI
|
namespace Content.Client.Atmos.UI
|
||||||
{
|
{
|
||||||
@@ -12,11 +11,13 @@ namespace Content.Client.Atmos.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasVolumePumpBoundUserInterface : BoundUserInterface
|
public sealed class GasVolumePumpBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GasVolumePumpWindow? _window;
|
|
||||||
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
|
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||||
|
|
||||||
public GasVolumePumpBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private GasVolumePumpWindow? _window;
|
||||||
|
|
||||||
|
public GasVolumePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +46,9 @@ namespace Content.Client.Atmos.UI
|
|||||||
|
|
||||||
private void OnPumpTransferRatePressed(string value)
|
private void OnPumpTransferRatePressed(string value)
|
||||||
{
|
{
|
||||||
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
|
var rate = float.TryParse(value, out var parsed) ? parsed : 0f;
|
||||||
if (rate > MaxTransferRate) rate = MaxTransferRate;
|
if (rate > MaxTransferRate)
|
||||||
|
rate = MaxTransferRate;
|
||||||
|
|
||||||
SendMessage(new GasVolumePumpChangeTransferRateMessage(rate));
|
SendMessage(new GasVolumePumpChangeTransferRateMessage(rate));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ public sealed class CargoBountyConsoleBoundUserInterface : BoundUserInterface
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private CargoBountyMenu? _menu;
|
private CargoBountyMenu? _menu;
|
||||||
|
|
||||||
public CargoBountyConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public CargoBountyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ namespace Content.Client.Cargo.BUI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Currently selected product
|
/// Currently selected product
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
private CargoProductPrototype? _product;
|
private CargoProductPrototype? _product;
|
||||||
|
|
||||||
public CargoOrderConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public CargoOrderConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,17 +49,15 @@ namespace Content.Client.Cargo.BUI
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var spriteSystem = EntMan.System<SpriteSystem>();
|
||||||
var sysManager = entityManager.EntitySysManager;
|
|
||||||
var spriteSystem = sysManager.GetEntitySystem<SpriteSystem>();
|
|
||||||
_menu = new CargoConsoleMenu(IoCManager.Resolve<IPrototypeManager>(), spriteSystem);
|
_menu = new CargoConsoleMenu(IoCManager.Resolve<IPrototypeManager>(), spriteSystem);
|
||||||
var localPlayer = IoCManager.Resolve<IPlayerManager>()?.LocalPlayer?.ControlledEntity;
|
var localPlayer = IoCManager.Resolve<IPlayerManager>()?.LocalPlayer?.ControlledEntity;
|
||||||
var description = new FormattedMessage();
|
var description = new FormattedMessage();
|
||||||
|
|
||||||
string orderRequester;
|
string orderRequester;
|
||||||
|
|
||||||
if (entityManager.TryGetComponent<MetaDataComponent>(localPlayer, out var metadata))
|
if (EntMan.TryGetComponent<MetaDataComponent>(localPlayer, out var metadata))
|
||||||
orderRequester = Identity.Name(localPlayer.Value, entityManager);
|
orderRequester = Identity.Name(localPlayer.Value, EntMan);
|
||||||
else
|
else
|
||||||
orderRequester = string.Empty;
|
orderRequester = string.Empty;
|
||||||
|
|
||||||
@@ -138,7 +137,7 @@ namespace Content.Client.Cargo.BUI
|
|||||||
|
|
||||||
private bool AddOrder()
|
private bool AddOrder()
|
||||||
{
|
{
|
||||||
int orderAmt = _orderMenu?.Amount.Value ?? 0;
|
var orderAmt = _orderMenu?.Amount.Value ?? 0;
|
||||||
if (orderAmt < 1 || orderAmt > OrderCapacity)
|
if (orderAmt < 1 || orderAmt > OrderCapacity)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ namespace Content.Client.Cargo.BUI;
|
|||||||
|
|
||||||
public sealed class CargoPalletConsoleBoundUserInterface : BoundUserInterface
|
public sealed class CargoPalletConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private CargoPalletMenu? _menu;
|
private CargoPalletMenu? _menu;
|
||||||
|
|
||||||
public CargoPalletConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public CargoPalletConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ namespace Content.Client.Cargo.BUI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class CargoShuttleConsoleBoundUserInterface : BoundUserInterface
|
public sealed class CargoShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private CargoShuttleMenu? _menu;
|
private CargoShuttleMenu? _menu;
|
||||||
|
|
||||||
public CargoShuttleConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public CargoShuttleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,15 +8,17 @@ namespace Content.Client.CartridgeLoader;
|
|||||||
|
|
||||||
public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager? _entityManager = default!;
|
[ViewVariables]
|
||||||
|
|
||||||
private EntityUid? _activeProgram;
|
private EntityUid? _activeProgram;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private UIFragment? _activeCartridgeUI;
|
private UIFragment? _activeCartridgeUI;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private Control? _activeUiFragment;
|
private Control? _activeUiFragment;
|
||||||
|
|
||||||
protected CartridgeLoaderBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
protected CartridgeLoaderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
protected override void UpdateState(BoundUserInterfaceState state)
|
||||||
@@ -119,7 +121,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
protected CartridgeComponent? RetrieveCartridgeComponent(EntityUid? cartridgeUid)
|
protected CartridgeComponent? RetrieveCartridgeComponent(EntityUid? cartridgeUid)
|
||||||
{
|
{
|
||||||
return _entityManager?.GetComponentOrNull<CartridgeComponent>(cartridgeUid);
|
return EntMan.GetComponentOrNull<CartridgeComponent>(cartridgeUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid)
|
private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid)
|
||||||
@@ -130,7 +132,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
private UIFragment? RetrieveCartridgeUI(EntityUid? cartridgeUid)
|
private UIFragment? RetrieveCartridgeUI(EntityUid? cartridgeUid)
|
||||||
{
|
{
|
||||||
var component = _entityManager?.GetComponentOrNull<UIFragmentComponent>(cartridgeUid);
|
var component = EntMan.GetComponentOrNull<UIFragmentComponent>(cartridgeUid);
|
||||||
component?.Ui?.Setup(this, cartridgeUid);
|
component?.Ui?.Setup(this, cartridgeUid);
|
||||||
return component?.Ui;
|
return component?.Ui;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Chemistry.Dispenser;
|
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -12,12 +11,11 @@ namespace Content.Client.Chemistry.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ChemMasterBoundUserInterface : BoundUserInterface
|
public sealed class ChemMasterBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[ViewVariables]
|
||||||
private ChemMasterWindow? _window;
|
private ChemMasterWindow? _window;
|
||||||
|
|
||||||
public ChemMasterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ChemMasterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,7 +29,7 @@ namespace Content.Client.Chemistry.UI
|
|||||||
// Setup window layout/elements
|
// Setup window layout/elements
|
||||||
_window = new ChemMasterWindow
|
_window = new ChemMasterWindow
|
||||||
{
|
{
|
||||||
Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName,
|
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
|
||||||
};
|
};
|
||||||
|
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
@@ -50,7 +48,8 @@ namespace Content.Client.Chemistry.UI
|
|||||||
new ChemMasterCreatePillsMessage(
|
new ChemMasterCreatePillsMessage(
|
||||||
(uint) _window.PillDosage.Value, (uint) _window.PillNumber.Value, _window.LabelLine));
|
(uint) _window.PillDosage.Value, (uint) _window.PillNumber.Value, _window.LabelLine));
|
||||||
_window.CreateBottleButton.OnPressed += _ => SendMessage(
|
_window.CreateBottleButton.OnPressed += _ => SendMessage(
|
||||||
new ChemMasterOutputToBottleMessage((uint)_window.BottleDosage.Value, _window.LabelLine));
|
new ChemMasterOutputToBottleMessage(
|
||||||
|
(uint) _window.BottleDosage.Value, _window.LabelLine));
|
||||||
|
|
||||||
for (uint i = 0; i < _window.PillTypeButtons.Length; i++)
|
for (uint i = 0; i < _window.PillTypeButtons.Length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ namespace Content.Client.Chemistry.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ReagentDispenserBoundUserInterface : BoundUserInterface
|
public sealed class ReagentDispenserBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[ViewVariables]
|
||||||
private ReagentDispenserWindow? _window;
|
private ReagentDispenserWindow? _window;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private ReagentDispenserBoundUserInterfaceState? _lastState;
|
private ReagentDispenserBoundUserInterfaceState? _lastState;
|
||||||
|
|
||||||
public ReagentDispenserBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ReagentDispenserBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ namespace Content.Client.Chemistry.UI
|
|||||||
// Setup window layout/elements
|
// Setup window layout/elements
|
||||||
_window = new()
|
_window = new()
|
||||||
{
|
{
|
||||||
Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName,
|
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
|
||||||
};
|
};
|
||||||
|
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
@@ -52,11 +54,13 @@ namespace Content.Client.Chemistry.UI
|
|||||||
|
|
||||||
// Setup reagent button actions.
|
// Setup reagent button actions.
|
||||||
_window.OnDispenseReagentButtonPressed += (args, button) => SendMessage(new ReagentDispenserDispenseReagentMessage(button.ReagentId));
|
_window.OnDispenseReagentButtonPressed += (args, button) => SendMessage(new ReagentDispenserDispenseReagentMessage(button.ReagentId));
|
||||||
_window.OnDispenseReagentButtonMouseEntered += (args, button) => {
|
_window.OnDispenseReagentButtonMouseEntered += (args, button) =>
|
||||||
|
{
|
||||||
if (_lastState is not null)
|
if (_lastState is not null)
|
||||||
_window.UpdateContainerInfo(_lastState, button.ReagentId);
|
_window.UpdateContainerInfo(_lastState, button.ReagentId);
|
||||||
};
|
};
|
||||||
_window.OnDispenseReagentButtonMouseExited += (args, button) => {
|
_window.OnDispenseReagentButtonMouseExited += (args, button) =>
|
||||||
|
{
|
||||||
if (_lastState is not null)
|
if (_lastState is not null)
|
||||||
_window.UpdateContainerInfo(_lastState);
|
_window.UpdateContainerInfo(_lastState);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,13 @@ namespace Content.Client.Chemistry.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class TransferAmountBoundUserInterface : BoundUserInterface
|
public sealed class TransferAmountBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private TransferAmountWindow? _window;
|
private TransferAmountWindow? _window;
|
||||||
|
|
||||||
|
public TransferAmountBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
@@ -27,10 +32,6 @@ namespace Content.Client.Chemistry.UI
|
|||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransferAmountBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ namespace Content.Client.CloningConsole.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class CloningConsoleBoundUserInterface : BoundUserInterface
|
public sealed class CloningConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private CloningConsoleWindow? _window;
|
private CloningConsoleWindow? _window;
|
||||||
|
|
||||||
public CloningConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public CloningConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,14 @@ namespace Content.Client.Clothing.UI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ChameleonBoundUserInterface : BoundUserInterface
|
public sealed class ChameleonBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
private readonly ChameleonClothingSystem _chameleon;
|
private readonly ChameleonClothingSystem _chameleon;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private ChameleonMenu? _menu;
|
private ChameleonMenu? _menu;
|
||||||
|
|
||||||
public ChameleonBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ChameleonBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
_chameleon = EntMan.System<ChameleonClothingSystem>();
|
||||||
_chameleon = _entityManager.System<ChameleonClothingSystem>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -8,23 +8,31 @@ namespace Content.Client.Communications.UI
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
[ViewVariables] private CommunicationsConsoleMenu? _menu;
|
[ViewVariables]
|
||||||
|
private CommunicationsConsoleMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public bool CanAnnounce { get; private set; }
|
public bool CanAnnounce { get; private set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public bool CanCall { get; private set; }
|
public bool CanCall { get; private set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public bool CountdownStarted { get; private set; }
|
public bool CountdownStarted { get; private set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public bool AlertLevelSelectable { get; private set; }
|
public bool AlertLevelSelectable { get; private set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public string CurrentLevel { get; private set; } = default!;
|
public string CurrentLevel { get; private set; } = default!;
|
||||||
|
|
||||||
public int Countdown => _expectedCountdownTime == null ? 0 : Math.Max((int)_expectedCountdownTime.Value.Subtract(_gameTiming.CurTime).TotalSeconds, 0);
|
[ViewVariables]
|
||||||
private TimeSpan? _expectedCountdownTime;
|
private TimeSpan? _expectedCountdownTime;
|
||||||
|
|
||||||
public CommunicationsConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public int Countdown => _expectedCountdownTime == null ? 0 : Math.Max((int) _expectedCountdownTime.Value.Subtract(_gameTiming.CurTime).TotalSeconds, 0);
|
||||||
{
|
|
||||||
|
|
||||||
|
public CommunicationsConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Client.Computer
|
namespace Content.Client.Computer
|
||||||
{
|
{
|
||||||
@@ -13,6 +11,8 @@ namespace Content.Client.Computer
|
|||||||
public class ComputerBoundUserInterface<TWindow, TState> : ComputerBoundUserInterfaceBase where TWindow : BaseWindow, IComputerWindow<TState>, new() where TState : BoundUserInterfaceState
|
public class ComputerBoundUserInterface<TWindow, TState> : ComputerBoundUserInterfaceBase where TWindow : BaseWindow, IComputerWindow<TState>, new() where TState : BoundUserInterfaceState
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!;
|
[Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private TWindow? _window;
|
private TWindow? _window;
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -26,7 +26,9 @@ namespace Content.Client.Computer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alas, this constructor has to be copied to the subclass. :(
|
// Alas, this constructor has to be copied to the subclass. :(
|
||||||
public ComputerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public ComputerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
protected override void UpdateState(BoundUserInterfaceState state)
|
||||||
{
|
{
|
||||||
@@ -58,7 +60,9 @@ namespace Content.Client.Computer
|
|||||||
[Virtual]
|
[Virtual]
|
||||||
public class ComputerBoundUserInterfaceBase : BoundUserInterface
|
public class ComputerBoundUserInterfaceBase : BoundUserInterface
|
||||||
{
|
{
|
||||||
public ComputerBoundUserInterfaceBase(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public ComputerBoundUserInterfaceBase(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public new void SendMessage(BoundUserInterfaceMessage msg)
|
public new void SendMessage(BoundUserInterfaceMessage msg)
|
||||||
{
|
{
|
||||||
@@ -68,8 +72,13 @@ namespace Content.Client.Computer
|
|||||||
|
|
||||||
public interface IComputerWindow<TState>
|
public interface IComputerWindow<TState>
|
||||||
{
|
{
|
||||||
void SetupComputerWindow(ComputerBoundUserInterfaceBase cb) {}
|
void SetupComputerWindow(ComputerBoundUserInterfaceBase cb)
|
||||||
void UpdateState(TState state) {}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateState(TState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
using System.Collections.Generic;
|
using System.Text.RegularExpressions;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using static Content.Shared.Configurable.ConfigurationComponent;
|
using static Content.Shared.Configurable.ConfigurationComponent;
|
||||||
|
|
||||||
namespace Content.Client.Configurable.UI
|
namespace Content.Client.Configurable.UI
|
||||||
{
|
{
|
||||||
public sealed class ConfigurationBoundUserInterface : BoundUserInterface
|
public sealed class ConfigurationBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
|
private ConfigurationMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public Regex? Validation { get; internal set; }
|
public Regex? Validation { get; internal set; }
|
||||||
|
|
||||||
public ConfigurationBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ConfigurationBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigurationMenu? _menu;
|
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|||||||
@@ -2,20 +2,19 @@
|
|||||||
using Content.Shared.Crayon;
|
using Content.Shared.Crayon;
|
||||||
using Content.Shared.Decals;
|
using Content.Shared.Decals;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Crayon.UI
|
namespace Content.Client.Crayon.UI
|
||||||
{
|
{
|
||||||
public sealed class CrayonBoundUserInterface : BoundUserInterface
|
public sealed class CrayonBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
public CrayonBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private CrayonWindow? _menu;
|
||||||
|
|
||||||
|
public CrayonBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private CrayonWindow? _menu;
|
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
||||||
|
|
||||||
namespace Content.Client.Disposal.UI
|
namespace Content.Client.Disposal.UI
|
||||||
@@ -11,9 +10,10 @@ namespace Content.Client.Disposal.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DisposalRouterBoundUserInterface : BoundUserInterface
|
public sealed class DisposalRouterBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private DisposalRouterWindow? _window;
|
private DisposalRouterWindow? _window;
|
||||||
|
|
||||||
public DisposalRouterBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public DisposalRouterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalTaggerComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalTaggerComponent;
|
||||||
|
|
||||||
namespace Content.Client.Disposal.UI
|
namespace Content.Client.Disposal.UI
|
||||||
@@ -11,9 +10,10 @@ namespace Content.Client.Disposal.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DisposalTaggerBoundUserInterface : BoundUserInterface
|
public sealed class DisposalTaggerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private DisposalTaggerWindow? _window;
|
private DisposalTaggerWindow? _window;
|
||||||
|
|
||||||
public DisposalTaggerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public DisposalTaggerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,16 +14,15 @@ namespace Content.Client.Disposal.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DisposalUnitBoundUserInterface : BoundUserInterface
|
public sealed class DisposalUnitBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
// What are you doing here
|
// What are you doing here
|
||||||
|
[ViewVariables]
|
||||||
public MailingUnitWindow? MailingUnitWindow;
|
public MailingUnitWindow? MailingUnitWindow;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public DisposalUnitWindow? DisposalUnitWindow;
|
public DisposalUnitWindow? DisposalUnitWindow;
|
||||||
|
|
||||||
public DisposalUnitBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public DisposalUnitBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonPressed(UiButton button)
|
private void ButtonPressed(UiButton button)
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ namespace Content.Client.Fax.UI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class FaxBoundUi : BoundUserInterface
|
public sealed class FaxBoundUi : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private FaxWindow? _window;
|
private FaxWindow? _window;
|
||||||
|
|
||||||
public FaxBoundUi(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public FaxBoundUi(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ namespace Content.Client.Forensics
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private ForensicScannerMenu? _window;
|
private ForensicScannerMenu? _window;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private TimeSpan _printCooldown;
|
private TimeSpan _printCooldown;
|
||||||
|
|
||||||
public ForensicScannerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ForensicScannerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
using Content.Shared.Gravity;
|
using Content.Shared.Gravity;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Gravity.UI
|
namespace Content.Client.Gravity.UI
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
|
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GravityGeneratorWindow? _window;
|
private GravityGeneratorWindow? _window;
|
||||||
|
|
||||||
public GravityGeneratorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base (owner, uiKey)
|
public GravityGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ namespace Content.Client.Gravity.UI
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_window = new GravityGeneratorWindow(this, Owner);
|
_window = new GravityGeneratorWindow(this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_window.Switch.OnPressed += _ =>
|
_window.Switch.OnPressed += _ =>
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ namespace Content.Client.Gravity.UI
|
|||||||
|
|
||||||
private readonly GravityGeneratorBoundUserInterface _owner;
|
private readonly GravityGeneratorBoundUserInterface _owner;
|
||||||
|
|
||||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface ui, ClientUserInterfaceComponent component)
|
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface owner)
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
_owner = ui;
|
_owner = owner;
|
||||||
|
|
||||||
OnButton.Group = _buttonGroup;
|
OnButton.Group = _buttonGroup;
|
||||||
OffButton.Group = _buttonGroup;
|
OffButton.Group = _buttonGroup;
|
||||||
@@ -27,7 +27,7 @@ namespace Content.Client.Gravity.UI
|
|||||||
OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
|
OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
|
||||||
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);
|
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);
|
||||||
|
|
||||||
EntityView.Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner);
|
EntityView.SetEntity(owner.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state)
|
public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state)
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ namespace Content.Client.HealthAnalyzer.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class HealthAnalyzerBoundUserInterface : BoundUserInterface
|
public sealed class HealthAnalyzerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private HealthAnalyzerWindow? _window;
|
private HealthAnalyzerWindow? _window;
|
||||||
|
|
||||||
public HealthAnalyzerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public HealthAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ namespace Content.Client.HealthAnalyzer.UI
|
|||||||
base.Open();
|
base.Open();
|
||||||
_window = new HealthAnalyzerWindow
|
_window = new HealthAnalyzerWindow
|
||||||
{
|
{
|
||||||
Title = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName,
|
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
|
||||||
};
|
};
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
|
|||||||
@@ -11,12 +11,13 @@ namespace Content.Client.Humanoid;
|
|||||||
|
|
||||||
public sealed class HumanoidMarkingModifierBoundUserInterface : BoundUserInterface
|
public sealed class HumanoidMarkingModifierBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
public HumanoidMarkingModifierBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private HumanoidMarkingModifierWindow? _window;
|
||||||
|
|
||||||
|
public HumanoidMarkingModifierBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private HumanoidMarkingModifierWindow? _window;
|
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Client.Instruments.UI
|
namespace Content.Client.Instruments.UI
|
||||||
{
|
{
|
||||||
@@ -10,15 +7,16 @@ namespace Content.Client.Instruments.UI
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private InstrumentMenu? _instrumentMenu;
|
private InstrumentMenu? _instrumentMenu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public InstrumentComponent? Instrument { get; set; }
|
public InstrumentComponent? Instrument { get; set; }
|
||||||
|
|
||||||
public InstrumentBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public InstrumentBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<InstrumentComponent?>(Owner.Owner, out var instrument)) return;
|
if (!EntMan.TryGetComponent<InstrumentComponent?>(Owner, out var instrument)) return;
|
||||||
|
|
||||||
Instrument = instrument;
|
Instrument = instrument;
|
||||||
_instrumentMenu = new InstrumentMenu(this);
|
_instrumentMenu = new InstrumentMenu(this);
|
||||||
|
|||||||
@@ -29,31 +29,34 @@ namespace Content.Client.Inventory
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class StrippableBoundUserInterface : BoundUserInterface
|
public sealed class StrippableBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
private const int ButtonSeparation = 4;
|
|
||||||
|
|
||||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
|
||||||
[Dependency] private readonly IUserInterfaceManager _ui = default!;
|
[Dependency] private readonly IUserInterfaceManager _ui = default!;
|
||||||
private ExamineSystem _examine = default!;
|
private readonly ExamineSystem _examine = default!;
|
||||||
private InventorySystem _inv = default!;
|
private readonly InventorySystem _inv = default!;
|
||||||
private readonly SharedCuffableSystem _cuffable;
|
private readonly SharedCuffableSystem _cuffable;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private StrippingMenu? _strippingMenu;
|
private const int ButtonSeparation = 4;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
public const string HiddenPocketEntityId = "StrippingHiddenEntity";
|
public const string HiddenPocketEntityId = "StrippingHiddenEntity";
|
||||||
private EntityUid _virtualHiddenEntity;
|
|
||||||
|
|
||||||
public StrippableBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private readonly StrippingMenu? _strippingMenu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
private readonly EntityUid _virtualHiddenEntity;
|
||||||
|
|
||||||
|
public StrippableBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
_examine = EntMan.System<ExamineSystem>();
|
||||||
_examine = _entMan.EntitySysManager.GetEntitySystem<ExamineSystem>();
|
_inv = EntMan.System<InventorySystem>();
|
||||||
_inv = _entMan.EntitySysManager.GetEntitySystem<InventorySystem>();
|
_cuffable = EntMan.System<SharedCuffableSystem>();
|
||||||
_cuffable = _entMan.System<SharedCuffableSystem>();
|
|
||||||
var title = Loc.GetString("strippable-bound-user-interface-stripping-menu-title", ("ownerName", Identity.Name(Owner.Owner, _entMan)));
|
var title = Loc.GetString("strippable-bound-user-interface-stripping-menu-title", ("ownerName", Identity.Name(Owner, EntMan)));
|
||||||
_strippingMenu = new StrippingMenu(title, this);
|
_strippingMenu = new StrippingMenu(title, this);
|
||||||
_strippingMenu.OnClose += Close;
|
_strippingMenu.OnClose += Close;
|
||||||
_virtualHiddenEntity = _entMan.SpawnEntity(HiddenPocketEntityId, MapCoordinates.Nullspace);
|
_virtualHiddenEntity = EntMan.SpawnEntity(HiddenPocketEntityId, MapCoordinates.Nullspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -66,7 +69,7 @@ namespace Content.Client.Inventory
|
|||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
|
||||||
_entMan.DeleteEntity(_virtualHiddenEntity);
|
EntMan.DeleteEntity(_virtualHiddenEntity);
|
||||||
|
|
||||||
if (!disposing)
|
if (!disposing)
|
||||||
return;
|
return;
|
||||||
@@ -87,15 +90,15 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
_strippingMenu.ClearButtons();
|
_strippingMenu.ClearButtons();
|
||||||
|
|
||||||
if (_entMan.TryGetComponent(Owner.Owner, out InventoryComponent? inv) && _protoMan.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var template))
|
if (EntMan.TryGetComponent<InventoryComponent>(Owner, out var inv) && _protoMan.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var template))
|
||||||
{
|
{
|
||||||
foreach (var slot in template.Slots)
|
foreach (var slot in template.Slots)
|
||||||
{
|
{
|
||||||
AddInventoryButton(slot.Name, template, inv);
|
AddInventoryButton(Owner, slot.Name, template, inv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entMan.TryGetComponent(Owner.Owner, out HandsComponent? handsComp))
|
if (EntMan.TryGetComponent<HandsComponent>(Owner, out var handsComp))
|
||||||
{
|
{
|
||||||
// good ol hands shit code. there is a GuiHands comparer that does the same thing... but these are hands
|
// good ol hands shit code. there is a GuiHands comparer that does the same thing... but these are hands
|
||||||
// and not gui hands... which are different...
|
// and not gui hands... which are different...
|
||||||
@@ -125,7 +128,7 @@ namespace Content.Client.Inventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// snare-removal button. This is just the old button before the change to item slots. It is pretty out of place.
|
// snare-removal button. This is just the old button before the change to item slots. It is pretty out of place.
|
||||||
if (_entMan.TryGetComponent(Owner.Owner, out EnsnareableComponent? snare) && snare.IsEnsnared)
|
if (EntMan.TryGetComponent<EnsnareableComponent>(Owner, out var snare) && snare.IsEnsnared)
|
||||||
{
|
{
|
||||||
var button = new Button()
|
var button = new Button()
|
||||||
{
|
{
|
||||||
@@ -156,10 +159,10 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
button.Pressed += SlotPressed;
|
button.Pressed += SlotPressed;
|
||||||
|
|
||||||
if (_entMan.TryGetComponent(hand.HeldEntity, out HandVirtualItemComponent? virt))
|
if (EntMan.TryGetComponent<HandVirtualItemComponent>(hand.HeldEntity, out var virt))
|
||||||
{
|
{
|
||||||
button.Blocked = true;
|
button.Blocked = true;
|
||||||
if (_entMan.TryGetComponent(Owner.Owner, out CuffableComponent? cuff) && _cuffable.GetAllCuffs(cuff).Contains(virt.BlockingEntity))
|
if (EntMan.TryGetComponent<CuffableComponent>(Owner, out var cuff) && _cuffable.GetAllCuffs(cuff).Contains(virt.BlockingEntity))
|
||||||
button.BlockedRect.MouseFilter = MouseFilterMode.Ignore;
|
button.BlockedRect.MouseFilter = MouseFilterMode.Ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,9 +190,9 @@ namespace Content.Client.Inventory
|
|||||||
_ui.GetUIController<VerbMenuUIController>().OpenVerbMenu(slot.Entity.Value);
|
_ui.GetUIController<VerbMenuUIController>().OpenVerbMenu(slot.Entity.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddInventoryButton(string slotId, InventoryTemplatePrototype template, InventoryComponent inv)
|
private void AddInventoryButton(EntityUid invUid, string slotId, InventoryTemplatePrototype _, InventoryComponent inv)
|
||||||
{
|
{
|
||||||
if (!_inv.TryGetSlotContainer(inv.Owner, slotId, out var container, out var slotDef, inv))
|
if (!_inv.TryGetSlotContainer(invUid, slotId, out var container, out var slotDef, inv))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var entity = container.ContainedEntity;
|
var entity = container.ContainedEntity;
|
||||||
@@ -216,17 +219,19 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
button.SpriteView.Sprite = null;
|
button.SpriteView.SetEntity(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteComponent? sprite;
|
EntityUid? viewEnt;
|
||||||
if (_entMan.TryGetComponent(entity, out HandVirtualItemComponent? virt))
|
if (EntMan.TryGetComponent<HandVirtualItemComponent>(entity, out var virt))
|
||||||
_entMan.TryGetComponent(virt.BlockingEntity, out sprite);
|
viewEnt = EntMan.HasComponent<SpriteComponent>(virt.BlockingEntity) ? virt.BlockingEntity : null;
|
||||||
else if (!_entMan.TryGetComponent(entity, out sprite))
|
else if (EntMan.HasComponent<SpriteComponent>(entity))
|
||||||
|
viewEnt = entity;
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
button.SpriteView.Sprite = sprite;
|
button.SpriteView.SetEntity(viewEnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,25 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
|
||||||
using Content.Shared.Kitchen.Components;
|
using Content.Shared.Kitchen.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Client.Kitchen.UI
|
namespace Content.Client.Kitchen.UI
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class MicrowaveBoundUserInterface : BoundUserInterface
|
public sealed class MicrowaveBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[ViewVariables]
|
||||||
|
|
||||||
private MicrowaveMenu? _menu;
|
private MicrowaveMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private readonly Dictionary<int, EntityUid> _solids = new();
|
private readonly Dictionary<int, EntityUid> _solids = new();
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private readonly Dictionary<int, Solution.ReagentQuantity> _reagents = new();
|
private readonly Dictionary<int, Solution.ReagentQuantity> _reagents = new();
|
||||||
|
|
||||||
public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner,uiKey)
|
public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +89,7 @@ namespace Content.Client.Kitchen.UI
|
|||||||
_menu.IngredientsList.Clear();
|
_menu.IngredientsList.Clear();
|
||||||
foreach (var entity in containedSolids)
|
foreach (var entity in containedSolids)
|
||||||
{
|
{
|
||||||
if (_entityManager.Deleted(entity))
|
if (EntMan.Deleted(entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -101,11 +97,11 @@ namespace Content.Client.Kitchen.UI
|
|||||||
// TODO just use sprite view
|
// TODO just use sprite view
|
||||||
|
|
||||||
Texture? texture;
|
Texture? texture;
|
||||||
if (_entityManager.TryGetComponent(entity, out IconComponent? iconComponent))
|
if (EntMan.TryGetComponent<IconComponent>(entity, out var iconComponent))
|
||||||
{
|
{
|
||||||
texture = _entityManager.System<SpriteSystem>().GetIcon(iconComponent);
|
texture = EntMan.System<SpriteSystem>().GetIcon(iconComponent);
|
||||||
}
|
}
|
||||||
else if (_entityManager.TryGetComponent(entity, out SpriteComponent? spriteComponent))
|
else if (EntMan.TryGetComponent<SpriteComponent>(entity, out var spriteComponent))
|
||||||
{
|
{
|
||||||
texture = spriteComponent.Icon?.Default;
|
texture = spriteComponent.Icon?.Default;
|
||||||
}
|
}
|
||||||
@@ -114,7 +110,7 @@ namespace Content.Client.Kitchen.UI
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var solidItem = _menu.IngredientsList.AddItem(_entityManager.GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
||||||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
||||||
_solids.Add(solidIndex, entity);
|
_solids.Add(solidIndex, entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,18 +8,20 @@ namespace Content.Client.Kitchen.UI
|
|||||||
{
|
{
|
||||||
public sealed class ReagentGrinderBoundUserInterface : BoundUserInterface
|
public sealed class ReagentGrinderBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private GrinderMenu? _menu;
|
private GrinderMenu? _menu;
|
||||||
|
|
||||||
public ReagentGrinderBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) { }
|
public ReagentGrinderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_menu = new GrinderMenu(this, _entityManager, _prototypeManager);
|
_menu = new GrinderMenu(this, EntMan, _prototypeManager);
|
||||||
_menu.OpenCentered();
|
_menu.OpenCentered();
|
||||||
_menu.OnClose += Close;
|
_menu.OnClose += Close;
|
||||||
}
|
}
|
||||||
@@ -38,10 +40,8 @@ namespace Content.Client.Kitchen.UI
|
|||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
protected override void UpdateState(BoundUserInterfaceState state)
|
||||||
{
|
{
|
||||||
base.UpdateState(state);
|
base.UpdateState(state);
|
||||||
if (!(state is ReagentGrinderInterfaceState cState))
|
if (state is not ReagentGrinderInterfaceState cState)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
_menu?.UpdateState(cState);
|
_menu?.UpdateState(cState);
|
||||||
}
|
}
|
||||||
@@ -52,10 +52,29 @@ namespace Content.Client.Kitchen.UI
|
|||||||
_menu?.HandleMessage(message);
|
_menu?.HandleMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGrinding(BaseButton.ButtonEventArgs? args = null) => SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Grind));
|
public void StartGrinding(BaseButton.ButtonEventArgs? _ = null)
|
||||||
public void StartJuicing(BaseButton.ButtonEventArgs? args = null) => SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Juice));
|
{
|
||||||
public void EjectAll(BaseButton.ButtonEventArgs? args = null) => SendMessage(new ReagentGrinderEjectChamberAllMessage());
|
SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Grind));
|
||||||
public void EjectBeaker(BaseButton.ButtonEventArgs? args = null) => SendMessage(new ItemSlotButtonPressedEvent(SharedReagentGrinder.BeakerSlotId));
|
}
|
||||||
public void EjectChamberContent(EntityUid uid) => SendMessage(new ReagentGrinderEjectChamberContentMessage(uid));
|
|
||||||
|
public void StartJuicing(BaseButton.ButtonEventArgs? _ = null)
|
||||||
|
{
|
||||||
|
SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Juice));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EjectAll(BaseButton.ButtonEventArgs? _ = null)
|
||||||
|
{
|
||||||
|
SendMessage(new ReagentGrinderEjectChamberAllMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EjectBeaker(BaseButton.ButtonEventArgs? _ = null)
|
||||||
|
{
|
||||||
|
SendMessage(new ItemSlotButtonPressedEvent(SharedReagentGrinder.BeakerSlotId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EjectChamberContent(EntityUid uid)
|
||||||
|
{
|
||||||
|
SendMessage(new ReagentGrinderEjectChamberContentMessage(uid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Content.Shared.Labels;
|
using Content.Shared.Labels;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Labels.UI
|
namespace Content.Client.Labels.UI
|
||||||
{
|
{
|
||||||
@@ -9,9 +8,10 @@ namespace Content.Client.Labels.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class HandLabelerBoundUserInterface : BoundUserInterface
|
public sealed class HandLabelerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private HandLabelerWindow? _window;
|
private HandLabelerWindow? _window;
|
||||||
|
|
||||||
public HandLabelerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public HandLabelerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ namespace Content.Client.Lathe.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class LatheBoundUserInterface : BoundUserInterface
|
public sealed class LatheBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[ViewVariables] private LatheMenu? _menu;
|
[ViewVariables]
|
||||||
[ViewVariables] private LatheQueueMenu? _queueMenu;
|
private LatheMenu? _menu;
|
||||||
|
|
||||||
public EntityUid Lathe;
|
[ViewVariables]
|
||||||
|
private LatheQueueMenu? _queueMenu;
|
||||||
|
|
||||||
public LatheBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public LatheBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
Lathe = owner.Owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -55,8 +55,8 @@ namespace Content.Client.Lathe.UI
|
|||||||
case LatheUpdateState msg:
|
case LatheUpdateState msg:
|
||||||
if (_menu != null)
|
if (_menu != null)
|
||||||
_menu.Recipes = msg.Recipes;
|
_menu.Recipes = msg.Recipes;
|
||||||
_menu?.PopulateRecipes(Lathe);
|
_menu?.PopulateRecipes(Owner);
|
||||||
_menu?.PopulateMaterials(Lathe);
|
_menu?.PopulateMaterials(Owner);
|
||||||
_queueMenu?.PopulateList(msg.Queue);
|
_queueMenu?.PopulateList(msg.Queue);
|
||||||
_queueMenu?.SetInfo(msg.CurrentlyProducing);
|
_queueMenu?.SetInfo(msg.CurrentlyProducing);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace Content.Client.Lathe.UI;
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class LatheMenu : DefaultWindow
|
public sealed partial class LatheMenu : DefaultWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
private readonly SpriteSystem _spriteSystem;
|
private readonly SpriteSystem _spriteSystem;
|
||||||
private readonly LatheSystem _lathe;
|
private readonly LatheSystem _lathe;
|
||||||
|
|
||||||
@@ -32,24 +32,24 @@ public sealed partial class LatheMenu : DefaultWindow
|
|||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
_spriteSystem = _entityManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
|
_spriteSystem = _entityManager.System<SpriteSystem>();
|
||||||
_lathe = _entityManager.EntitySysManager.GetEntitySystem<LatheSystem>();
|
_lathe = _entityManager.System<LatheSystem>();
|
||||||
|
|
||||||
Title = _entityManager.GetComponent<MetaDataComponent>(owner.Lathe).EntityName;
|
Title = _entityManager.GetComponent<MetaDataComponent>(owner.Owner).EntityName;
|
||||||
|
|
||||||
SearchBar.OnTextChanged += _ =>
|
SearchBar.OnTextChanged += _ =>
|
||||||
{
|
{
|
||||||
PopulateRecipes(owner.Lathe);
|
PopulateRecipes(owner.Owner);
|
||||||
};
|
};
|
||||||
AmountLineEdit.OnTextChanged += _ =>
|
AmountLineEdit.OnTextChanged += _ =>
|
||||||
{
|
{
|
||||||
PopulateRecipes(owner.Lathe);
|
PopulateRecipes(owner.Owner);
|
||||||
};
|
};
|
||||||
|
|
||||||
QueueButton.OnPressed += a => OnQueueButtonPressed?.Invoke(a);
|
QueueButton.OnPressed += a => OnQueueButtonPressed?.Invoke(a);
|
||||||
ServerListButton.OnPressed += a => OnServerListButtonPressed?.Invoke(a);
|
ServerListButton.OnPressed += a => OnServerListButtonPressed?.Invoke(a);
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent<LatheComponent>(owner.Lathe, out var latheComponent))
|
if (_entityManager.TryGetComponent<LatheComponent>(owner.Owner, out var latheComponent))
|
||||||
{
|
{
|
||||||
if (!latheComponent.DynamicRecipes.Any())
|
if (!latheComponent.DynamicRecipes.Any())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
using Content.Shared.MachineLinking;
|
using Content.Shared.MachineLinking;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.MachineLinking.UI
|
namespace Content.Client.MachineLinking.UI
|
||||||
{
|
{
|
||||||
public sealed class SignalPortSelectorBoundUserInterface : BoundUserInterface
|
public sealed class SignalPortSelectorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private SignalPortSelectorMenu? _menu;
|
private SignalPortSelectorMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private string? _selectedTransmitterPort;
|
private string? _selectedTransmitterPort;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private string? _selectedReceiverPort;
|
private string? _selectedReceiverPort;
|
||||||
|
|
||||||
public SignalPortSelectorBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] Enum uiKey) : base(owner, uiKey) { }
|
public SignalPortSelectorBoundUserInterface([NotNull] EntityUid owner, [NotNull] Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ public sealed class SignalTimerBoundUserInterface : BoundUserInterface
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private SignalTimerWindow? _window;
|
private SignalTimerWindow? _window;
|
||||||
|
|
||||||
public SignalTimerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public SignalTimerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ namespace Content.Client.MagicMirror;
|
|||||||
|
|
||||||
public sealed class MagicMirrorBoundUserInterface : BoundUserInterface
|
public sealed class MagicMirrorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private MagicMirrorWindow? _window;
|
private MagicMirrorWindow? _window;
|
||||||
|
|
||||||
public MagicMirrorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public MagicMirrorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,23 +9,18 @@ namespace Content.Client.Mech.Ui;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class MechBoundUserInterface : BoundUserInterface
|
public sealed class MechBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _ent = default!;
|
[ViewVariables]
|
||||||
|
|
||||||
private readonly EntityUid _mech;
|
|
||||||
|
|
||||||
private MechMenu? _menu;
|
private MechMenu? _menu;
|
||||||
|
|
||||||
public MechBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public MechBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
_mech = owner.Owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_menu = new(_mech);
|
_menu = new(Owner);
|
||||||
|
|
||||||
_menu.OnClose += Close;
|
_menu.OnClose += Close;
|
||||||
_menu.OpenCenteredLeft();
|
_menu.OpenCenteredLeft();
|
||||||
@@ -49,7 +44,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
public void UpdateEquipmentControls(MechBoundUiState state)
|
public void UpdateEquipmentControls(MechBoundUiState state)
|
||||||
{
|
{
|
||||||
if (!_ent.TryGetComponent<MechComponent>(_mech, out var mechComp))
|
if (!EntMan.TryGetComponent<MechComponent>(Owner, out var mechComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var ent in mechComp.EquipmentContainer.ContainedEntities)
|
foreach (var ent in mechComp.EquipmentContainer.ContainedEntities)
|
||||||
@@ -77,7 +72,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
public UIFragment? GetEquipmentUi(EntityUid? uid)
|
public UIFragment? GetEquipmentUi(EntityUid? uid)
|
||||||
{
|
{
|
||||||
var component = _ent.GetComponentOrNull<UIFragmentComponent>(uid);
|
var component = EntMan.GetComponentOrNull<UIFragmentComponent>(uid);
|
||||||
component?.Ui?.Setup(this, uid);
|
component?.Ui?.Setup(this, uid);
|
||||||
return component?.Ui;
|
return component?.Ui;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
using Content.Shared.Medical.CrewMonitoring;
|
using Content.Shared.Medical.CrewMonitoring;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Medical.CrewMonitoring
|
namespace Content.Client.Medical.CrewMonitoring
|
||||||
{
|
{
|
||||||
public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
|
public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
private readonly IEntityManager _entManager;
|
[ViewVariables]
|
||||||
private CrewMonitoringWindow? _menu;
|
private CrewMonitoringWindow? _menu;
|
||||||
|
|
||||||
public CrewMonitoringBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public CrewMonitoringBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
EntityUid? gridUid = null;
|
EntityUid? gridUid = null;
|
||||||
|
|
||||||
if (_entManager.TryGetComponent<TransformComponent>(Owner.Owner, out var xform))
|
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
|
||||||
{
|
{
|
||||||
gridUid = xform.GridUid;
|
gridUid = xform.GridUid;
|
||||||
}
|
}
|
||||||
@@ -37,7 +34,7 @@ namespace Content.Client.Medical.CrewMonitoring
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case CrewMonitoringState st:
|
case CrewMonitoringState st:
|
||||||
_entManager.TryGetComponent<TransformComponent>(Owner.Owner, out var xform);
|
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
|
||||||
|
|
||||||
_menu?.ShowSensors(st.Sensors, xform?.Coordinates, st.Snap, st.Precision);
|
_menu?.ShowSensors(st.Sensors, xform?.Coordinates, st.Snap, st.Precision);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,19 +7,20 @@ namespace Content.Client.NetworkConfigurator;
|
|||||||
|
|
||||||
public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
private readonly NetworkConfiguratorSystem _netConfig;
|
||||||
|
|
||||||
private NetworkConfiguratorListMenu? _listMenu;
|
[ViewVariables]
|
||||||
private NetworkConfiguratorConfigurationMenu? _configurationMenu;
|
private NetworkConfiguratorConfigurationMenu? _configurationMenu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private NetworkConfiguratorLinkMenu? _linkMenu;
|
private NetworkConfiguratorLinkMenu? _linkMenu;
|
||||||
|
|
||||||
private NetworkConfiguratorSystem _netConfig;
|
[ViewVariables]
|
||||||
|
private NetworkConfiguratorListMenu? _listMenu;
|
||||||
|
|
||||||
public NetworkConfiguratorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public NetworkConfiguratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
_netConfig = EntMan.System<NetworkConfiguratorSystem>();
|
||||||
|
|
||||||
_netConfig = _entityManager.System<NetworkConfiguratorSystem>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRemoveButtonPressed(string address)
|
public void OnRemoveButtonPressed(string address)
|
||||||
@@ -48,7 +49,7 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
|||||||
_configurationMenu.Clear.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Clear);
|
_configurationMenu.Clear.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Clear);
|
||||||
_configurationMenu.Copy.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Copy);
|
_configurationMenu.Copy.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Copy);
|
||||||
_configurationMenu.Show.OnPressed += OnShowPressed;
|
_configurationMenu.Show.OnPressed += OnShowPressed;
|
||||||
_configurationMenu.Show.Pressed = _netConfig.ConfiguredListIsTracked(Owner.Owner);
|
_configurationMenu.Show.Pressed = _netConfig.ConfiguredListIsTracked(Owner);
|
||||||
_configurationMenu.OpenCentered();
|
_configurationMenu.OpenCentered();
|
||||||
break;
|
break;
|
||||||
case NetworkConfiguratorUiKey.Link:
|
case NetworkConfiguratorUiKey.Link:
|
||||||
@@ -61,7 +62,7 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
|||||||
|
|
||||||
private void OnShowPressed(BaseButton.ButtonEventArgs args)
|
private void OnShowPressed(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
_netConfig.ToggleVisualization(Owner.Owner, args.Button.Pressed);
|
_netConfig.ToggleVisualization(Owner, args.Button.Pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
protected override void UpdateState(BoundUserInterfaceState state)
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ namespace Content.Client.Nuke
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class NukeBoundUserInterface : BoundUserInterface
|
public sealed class NukeBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private NukeMenu? _menu;
|
private NukeMenu? _menu;
|
||||||
|
|
||||||
public NukeBoundUserInterface([NotNull] ClientUserInterfaceComponent owner, [NotNull] Enum uiKey) : base(owner, uiKey)
|
public NukeBoundUserInterface([NotNull] EntityUid owner, [NotNull] Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,12 +58,10 @@ namespace Content.Client.Nuke
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NukeUiState msg:
|
case NukeUiState msg:
|
||||||
{
|
|
||||||
_menu.UpdateState(msg);
|
_menu.UpdateState(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Content.Shared.Containers.ItemSlots;
|
|||||||
using Content.Shared.CrewManifest;
|
using Content.Shared.CrewManifest;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
|
||||||
@@ -14,14 +13,13 @@ namespace Content.Client.PDA
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class PdaBoundUserInterface : CartridgeLoaderBoundUserInterface
|
public sealed class PdaBoundUserInterface : CartridgeLoaderBoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager? _entityManager = default!;
|
|
||||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private PdaMenu? _menu;
|
private PdaMenu? _menu;
|
||||||
|
|
||||||
public PdaBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public PdaBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -132,7 +130,7 @@ namespace Content.Client.PDA
|
|||||||
|
|
||||||
private PdaBorderColorComponent? GetBorderColorComponent()
|
private PdaBorderColorComponent? GetBorderColorComponent()
|
||||||
{
|
{
|
||||||
return _entityManager?.GetComponentOrNull<PdaBorderColorComponent>(Owner.Owner);
|
return EntMan.GetComponentOrNull<PdaBorderColorComponent>(Owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ using Content.Shared.PDA;
|
|||||||
using Content.Shared.PDA.Ringer;
|
using Content.Shared.PDA.Ringer;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.PDA.Ringer
|
namespace Content.Client.PDA.Ringer
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class RingerBoundUserInterface : BoundUserInterface
|
public sealed class RingerBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private RingtoneMenu? _menu;
|
private RingtoneMenu? _menu;
|
||||||
|
|
||||||
public RingerBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public RingerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ namespace Content.Client.Paper.UI
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class PaperBoundUserInterface : BoundUserInterface
|
public sealed class PaperBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private PaperWindow? _window;
|
private PaperWindow? _window;
|
||||||
|
|
||||||
public PaperBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public PaperBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
_window = new PaperWindow();
|
_window = new PaperWindow();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
@@ -33,7 +33,7 @@ namespace Content.Client.Paper.UI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (entityMgr.TryGetComponent<PaperVisualsComponent>(Owner.Owner, out var visuals))
|
if (EntMan.TryGetComponent<PaperVisualsComponent>(Owner, out var visuals))
|
||||||
{
|
{
|
||||||
_window.InitVisuals(visuals);
|
_window.InitVisuals(visuals);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ namespace Content.Client.ParticleAccelerator.UI
|
|||||||
{
|
{
|
||||||
public sealed class ParticleAcceleratorBoundUserInterface : BoundUserInterface
|
public sealed class ParticleAcceleratorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private ParticleAcceleratorControlMenu? _menu;
|
private ParticleAcceleratorControlMenu? _menu;
|
||||||
|
|
||||||
public ParticleAcceleratorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ParticleAcceleratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Player;
|
|
||||||
|
|
||||||
namespace Content.Client.Pinpointer.UI;
|
namespace Content.Client.Pinpointer.UI;
|
||||||
|
|
||||||
public sealed class StationMapBoundUserInterface : BoundUserInterface
|
public sealed class StationMapBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private StationMapWindow? _window;
|
private StationMapWindow? _window;
|
||||||
|
|
||||||
public StationMapBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public StationMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,12 +17,12 @@ public sealed class StationMapBoundUserInterface : BoundUserInterface
|
|||||||
_window?.Close();
|
_window?.Close();
|
||||||
EntityUid? gridUid = null;
|
EntityUid? gridUid = null;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<TransformComponent>(Owner.Owner, out var xform))
|
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
|
||||||
{
|
{
|
||||||
gridUid = xform.GridUid;
|
gridUid = xform.GridUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
_window = new StationMapWindow(gridUid, Owner.Owner);
|
_window = new StationMapWindow(gridUid, Owner);
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,29 +2,28 @@
|
|||||||
using Content.Shared.APC;
|
using Content.Shared.APC;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Client.Power.APC
|
namespace Content.Client.Power.APC
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ApcBoundUserInterface : BoundUserInterface
|
public sealed class ApcBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[ViewVariables] private ApcMenu? _menu;
|
[ViewVariables]
|
||||||
|
private ApcMenu? _menu;
|
||||||
|
|
||||||
|
public ApcBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_menu = new ApcMenu(this,Owner);
|
_menu = new ApcMenu(this);
|
||||||
_menu.OnClose += Close;
|
_menu.OnClose += Close;
|
||||||
_menu.OpenCentered();
|
_menu.OpenCentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApcBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateState(BoundUserInterfaceState state)
|
protected override void UpdateState(BoundUserInterfaceState state)
|
||||||
{
|
{
|
||||||
base.UpdateState(state);
|
base.UpdateState(state);
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ namespace Content.Client.Power.APC.UI
|
|||||||
public sealed partial class ApcMenu : FancyWindow
|
public sealed partial class ApcMenu : FancyWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
public ApcMenu(ApcBoundUserInterface owner, ClientUserInterfaceComponent component)
|
public ApcMenu(ApcBoundUserInterface owner)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
EntityView.Sprite = _entityManager.GetComponent<SpriteComponent>(component.Owner);
|
EntityView.SetEntity(owner.Owner);
|
||||||
BreakerButton.OnPressed += _ => owner.BreakerPressed();
|
BreakerButton.OnPressed += _ => owner.BreakerPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Client.Computer;
|
using Content.Client.Computer;
|
||||||
using Content.Client.IoC;
|
|
||||||
using Content.Shared.Power;
|
using Content.Shared.Power;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Timing;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Power;
|
namespace Content.Client.Power;
|
||||||
@@ -25,12 +17,14 @@ namespace Content.Client.Power;
|
|||||||
public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWindow<PowerMonitoringConsoleBoundInterfaceState>
|
public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWindow<PowerMonitoringConsoleBoundInterfaceState>
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
private readonly SpriteSystem _spriteSystem = default!;
|
||||||
|
|
||||||
public PowerMonitoringWindow()
|
public PowerMonitoringWindow()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
SetSize = MinSize = new Vector2(300, 450);
|
SetSize = MinSize = new Vector2(300, 450);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
_spriteSystem = IoCManager.Resolve<IEntityManager>().System<SpriteSystem>();
|
||||||
MasterTabContainer.SetTabTitle(0, Loc.GetString("power-monitoring-window-tab-sources"));
|
MasterTabContainer.SetTabTitle(0, Loc.GetString("power-monitoring-window-tab-sources"));
|
||||||
MasterTabContainer.SetTabTitle(1, Loc.GetString("power-monitoring-window-tab-loads"));
|
MasterTabContainer.SetTabTitle(1, Loc.GetString("power-monitoring-window-tab-loads"));
|
||||||
}
|
}
|
||||||
@@ -45,7 +39,7 @@ public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWind
|
|||||||
// This means filtering out loads that are not either:
|
// This means filtering out loads that are not either:
|
||||||
// + Batteries (always important)
|
// + Batteries (always important)
|
||||||
// + Meaningful (size above 0)
|
// + Meaningful (size above 0)
|
||||||
loads = loads.Where(a => a.IsBattery || (a.Size > 0.0f)).ToArray();
|
loads = loads.Where(a => a.IsBattery || a.Size > 0.0f).ToArray();
|
||||||
}
|
}
|
||||||
UpdateList(TotalLoadsNum, scc.TotalLoads, LoadsList, loads);
|
UpdateList(TotalLoadsNum, scc.TotalLoads, LoadsList, loads);
|
||||||
}
|
}
|
||||||
@@ -69,7 +63,7 @@ public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWind
|
|||||||
_prototypeManager.TryIndex(ent.IconEntityPrototypeId, out EntityPrototype? entityPrototype);
|
_prototypeManager.TryIndex(ent.IconEntityPrototypeId, out EntityPrototype? entityPrototype);
|
||||||
IRsiStateLike? iconState = null;
|
IRsiStateLike? iconState = null;
|
||||||
if (entityPrototype != null)
|
if (entityPrototype != null)
|
||||||
iconState = SpriteComponent.GetPrototypeIcon(entityPrototype, StaticIoC.ResC);
|
iconState = _spriteSystem.GetPrototypeIcon(entityPrototype);
|
||||||
var icon = iconState?.GetFrame(RSI.State.Direction.South, 0);
|
var icon = iconState?.GetFrame(RSI.State.Direction.South, 0);
|
||||||
var item = list[i];
|
var item = list[i];
|
||||||
item.Text = $"{ent.NameLocalized} {Loc.GetString("power-monitoring-window-value", ("value", ent.Size))}";
|
item.Text = $"{ent.NameLocalized} {Loc.GetString("power-monitoring-window-value", ("value", ent.Size))}";
|
||||||
@@ -81,6 +75,8 @@ public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWind
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class PowerMonitoringConsoleBoundUserInterface : ComputerBoundUserInterface<PowerMonitoringWindow, PowerMonitoringConsoleBoundInterfaceState>
|
public sealed class PowerMonitoringConsoleBoundUserInterface : ComputerBoundUserInterface<PowerMonitoringWindow, PowerMonitoringConsoleBoundInterfaceState>
|
||||||
{
|
{
|
||||||
public PowerMonitoringConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public PowerMonitoringConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,11 @@ using Content.Client.Computer;
|
|||||||
using Content.Shared.Solar;
|
using Content.Shared.Solar;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Power
|
namespace Content.Client.Power
|
||||||
@@ -19,6 +16,7 @@ namespace Content.Client.Power
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class SolarControlWindow : DefaultWindow, IComputerWindow<SolarControlConsoleBoundInterfaceState>
|
public sealed partial class SolarControlWindow : DefaultWindow, IComputerWindow<SolarControlConsoleBoundInterfaceState>
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
|
private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
|
||||||
|
|
||||||
public SolarControlWindow()
|
public SolarControlWindow()
|
||||||
@@ -28,9 +26,10 @@ namespace Content.Client.Power
|
|||||||
|
|
||||||
public void SetupComputerWindow(ComputerBoundUserInterfaceBase cb)
|
public void SetupComputerWindow(ComputerBoundUserInterfaceBase cb)
|
||||||
{
|
{
|
||||||
PanelRotation.OnTextEntered += text => {
|
PanelRotation.OnTextEntered += text =>
|
||||||
double value;
|
{
|
||||||
if (!double.TryParse((string?) text.Text, out value)) return;
|
if (!double.TryParse((string?) text.Text, out var value))
|
||||||
|
return;
|
||||||
|
|
||||||
SolarControlConsoleAdjustMessage msg = new()
|
SolarControlConsoleAdjustMessage msg = new()
|
||||||
{
|
{
|
||||||
@@ -43,9 +42,11 @@ namespace Content.Client.Power
|
|||||||
_lastState.Rotation = msg.Rotation;
|
_lastState.Rotation = msg.Rotation;
|
||||||
NotARadar.UpdateState(_lastState);
|
NotARadar.UpdateState(_lastState);
|
||||||
};
|
};
|
||||||
PanelVelocity.OnTextEntered += text => {
|
|
||||||
double value;
|
PanelVelocity.OnTextEntered += text =>
|
||||||
if (!double.TryParse((string?) text.Text, out value)) return;
|
{
|
||||||
|
if (!double.TryParse((string?) text.Text, out var value))
|
||||||
|
return;
|
||||||
|
|
||||||
SolarControlConsoleAdjustMessage msg = new()
|
SolarControlConsoleAdjustMessage msg = new()
|
||||||
{
|
{
|
||||||
@@ -61,14 +62,14 @@ namespace Content.Client.Power
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FormatAngle(Angle d)
|
private static string FormatAngle(Angle d)
|
||||||
{
|
{
|
||||||
return d.Degrees.ToString("F1");
|
return d.Degrees.ToString("F1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The idea behind this is to prevent every update from the server
|
// The idea behind this is to prevent every update from the server
|
||||||
// breaking the textfield.
|
// breaking the textfield.
|
||||||
private void UpdateField(LineEdit field, string newValue)
|
private static void UpdateField(LineEdit field, string newValue)
|
||||||
{
|
{
|
||||||
if (!field.HasKeyboardFocus())
|
if (!field.HasKeyboardFocus())
|
||||||
{
|
{
|
||||||
@@ -92,7 +93,7 @@ namespace Content.Client.Power
|
|||||||
{
|
{
|
||||||
// This is used for client-side prediction of the panel rotation.
|
// This is used for client-side prediction of the panel rotation.
|
||||||
// This makes the display feel a lot smoother.
|
// This makes the display feel a lot smoother.
|
||||||
private IGameTiming _gameTiming = IoCManager.Resolve<IGameTiming>();
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
|
private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
|
||||||
|
|
||||||
@@ -105,6 +106,7 @@ namespace Content.Client.Power
|
|||||||
|
|
||||||
public SolarControlNotARadar()
|
public SolarControlNotARadar()
|
||||||
{
|
{
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
MinSize = new Vector2(SizeFull, SizeFull);
|
MinSize = new Vector2(SizeFull, SizeFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +116,7 @@ namespace Content.Client.Power
|
|||||||
_lastStateTime = _gameTiming.CurTime;
|
_lastStateTime = _gameTiming.CurTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Angle PredictedPanelRotation => _lastState.Rotation + (_lastState.AngularVelocity * ((_gameTiming.CurTime - _lastStateTime).TotalSeconds));
|
public Angle PredictedPanelRotation => _lastState.Rotation + _lastState.AngularVelocity * (_gameTiming.CurTime - _lastStateTime).TotalSeconds;
|
||||||
|
|
||||||
protected override void Draw(DrawingHandleScreen handle)
|
protected override void Draw(DrawingHandleScreen handle)
|
||||||
{
|
{
|
||||||
@@ -137,7 +139,7 @@ namespace Content.Client.Power
|
|||||||
|
|
||||||
for (var i = 0; i < gridLinesRadial; i++)
|
for (var i = 0; i < gridLinesRadial; i++)
|
||||||
{
|
{
|
||||||
Angle angle = (Math.PI / gridLinesRadial) * i;
|
Angle angle = Math.PI / gridLinesRadial * i;
|
||||||
var aExtent = angle.ToVec() * RadiusCircle;
|
var aExtent = angle.ToVec() * RadiusCircle;
|
||||||
handle.DrawLine(new Vector2(point, point) - aExtent, new Vector2(point, point) + aExtent, gridLines);
|
handle.DrawLine(new Vector2(point, point) - aExtent, new Vector2(point, point) + aExtent, gridLines);
|
||||||
}
|
}
|
||||||
@@ -162,6 +164,8 @@ namespace Content.Client.Power
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class SolarControlConsoleBoundUserInterface : ComputerBoundUserInterface<SolarControlWindow, SolarControlConsoleBoundInterfaceState>
|
public sealed class SolarControlConsoleBoundUserInterface : ComputerBoundUserInterface<SolarControlWindow, SolarControlConsoleBoundInterfaceState>
|
||||||
{
|
{
|
||||||
public SolarControlConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public SolarControlConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ namespace Content.Client.Research.UI
|
|||||||
{
|
{
|
||||||
public sealed class DiskConsoleBoundUserInterface : BoundUserInterface
|
public sealed class DiskConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private DiskConsoleMenu? _menu;
|
private DiskConsoleMenu? _menu;
|
||||||
|
|
||||||
public DiskConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public DiskConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ namespace Content.Client.Research.UI
|
|||||||
{
|
{
|
||||||
public sealed class ResearchClientBoundUserInterface : BoundUserInterface
|
public sealed class ResearchClientBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private ResearchClientServerSelectionMenu? _menu;
|
private ResearchClientServerSelectionMenu? _menu;
|
||||||
|
|
||||||
public ResearchClientBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public ResearchClientBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
SendMessage(new ResearchClientSyncMessage());
|
SendMessage(new ResearchClientSyncMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,20 +7,18 @@ namespace Content.Client.Research.UI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
|
public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private ResearchConsoleMenu? _consoleMenu;
|
private ResearchConsoleMenu? _consoleMenu;
|
||||||
|
|
||||||
|
public ResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
public ResearchConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
var owner = Owner.Owner;
|
var owner = Owner;
|
||||||
|
|
||||||
_consoleMenu = new ResearchConsoleMenu(owner);
|
_consoleMenu = new ResearchConsoleMenu(owner);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Content.Shared.Salvage;
|
|
||||||
using Content.Shared.Salvage.Expeditions;
|
using Content.Shared.Salvage.Expeditions;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -8,9 +7,10 @@ namespace Content.Client.Salvage.UI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class SalvageExpeditionConsoleBoundUserInterface : BoundUserInterface
|
public sealed class SalvageExpeditionConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private SalvageExpeditionWindow? _window;
|
private SalvageExpeditionWindow? _window;
|
||||||
|
|
||||||
public SalvageExpeditionConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public SalvageExpeditionConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ using Content.Client.Computer;
|
|||||||
using Content.Client.Shuttles.UI;
|
using Content.Client.Shuttles.UI;
|
||||||
using Content.Shared.Shuttles.BUIStates;
|
using Content.Shared.Shuttles.BUIStates;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Shuttles.BUI;
|
namespace Content.Client.Shuttles.BUI;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class EmergencyConsoleBoundUserInterface : ComputerBoundUserInterface<EmergencyConsoleWindow, EmergencyConsoleBoundUserInterfaceState>
|
public sealed class EmergencyConsoleBoundUserInterface : ComputerBoundUserInterface<EmergencyConsoleWindow, EmergencyConsoleBoundUserInterfaceState>
|
||||||
{
|
{
|
||||||
public EmergencyConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public EmergencyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,17 @@ namespace Content.Client.Shuttles.BUI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class IFFConsoleBoundUserInterface : BoundUserInterface
|
public sealed class IFFConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private IFFConsoleWindow? _window;
|
private IFFConsoleWindow? _window;
|
||||||
|
|
||||||
public IFFConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public IFFConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_window = new IFFConsoleWindow();
|
_window = new IFFConsoleWindow();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
_window.ShowIFF += SendIFFMessage;
|
_window.ShowIFF += SendIFFMessage;
|
||||||
|
|||||||
@@ -8,13 +8,17 @@ namespace Content.Client.Shuttles.BUI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
|
public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private RadarConsoleWindow? _window;
|
private RadarConsoleWindow? _window;
|
||||||
|
|
||||||
public RadarConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public RadarConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
_window = new RadarConsoleWindow();
|
_window = new RadarConsoleWindow();
|
||||||
_window.OnClose += Close;
|
_window.OnClose += Close;
|
||||||
_window.OpenCentered();
|
_window.OpenCentered();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Content.Client.Shuttles.UI;
|
using Content.Client.Shuttles.UI;
|
||||||
using Content.Shared.Shuttles.BUIStates;
|
using Content.Shared.Shuttles.BUIStates;
|
||||||
using Content.Shared.Shuttles.Components;
|
|
||||||
using Content.Shared.Shuttles.Events;
|
using Content.Shared.Shuttles.Events;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -10,9 +9,12 @@ namespace Content.Client.Shuttles.BUI;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private ShuttleConsoleWindow? _window;
|
private ShuttleConsoleWindow? _window;
|
||||||
|
|
||||||
public ShuttleConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
public ShuttleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ namespace Content.Client.Shuttles.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryComp<ShuttleConsoleComponent>(console, out var shuttleConsoleComponent))
|
if (!HasComp<ShuttleConsoleComponent>(console))
|
||||||
{
|
{
|
||||||
Logger.Warning($"Unable to set Helmsman console to {console}");
|
Log.Warning($"Unable to set Helmsman console to {console}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
component.Console = shuttleConsoleComponent;
|
component.Console = console;
|
||||||
ActionBlockerSystem.UpdateCanMove(uid);
|
ActionBlockerSystem.UpdateCanMove(uid);
|
||||||
_input.Contexts.SetActiveContext("shuttle");
|
_input.Contexts.SetActiveContext("shuttle");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ namespace Content.Client.StationRecords;
|
|||||||
|
|
||||||
public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInterface
|
public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private GeneralStationRecordConsoleWindow? _window = default!;
|
private GeneralStationRecordConsoleWindow? _window = default!;
|
||||||
|
|
||||||
public GeneralStationRecordConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public GeneralStationRecordConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Client.Examine;
|
using Content.Client.Examine;
|
||||||
using Content.Client.Storage.UI;
|
using Content.Client.Storage.UI;
|
||||||
using Content.Client.UserInterface.Controls;
|
using Content.Client.UserInterface.Controls;
|
||||||
using Content.Client.Verbs;
|
|
||||||
using Content.Client.Verbs.UI;
|
using Content.Client.Verbs.UI;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -17,9 +16,10 @@ namespace Content.Client.Storage
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class StorageBoundUserInterface : BoundUserInterface
|
public sealed class StorageBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[ViewVariables] private StorageWindow? _window;
|
[ViewVariables]
|
||||||
|
private StorageWindow? _window;
|
||||||
|
|
||||||
public StorageBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public StorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,9 +29,10 @@ namespace Content.Client.Storage
|
|||||||
|
|
||||||
if (_window == null)
|
if (_window == null)
|
||||||
{
|
{
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
_window = new StorageWindow(EntMan)
|
||||||
_window = new StorageWindow(entMan)
|
{
|
||||||
{Title = entMan.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName
|
||||||
|
};
|
||||||
|
|
||||||
_window.EntityList.GenerateItem += _window.GenerateButton;
|
_window.EntityList.GenerateItem += _window.GenerateButton;
|
||||||
_window.EntityList.ItemPressed += InteractWithItem;
|
_window.EntityList.ItemPressed += InteractWithItem;
|
||||||
@@ -55,7 +56,7 @@ namespace Content.Client.Storage
|
|||||||
{
|
{
|
||||||
SendMessage(new StorageInteractWithItemEvent(entity));
|
SendMessage(new StorageInteractWithItemEvent(entity));
|
||||||
}
|
}
|
||||||
else if (IoCManager.Resolve<IEntityManager>().EntityExists(entity))
|
else if (EntMan.EntityExists(entity))
|
||||||
{
|
{
|
||||||
OnButtonPressed(args.Event, entity);
|
OnButtonPressed(args.Event, entity);
|
||||||
}
|
}
|
||||||
@@ -63,12 +64,9 @@ namespace Content.Client.Storage
|
|||||||
|
|
||||||
private void OnButtonPressed(GUIBoundKeyEventArgs args, EntityUid entity)
|
private void OnButtonPressed(GUIBoundKeyEventArgs args, EntityUid entity)
|
||||||
{
|
{
|
||||||
var entitySys = IoCManager.Resolve<IEntitySystemManager>();
|
|
||||||
var entities = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
||||||
{
|
{
|
||||||
entitySys.GetEntitySystem<ExamineSystem>()
|
EntMan.System<ExamineSystem>()
|
||||||
.DoExamine(entity);
|
.DoExamine(entity);
|
||||||
}
|
}
|
||||||
else if (args.Function == EngineKeyFunctions.UseSecondary)
|
else if (args.Function == EngineKeyFunctions.UseSecondary)
|
||||||
@@ -77,12 +75,12 @@ namespace Content.Client.Storage
|
|||||||
}
|
}
|
||||||
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
|
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
|
||||||
{
|
{
|
||||||
entities.EntityNetManager?.SendSystemNetworkMessage(
|
EntMan.EntityNetManager?.SendSystemNetworkMessage(
|
||||||
new InteractInventorySlotEvent(entity, altInteract: false));
|
new InteractInventorySlotEvent(entity, altInteract: false));
|
||||||
}
|
}
|
||||||
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
|
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
|
||||||
{
|
{
|
||||||
entities.RaisePredictiveEvent(new InteractInventorySlotEvent(entity, altInteract: true));
|
EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(entity, altInteract: true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ namespace Content.Client.Store.Ui;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class StoreBoundUserInterface : BoundUserInterface
|
public sealed class StoreBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private StoreMenu? _menu;
|
private StoreMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private string _windowName = Loc.GetString("store-ui-default-title");
|
private string _windowName = Loc.GetString("store-ui-default-title");
|
||||||
|
|
||||||
public StoreBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public StoreBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public sealed class StrippableSystem : SharedStrippableSystem
|
|||||||
if (!TryComp(uid, out ClientUserInterfaceComponent? uiComp))
|
if (!TryComp(uid, out ClientUserInterfaceComponent? uiComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var ui in uiComp.Interfaces)
|
foreach (var ui in uiComp.OpenInterfaces.Values)
|
||||||
{
|
{
|
||||||
if (ui is StrippableBoundUserInterface stripUi)
|
if (ui is StrippableBoundUserInterface stripUi)
|
||||||
stripUi.DirtyMenu();
|
stripUi.DirtyMenu();
|
||||||
|
|||||||
@@ -6,18 +6,19 @@ namespace Content.Client.SurveillanceCamera.UI;
|
|||||||
|
|
||||||
public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInterface
|
public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
private readonly EyeLerpingSystem _eyeLerpingSystem;
|
private readonly EyeLerpingSystem _eyeLerpingSystem;
|
||||||
private readonly SurveillanceCameraMonitorSystem _surveillanceCameraMonitorSystem;
|
private readonly SurveillanceCameraMonitorSystem _surveillanceCameraMonitorSystem;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private SurveillanceCameraMonitorWindow? _window;
|
private SurveillanceCameraMonitorWindow? _window;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private EntityUid? _currentCamera;
|
private EntityUid? _currentCamera;
|
||||||
|
|
||||||
public SurveillanceCameraMonitorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public SurveillanceCameraMonitorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
_eyeLerpingSystem = EntMan.System<EyeLerpingSystem>();
|
||||||
_eyeLerpingSystem = _entityManager.EntitySysManager.GetEntitySystem<EyeLerpingSystem>();
|
_surveillanceCameraMonitorSystem = EntMan.System<SurveillanceCameraMonitorSystem>();
|
||||||
_surveillanceCameraMonitorSystem = _entityManager.EntitySysManager.GetEntitySystem<SurveillanceCameraMonitorSystem>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -54,7 +55,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
|||||||
|
|
||||||
private void OnCameraSwitchTimer()
|
private void OnCameraSwitchTimer()
|
||||||
{
|
{
|
||||||
_surveillanceCameraMonitorSystem.AddTimer(Owner.Owner, _window!.OnSwitchTimerComplete);
|
_surveillanceCameraMonitorSystem.AddTimer(Owner, _window!.OnSwitchTimerComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCameraRefresh()
|
private void OnCameraRefresh()
|
||||||
@@ -85,7 +86,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
|||||||
|
|
||||||
if (_currentCamera != null)
|
if (_currentCamera != null)
|
||||||
{
|
{
|
||||||
_surveillanceCameraMonitorSystem.RemoveTimer(Owner.Owner);
|
_surveillanceCameraMonitorSystem.RemoveTimer(Owner);
|
||||||
_eyeLerpingSystem.RemoveEye(_currentCamera.Value);
|
_eyeLerpingSystem.RemoveEye(_currentCamera.Value);
|
||||||
_currentCamera = null;
|
_currentCamera = null;
|
||||||
}
|
}
|
||||||
@@ -104,7 +105,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
|||||||
_currentCamera = cast.ActiveCamera;
|
_currentCamera = cast.ActiveCamera;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent(cast.ActiveCamera, out EyeComponent? eye))
|
if (EntMan.TryGetComponent<EyeComponent>(cast.ActiveCamera, out var eye))
|
||||||
{
|
{
|
||||||
_window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
|
_window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ namespace Content.Client.SurveillanceCamera.UI;
|
|||||||
|
|
||||||
public sealed class SurveillanceCameraSetupBoundUi : BoundUserInterface
|
public sealed class SurveillanceCameraSetupBoundUi : BoundUserInterface
|
||||||
{
|
{
|
||||||
private SurveillanceCameraSetupWindow? _window;
|
[ViewVariables]
|
||||||
private SurveillanceCameraSetupUiKey _type;
|
private readonly SurveillanceCameraSetupUiKey _type;
|
||||||
|
|
||||||
public SurveillanceCameraSetupBoundUi(ClientUserInterfaceComponent component, Enum uiKey) : base(component, uiKey)
|
[ViewVariables]
|
||||||
|
private SurveillanceCameraSetupWindow? _window;
|
||||||
|
|
||||||
|
public SurveillanceCameraSetupBoundUi(EntityUid component, Enum uiKey) : base(component, uiKey)
|
||||||
{
|
{
|
||||||
if (uiKey is not SurveillanceCameraSetupUiKey key)
|
if (uiKey is not SurveillanceCameraSetupUiKey key)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
_type = key;
|
_type = key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,19 +5,21 @@ using Robust.Client.GameObjects;
|
|||||||
namespace Content.Client.UserInterface.Systems.Atmos.GasTank
|
namespace Content.Client.UserInterface.Systems.Atmos.GasTank
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasTankBoundUserInterface
|
public sealed class GasTankBoundUserInterface : BoundUserInterface
|
||||||
: BoundUserInterface
|
|
||||||
{
|
{
|
||||||
public GasTankBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) :
|
[ViewVariables]
|
||||||
base(owner, uiKey)
|
private GasTankWindow? _window;
|
||||||
|
|
||||||
|
public GasTankBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private GasTankWindow? _window;
|
|
||||||
|
|
||||||
public void SetOutputPressure(in float value)
|
public void SetOutputPressure(in float value)
|
||||||
{
|
{
|
||||||
SendMessage(new GasTankSetPressureMessage {Pressure = value});
|
SendMessage(new GasTankSetPressureMessage
|
||||||
|
{
|
||||||
|
Pressure = value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleInternals()
|
public void ToggleInternals()
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ namespace Content.Client.VendingMachines
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private VendingMachineMenu? _menu;
|
private VendingMachineMenu? _menu;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
private List<VendingMachineInventoryEntry> _cachedInventory = new();
|
private List<VendingMachineInventoryEntry> _cachedInventory = new();
|
||||||
|
|
||||||
public VendingMachineBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public VendingMachineBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,12 +22,11 @@ namespace Content.Client.VendingMachines
|
|||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
var vendingMachineSys = EntMan.System<VendingMachineSystem>();
|
||||||
var vendingMachineSys = entMan.System<VendingMachineSystem>();
|
|
||||||
|
|
||||||
_cachedInventory = vendingMachineSys.GetAllInventory(Owner.Owner);
|
_cachedInventory = vendingMachineSys.GetAllInventory(Owner);
|
||||||
|
|
||||||
_menu = new VendingMachineMenu {Title = entMan.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
_menu = new VendingMachineMenu { Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName };
|
||||||
|
|
||||||
_menu.OnClose += Close;
|
_menu.OnClose += Close;
|
||||||
_menu.OnItemSelected += OnItemSelected;
|
_menu.OnItemSelected += OnItemSelected;
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ namespace Content.Client.VoiceMask;
|
|||||||
|
|
||||||
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
|
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
public VoiceMaskBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
[ViewVariables]
|
||||||
|
private VoiceMaskNameChangeWindow? _window;
|
||||||
|
|
||||||
|
public VoiceMaskBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private VoiceMaskNameChangeWindow? _window;
|
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
{
|
{
|
||||||
base.Open();
|
base.Open();
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ namespace Content.Client.Weapons.Melee.UI;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class MeleeSpeechBoundUserInterface : BoundUserInterface
|
public sealed class MeleeSpeechBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private MeleeSpeechWindow? _window;
|
private MeleeSpeechWindow? _window;
|
||||||
|
|
||||||
public MeleeSpeechBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public MeleeSpeechBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,9 @@ public sealed class MeleeSpeechBoundUserInterface : BoundUserInterface
|
|||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
if (!disposing) return;
|
if (!disposing)
|
||||||
|
return;
|
||||||
|
|
||||||
_window?.Dispose();
|
_window?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
using Content.Shared.Wires;
|
using Content.Shared.Wires;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Client.Wires.UI
|
namespace Content.Client.Wires.UI
|
||||||
{
|
{
|
||||||
public sealed class WiresBoundUserInterface : BoundUserInterface
|
public sealed class WiresBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private WiresMenu? _menu;
|
private WiresMenu? _menu;
|
||||||
|
|
||||||
public WiresBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public WiresBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ namespace Content.Client.Xenoarchaeology.Ui;
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class AnalysisConsoleBoundUserInterface : BoundUserInterface
|
public sealed class AnalysisConsoleBoundUserInterface : BoundUserInterface
|
||||||
{
|
{
|
||||||
|
[ViewVariables]
|
||||||
private AnalysisConsoleMenu? _consoleMenu;
|
private AnalysisConsoleMenu? _consoleMenu;
|
||||||
|
|
||||||
public AnalysisConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
public AnalysisConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
|
|||||||
@@ -753,22 +753,26 @@ public abstract partial class InteractionTest
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CEntMan.TryGetComponent(target, out ClientUserInterfaceComponent? ui))
|
if (!CEntMan.TryGetComponent<ClientUserInterfaceComponent>(target, out var ui))
|
||||||
{
|
{
|
||||||
if (shouldSucceed)
|
if (shouldSucceed)
|
||||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have a bui component");
|
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have a bui component");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bui = ui.Interfaces.FirstOrDefault(x => x.UiKey.Equals(key));
|
if (!ui.OpenInterfaces.TryGetValue(key, out bui))
|
||||||
if (bui == null)
|
|
||||||
{
|
{
|
||||||
if (shouldSucceed)
|
if (shouldSucceed)
|
||||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have an open bui with key {key.GetType()}.{key}.");
|
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have an open bui with key {key.GetType()}.{key}.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bui2 = bui;
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(bui2.UiKey, Is.EqualTo(key), $"Bound user interface {bui2} is indexed by a key other than the one assigned to it somehow. {bui2.UiKey} != {key}");
|
||||||
Assert.That(shouldSucceed, Is.True);
|
Assert.That(shouldSucceed, Is.True);
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ namespace Content.Server.Access.Systems
|
|||||||
|
|
||||||
private void AfterUIOpen(EntityUid uid, AgentIDCardComponent component, AfterActivatableUIOpenEvent args)
|
private void AfterUIOpen(EntityUid uid, AgentIDCardComponent component, AfterActivatableUIOpenEvent args)
|
||||||
{
|
{
|
||||||
if (!_uiSystem.TryGetUi(component.Owner, AgentIDCardUiKey.Key, out var ui))
|
if (!_uiSystem.TryGetUi(uid, AgentIDCardUiKey.Key, out var ui))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<IdCardComponent>(uid, out var idCard))
|
if (!TryComp<IdCardComponent>(uid, out var idCard))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "");
|
var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "");
|
||||||
ui.SetState(state, args.Session);
|
UserInterfaceSystem.SetUiState(ui, state, args.Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args)
|
private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args)
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ namespace Content.Server.AirlockPainter
|
|||||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
DirtyUI(uid, component);
|
DirtyUI(uid, component);
|
||||||
component.Owner.GetUIOrNull(AirlockPainterUiKey.Key)?.Open(actor.PlayerSession);
|
|
||||||
|
if (_userInterfaceSystem.TryGetUi(uid, AirlockPainterUiKey.Key, out var bui))
|
||||||
|
_userInterfaceSystem.OpenUi(bui, actor.PlayerSession);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace Content.Server.Alert.Click
|
|||||||
{
|
{
|
||||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (entManager.TryGetComponent(player, out PilotComponent? pilotComponent) &&
|
if (entManager.TryGetComponent(player, out PilotComponent? pilotComponent)
|
||||||
pilotComponent.Console != null)
|
&& pilotComponent.Console != null)
|
||||||
{
|
{
|
||||||
entManager.System<ShuttleConsoleSystem>().RemovePilot(player, pilotComponent);
|
entManager.System<ShuttleConsoleSystem>().RemovePilot(player, pilotComponent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public sealed class AmeControllerSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var state = GetUiState(uid, controller);
|
var state = GetUiState(uid, controller);
|
||||||
_userInterfaceSystem.SetUiState(bui, state);
|
UserInterfaceSystem.SetUiState(bui, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AmeControllerBoundUserInterfaceState GetUiState(EntityUid uid, AmeControllerComponent controller)
|
private AmeControllerBoundUserInterfaceState GetUiState(EntityUid uid, AmeControllerComponent controller)
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Access.Systems;
|
|
||||||
using Content.Server.Cargo.Components;
|
using Content.Server.Cargo.Components;
|
||||||
using Content.Server.Labels.Components;
|
using Content.Server.Labels.Components;
|
||||||
using Content.Server.DeviceLinking.Systems;
|
|
||||||
using Content.Server.Popups;
|
|
||||||
using Content.Server.Station.Systems;
|
|
||||||
using Content.Shared.Access.Systems;
|
|
||||||
using Content.Shared.Administration.Logs;
|
|
||||||
using Content.Shared.Cargo;
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Cargo.BUI;
|
using Content.Shared.Cargo.BUI;
|
||||||
using Content.Shared.Cargo.Events;
|
using Content.Shared.Cargo.Events;
|
||||||
@@ -14,7 +8,6 @@ using Content.Shared.Cargo.Prototypes;
|
|||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Server.Paper;
|
using Content.Server.Paper;
|
||||||
using Content.Shared.Access.Components;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
@@ -49,7 +42,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
private void OnInit(EntityUid uid, CargoOrderConsoleComponent orderConsole, ComponentInit args)
|
private void OnInit(EntityUid uid, CargoOrderConsoleComponent orderConsole, ComponentInit args)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
UpdateOrderState(orderConsole, station);
|
UpdateOrderState(uid, station);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Reset(RoundRestartCleanupEvent ev)
|
private void Reset(RoundRestartCleanupEvent ev)
|
||||||
@@ -77,12 +70,13 @@ namespace Content.Server.Cargo.Systems
|
|||||||
account.Balance += account.IncreasePerSecond * Delay;
|
account.Balance += account.IncreasePerSecond * Delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var comp in EntityQuery<CargoOrderConsoleComponent>())
|
var query = EntityQueryEnumerator<CargoOrderConsoleComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var _))
|
||||||
{
|
{
|
||||||
if (!_uiSystem.IsUiOpen(comp.Owner, CargoConsoleUiKey.Orders)) continue;
|
if (!_uiSystem.IsUiOpen(uid, CargoConsoleUiKey.Orders)) continue;
|
||||||
|
|
||||||
var station = _station.GetOwningStation(comp.Owner);
|
var station = _station.GetOwningStation(uid);
|
||||||
UpdateOrderState(comp, station);
|
UpdateOrderState(uid, station);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,11 +95,10 @@ namespace Content.Server.Cargo.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var orderDatabase = GetOrderDatabase(component);
|
var bankAccount = GetBankAccount(uid, component);
|
||||||
var bankAccount = GetBankAccount(component);
|
|
||||||
|
|
||||||
// No station to deduct from.
|
// No station to deduct from.
|
||||||
if (orderDatabase == null || bankAccount == null)
|
if (!TryGetOrderDatabase(uid, out var dbUid, out var orderDatabase, component) || bankAccount == null)
|
||||||
{
|
{
|
||||||
ConsolePopup(args.Session, Loc.GetString("cargo-console-station-not-found"));
|
ConsolePopup(args.Session, Loc.GetString("cargo-console-station-not-found"));
|
||||||
PlayDenySound(uid, component);
|
PlayDenySound(uid, component);
|
||||||
@@ -113,7 +106,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find our order again. It might have been dispatched or approved already
|
// Find our order again. It might have been dispatched or approved already
|
||||||
var order = orderDatabase.Orders.Find(order => (args.OrderId == order.OrderId) && !order.Approved);
|
var order = orderDatabase.Orders.Find(order => args.OrderId == order.OrderId && !order.Approved);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -167,14 +160,15 @@ namespace Content.Server.Cargo.Systems
|
|||||||
$"{ToPrettyString(player):user} approved order [orderId:{order.OrderId}, quantity:{order.OrderQuantity}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}] with balance at {bankAccount.Balance}");
|
$"{ToPrettyString(player):user} approved order [orderId:{order.OrderId}, quantity:{order.OrderQuantity}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}] with balance at {bankAccount.Balance}");
|
||||||
|
|
||||||
DeductFunds(bankAccount, cost);
|
DeductFunds(bankAccount, cost);
|
||||||
UpdateOrders(orderDatabase);
|
UpdateOrders(dbUid!.Value, orderDatabase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleRemoveOrderMessage args)
|
private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleRemoveOrderMessage args)
|
||||||
{
|
{
|
||||||
var orderDatabase = GetOrderDatabase(component);
|
if (!TryGetOrderDatabase(uid, out var dbUid, out var orderDatabase, component))
|
||||||
if (orderDatabase == null) return;
|
return;
|
||||||
RemoveOrder(orderDatabase, args.OrderId);
|
|
||||||
|
RemoveOrder(dbUid!.Value, args.OrderId, orderDatabase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
|
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
|
||||||
@@ -185,12 +179,11 @@ namespace Content.Server.Cargo.Systems
|
|||||||
if (args.Amount <= 0)
|
if (args.Amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var bank = GetBankAccount(component);
|
var bank = GetBankAccount(uid, component);
|
||||||
if (bank == null)
|
if (bank == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var orderDatabase = GetOrderDatabase(component);
|
if (!TryGetOrderDatabase(uid, out var dbUid, out var orderDatabase, component))
|
||||||
if (orderDatabase == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_protoMan.TryIndex<CargoProductPrototype>(args.CargoProductId, out var product))
|
if (!_protoMan.TryIndex<CargoProductPrototype>(args.CargoProductId, out var product))
|
||||||
@@ -201,7 +194,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
var data = GetOrderData(args, product, GenerateOrderId(orderDatabase));
|
var data = GetOrderData(args, product, GenerateOrderId(orderDatabase));
|
||||||
|
|
||||||
if (!TryAddOrder(orderDatabase, data))
|
if (!TryAddOrder(dbUid!.Value, data, orderDatabase))
|
||||||
{
|
{
|
||||||
PlayDenySound(uid, component);
|
PlayDenySound(uid, component);
|
||||||
return;
|
return;
|
||||||
@@ -216,46 +209,50 @@ namespace Content.Server.Cargo.Systems
|
|||||||
private void OnOrderUIOpened(EntityUid uid, CargoOrderConsoleComponent component, BoundUIOpenedEvent args)
|
private void OnOrderUIOpened(EntityUid uid, CargoOrderConsoleComponent component, BoundUIOpenedEvent args)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
UpdateOrderState(component, station);
|
UpdateOrderState(uid, station);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void UpdateOrderState(CargoOrderConsoleComponent component, EntityUid? station)
|
private void UpdateOrderState(EntityUid consoleUid, EntityUid? station)
|
||||||
{
|
{
|
||||||
if (station == null ||
|
if (station == null ||
|
||||||
!TryComp<StationCargoOrderDatabaseComponent>(station, out var orderDatabase) ||
|
!TryComp<StationCargoOrderDatabaseComponent>(station, out var orderDatabase) ||
|
||||||
!TryComp<StationBankAccountComponent>(station, out var bankAccount)) return;
|
!TryComp<StationBankAccountComponent>(station, out var bankAccount)) return;
|
||||||
|
|
||||||
var state = new CargoConsoleInterfaceState(
|
if (_uiSystem.TryGetUi(consoleUid, CargoConsoleUiKey.Orders, out var bui))
|
||||||
|
UserInterfaceSystem.SetUiState(bui, new CargoConsoleInterfaceState(
|
||||||
MetaData(station.Value).EntityName,
|
MetaData(station.Value).EntityName,
|
||||||
GetOutstandingOrderCount(orderDatabase),
|
GetOutstandingOrderCount(orderDatabase),
|
||||||
orderDatabase.Capacity,
|
orderDatabase.Capacity,
|
||||||
bankAccount.Balance,
|
bankAccount.Balance,
|
||||||
orderDatabase.Orders);
|
orderDatabase.Orders
|
||||||
|
));
|
||||||
_uiSystem.GetUiOrNull(component.Owner, CargoConsoleUiKey.Orders)?.SetState(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConsolePopup(ICommonSession session, string text) => _popup.PopupCursor(text, session);
|
private void ConsolePopup(ICommonSession session, string text)
|
||||||
|
{
|
||||||
|
_popup.PopupCursor(text, session);
|
||||||
|
}
|
||||||
|
|
||||||
private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component)
|
private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component)
|
||||||
{
|
{
|
||||||
_audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid);
|
_audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id)
|
private static CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id)
|
||||||
{
|
{
|
||||||
return new CargoOrderData(id, cargoProduct.Product, cargoProduct.PointCost, args.Amount, args.Requester, args.Reason);
|
return new CargoOrderData(id, cargoProduct.Product, cargoProduct.PointCost, args.Amount, args.Requester, args.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component)
|
public static int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component)
|
||||||
{
|
{
|
||||||
var amount = 0;
|
var amount = 0;
|
||||||
|
|
||||||
foreach (var order in component.Orders)
|
foreach (var order in component.Orders)
|
||||||
{
|
{
|
||||||
if (!order.Approved) continue;
|
if (!order.Approved)
|
||||||
|
continue;
|
||||||
amount += order.OrderQuantity - order.NumDispatched;
|
amount += order.OrderQuantity - order.NumDispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,32 +263,41 @@ namespace Content.Server.Cargo.Systems
|
|||||||
/// Updates all of the cargo-related consoles for a particular station.
|
/// Updates all of the cargo-related consoles for a particular station.
|
||||||
/// This should be called whenever orders change.
|
/// This should be called whenever orders change.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateOrders(StationCargoOrderDatabaseComponent component)
|
private void UpdateOrders(EntityUid dbUid, StationCargoOrderDatabaseComponent _)
|
||||||
{
|
{
|
||||||
// Order added so all consoles need updating.
|
// Order added so all consoles need updating.
|
||||||
var orderQuery = AllEntityQuery<CargoOrderConsoleComponent>();
|
var orderQuery = AllEntityQuery<CargoOrderConsoleComponent>();
|
||||||
|
|
||||||
while (orderQuery.MoveNext(out var uid, out var comp))
|
while (orderQuery.MoveNext(out var uid, out var _))
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
if (station != component.Owner)
|
if (station != dbUid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UpdateOrderState(comp, station);
|
UpdateOrderState(uid, station);
|
||||||
}
|
}
|
||||||
|
|
||||||
var consoleQuery = AllEntityQuery<CargoShuttleConsoleComponent>();
|
var consoleQuery = AllEntityQuery<CargoShuttleConsoleComponent>();
|
||||||
while (consoleQuery.MoveNext(out var uid, out var comp))
|
while (consoleQuery.MoveNext(out var uid, out var _))
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
if (station != component.Owner)
|
if (station != dbUid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UpdateShuttleState(uid, station);
|
UpdateShuttleState(uid, station);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddAndApproveOrder(StationCargoOrderDatabaseComponent component, string spawnId, int cost, int qty, string sender, string description, string dest)
|
public bool AddAndApproveOrder(
|
||||||
|
EntityUid dbUid,
|
||||||
|
string spawnId,
|
||||||
|
int cost,
|
||||||
|
int qty,
|
||||||
|
string sender,
|
||||||
|
string description,
|
||||||
|
string dest,
|
||||||
|
StationCargoOrderDatabaseComponent component
|
||||||
|
)
|
||||||
{
|
{
|
||||||
DebugTools.Assert(_protoMan.HasIndex<EntityPrototype>(spawnId));
|
DebugTools.Assert(_protoMan.HasIndex<EntityPrototype>(spawnId));
|
||||||
// Make an order
|
// Make an order
|
||||||
@@ -306,31 +312,31 @@ namespace Content.Server.Cargo.Systems
|
|||||||
$"AddAndApproveOrder {description} added order [orderId:{order.OrderId}, quantity:{order.OrderQuantity}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}]");
|
$"AddAndApproveOrder {description} added order [orderId:{order.OrderId}, quantity:{order.OrderQuantity}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}]");
|
||||||
|
|
||||||
// Add it to the list
|
// Add it to the list
|
||||||
return TryAddOrder(component, order);
|
return TryAddOrder(dbUid, order, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryAddOrder(StationCargoOrderDatabaseComponent component, CargoOrderData data)
|
private bool TryAddOrder(EntityUid dbUid, CargoOrderData data, StationCargoOrderDatabaseComponent component)
|
||||||
{
|
{
|
||||||
component.Orders.Add(data);
|
component.Orders.Add(data);
|
||||||
UpdateOrders(component);
|
UpdateOrders(dbUid, component);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GenerateOrderId(StationCargoOrderDatabaseComponent orderDB)
|
private static int GenerateOrderId(StationCargoOrderDatabaseComponent orderDB)
|
||||||
{
|
{
|
||||||
// We need an arbitrary unique ID to identify orders, since they may
|
// We need an arbitrary unique ID to identify orders, since they may
|
||||||
// want to be cancelled later.
|
// want to be cancelled later.
|
||||||
return ++orderDB.NumOrdersCreated;
|
return ++orderDB.NumOrdersCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveOrder(StationCargoOrderDatabaseComponent orderDB, int index)
|
public void RemoveOrder(EntityUid dbUid, int index, StationCargoOrderDatabaseComponent orderDB)
|
||||||
{
|
{
|
||||||
var sequenceIdx = orderDB.Orders.FindIndex(order => order.OrderId == index);
|
var sequenceIdx = orderDB.Orders.FindIndex(order => order.OrderId == index);
|
||||||
if (sequenceIdx != -1)
|
if (sequenceIdx != -1)
|
||||||
{
|
{
|
||||||
orderDB.Orders.RemoveAt(sequenceIdx);
|
orderDB.Orders.RemoveAt(sequenceIdx);
|
||||||
}
|
}
|
||||||
UpdateOrders(orderDB);
|
UpdateOrders(dbUid, orderDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearOrders(StationCargoOrderDatabaseComponent component)
|
public void ClearOrders(StationCargoOrderDatabaseComponent component)
|
||||||
@@ -341,7 +347,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
Dirty(component);
|
Dirty(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [NotNullWhen(true)] out CargoOrderData? orderOut)
|
private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [NotNullWhen(true)] out CargoOrderData? orderOut)
|
||||||
{
|
{
|
||||||
var orderIdx = orderDB.Orders.FindIndex(order => order.Approved);
|
var orderIdx = orderDB.Orders.FindIndex(order => order.Approved);
|
||||||
if (orderIdx == -1)
|
if (orderIdx == -1)
|
||||||
@@ -375,7 +381,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
{
|
{
|
||||||
// fill in the order data
|
// fill in the order data
|
||||||
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", order.OrderId));
|
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", order.OrderId));
|
||||||
MetaData(printed).EntityName = val;
|
_metaSystem.SetEntityName(printed, val);
|
||||||
|
|
||||||
_paperSystem.SetContent(printed, Loc.GetString(
|
_paperSystem.SetContent(printed, Loc.GetString(
|
||||||
"cargo-console-paper-print-text",
|
"cargo-console-paper-print-text",
|
||||||
@@ -407,20 +413,18 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
#region Station
|
#region Station
|
||||||
|
|
||||||
private StationBankAccountComponent? GetBankAccount(CargoOrderConsoleComponent component)
|
private StationBankAccountComponent? GetBankAccount(EntityUid uid, CargoOrderConsoleComponent _)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(component.Owner);
|
var station = _station.GetOwningStation(uid);
|
||||||
|
|
||||||
TryComp<StationBankAccountComponent>(station, out var bankComponent);
|
TryComp<StationBankAccountComponent>(station, out var bankComponent);
|
||||||
return bankComponent;
|
return bankComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private StationCargoOrderDatabaseComponent? GetOrderDatabase(CargoOrderConsoleComponent component)
|
private bool TryGetOrderDatabase(EntityUid uid, [MaybeNullWhen(false)] out EntityUid? dbUid, [MaybeNullWhen(false)] out StationCargoOrderDatabaseComponent dbComp, CargoOrderConsoleComponent _)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(component.Owner);
|
dbUid = _station.GetOwningStation(uid);
|
||||||
|
return TryComp(dbUid, out dbComp);
|
||||||
TryComp<StationCargoOrderDatabaseComponent>(station, out var orderComponent);
|
|
||||||
return orderComponent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ using System.Linq;
|
|||||||
using Content.Server.Cargo.Components;
|
using Content.Server.Cargo.Components;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Shuttles.Events;
|
using Content.Server.Shuttles.Events;
|
||||||
using Content.Server.Shuttles.Systems;
|
|
||||||
using Content.Server.Stack;
|
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Cargo;
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Cargo.BUI;
|
using Content.Shared.Cargo.BUI;
|
||||||
@@ -12,15 +10,13 @@ using Content.Shared.Cargo.Events;
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Robust.Shared.Containers;
|
|
||||||
|
|
||||||
namespace Content.Server.Cargo.Systems;
|
namespace Content.Server.Cargo.Systems;
|
||||||
|
|
||||||
@@ -73,7 +69,7 @@ public sealed partial class CargoSystem
|
|||||||
|
|
||||||
#region Console
|
#region Console
|
||||||
|
|
||||||
private void UpdateCargoShuttleConsoles(EntityUid shuttleUid, CargoShuttleComponent component)
|
private void UpdateCargoShuttleConsoles(EntityUid shuttleUid, CargoShuttleComponent _)
|
||||||
{
|
{
|
||||||
// Update pilot consoles that are already open.
|
// Update pilot consoles that are already open.
|
||||||
_console.RefreshDroneConsoles();
|
_console.RefreshDroneConsoles();
|
||||||
@@ -81,7 +77,7 @@ public sealed partial class CargoSystem
|
|||||||
// Update order consoles.
|
// Update order consoles.
|
||||||
var shuttleConsoleQuery = AllEntityQuery<CargoShuttleConsoleComponent>();
|
var shuttleConsoleQuery = AllEntityQuery<CargoShuttleConsoleComponent>();
|
||||||
|
|
||||||
while (shuttleConsoleQuery.MoveNext(out var uid, out _))
|
while (shuttleConsoleQuery.MoveNext(out var uid, out var _))
|
||||||
{
|
{
|
||||||
var stationUid = _station.GetOwningStation(uid);
|
var stationUid = _station.GetOwningStation(uid);
|
||||||
if (stationUid != shuttleUid)
|
if (stationUid != shuttleUid)
|
||||||
@@ -96,12 +92,12 @@ public sealed partial class CargoSystem
|
|||||||
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
|
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
|
||||||
if (Transform(uid).GridUid is not EntityUid gridUid)
|
if (Transform(uid).GridUid is not EntityUid gridUid)
|
||||||
{
|
{
|
||||||
_uiSystem.SetUiState(bui,
|
UserInterfaceSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState(0, 0, false));
|
new CargoPalletConsoleInterfaceState(0, 0, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GetPalletGoods(gridUid, out var toSell, out var amount);
|
GetPalletGoods(gridUid, out var toSell, out var amount);
|
||||||
_uiSystem.SetUiState(bui,
|
UserInterfaceSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true));
|
new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,11 +143,12 @@ public sealed partial class CargoSystem
|
|||||||
var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle);
|
var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle);
|
||||||
var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty;
|
var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty;
|
||||||
|
|
||||||
_uiSystem.GetUiOrNull(uid, CargoConsoleUiKey.Shuttle)?.SetState(
|
if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui))
|
||||||
new CargoShuttleConsoleBoundUserInterfaceState(
|
UserInterfaceSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState(
|
||||||
station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"),
|
station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"),
|
||||||
string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName,
|
string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName,
|
||||||
orders));
|
orders
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -328,7 +325,7 @@ public sealed partial class CargoSystem
|
|||||||
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
|
var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
|
||||||
if (Transform(uid).GridUid is not EntityUid gridUid)
|
if (Transform(uid).GridUid is not EntityUid gridUid)
|
||||||
{
|
{
|
||||||
_uiSystem.SetUiState(bui,
|
UserInterfaceSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState(0, 0, false));
|
new CargoPalletConsoleInterfaceState(0, 0, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -352,7 +349,7 @@ public sealed partial class CargoSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddCargoContents(uid, component, orderDatabase);
|
AddCargoContents(uid, component, orderDatabase);
|
||||||
UpdateOrders(orderDatabase);
|
UpdateOrders(stationUid!.Value, orderDatabase);
|
||||||
UpdateCargoShuttleConsoles(uid, component);
|
UpdateCargoShuttleConsoles(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +394,7 @@ public sealed partial class CargoSystem
|
|||||||
// Shuttle may not have been in the cargo dimension (e.g. on the station map) so need to delete.
|
// Shuttle may not have been in the cargo dimension (e.g. on the station map) so need to delete.
|
||||||
var query = AllEntityQuery<CargoShuttleComponent>();
|
var query = AllEntityQuery<CargoShuttleComponent>();
|
||||||
|
|
||||||
while (query.MoveNext(out var uid, out var comp))
|
while (query.MoveNext(out var uid, out var _))
|
||||||
{
|
{
|
||||||
if (TryComp<StationCargoOrderDatabaseComponent>(uid, out var station))
|
if (TryComp<StationCargoOrderDatabaseComponent>(uid, out var station))
|
||||||
{
|
{
|
||||||
@@ -427,7 +424,7 @@ public sealed partial class CargoSystem
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaData(mapUid).EntityName = $"Trading post {_random.Next(1000):000}";
|
_metaSystem.SetEntityName(mapUid, $"Trading post {_random.Next(1000):000}");
|
||||||
|
|
||||||
_console.RefreshShuttleConsoles();
|
_console.RefreshShuttleConsoles();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public sealed partial class CargoSystem
|
|||||||
if (FulfillOrder(orderDatabase, xform.Coordinates, comp.PrinterOutput))
|
if (FulfillOrder(orderDatabase, xform.Coordinates, comp.PrinterOutput))
|
||||||
{
|
{
|
||||||
_audio.PlayPvs(_audio.GetSound(comp.TeleportSound), uid, AudioParams.Default.WithVolume(-8f));
|
_audio.PlayPvs(_audio.GetSound(comp.TeleportSound), uid, AudioParams.Default.WithVolume(-8f));
|
||||||
UpdateOrders(orderDatabase);
|
UpdateOrders(station!.Value, orderDatabase);
|
||||||
|
|
||||||
comp.CurrentState = CargoTelepadState.Teleporting;
|
comp.CurrentState = CargoTelepadState.Teleporting;
|
||||||
_appearance.SetData(uid, CargoTelepadVisuals.State, CargoTelepadState.Teleporting, appearance);
|
_appearance.SetData(uid, CargoTelepadVisuals.State, CargoTelepadState.Teleporting, appearance);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
|||||||
[Dependency] private readonly StackSystem _stack = default!;
|
[Dependency] private readonly StackSystem _stack = default!;
|
||||||
[Dependency] private readonly StationSystem _station = default!;
|
[Dependency] private readonly StationSystem _station = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
|
|
||||||
private ISawmill _sawmill = default!;
|
private ISawmill _sawmill = default!;
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
|||||||
component.Balance += balanceAdded;
|
component.Balance += balanceAdded;
|
||||||
var query = EntityQueryEnumerator<CargoOrderConsoleComponent>();
|
var query = EntityQueryEnumerator<CargoOrderConsoleComponent>();
|
||||||
|
|
||||||
while (query.MoveNext(out var oUid, out var oComp))
|
while (query.MoveNext(out var oUid, out var _))
|
||||||
{
|
{
|
||||||
if (!_uiSystem.IsUiOpen(oUid, CargoConsoleUiKey.Orders))
|
if (!_uiSystem.IsUiOpen(oUid, CargoConsoleUiKey.Orders))
|
||||||
continue;
|
continue;
|
||||||
@@ -85,7 +86,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
|||||||
if (station != uid)
|
if (station != uid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UpdateOrderState(oComp, station);
|
UpdateOrderState(oUid, station);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
|
|||||||
state.ActiveUI = loader.ActiveProgram;
|
state.ActiveUI = loader.ActiveProgram;
|
||||||
state.Programs = GetAvailablePrograms(loaderUid, loader);
|
state.Programs = GetAvailablePrograms(loaderUid, loader);
|
||||||
|
|
||||||
var ui = _userInterfaceSystem.GetUiOrNull(loader.Owner, loader.UiKey);
|
if (_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui))
|
||||||
if (ui != null)
|
UserInterfaceSystem.SetUiState(ui, state, session);
|
||||||
_userInterfaceSystem.SetUiState(ui, state, session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,9 +64,8 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
|
|||||||
if (!Resolve(loaderUid, ref loader))
|
if (!Resolve(loaderUid, ref loader))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ui = _userInterfaceSystem.GetUiOrNull(loader.Owner, loader.UiKey);
|
if (_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui))
|
||||||
if (ui != null)
|
UserInterfaceSystem.SetUiState(ui, state, session);
|
||||||
_userInterfaceSystem.SetUiState(ui, state, session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -306,7 +304,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
|
|||||||
RaiseLocalEvent(component.ActiveProgram.Value, new CartridgeUiReadyEvent(loaderUid));
|
RaiseLocalEvent(component.ActiveProgram.Value, new CartridgeUiReadyEvent(loaderUid));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException($"Unrecognized UI action passed from cartridge loader ui {message.Action}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +377,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ContainsCartridge(EntityUid cartridgeUid, CartridgeLoaderComponent loader , bool onlyInstalled = false)
|
private static bool ContainsCartridge(EntityUid cartridgeUid, CartridgeLoaderComponent loader, bool onlyInstalled = false)
|
||||||
{
|
{
|
||||||
return !onlyInstalled && loader.CartridgeSlot.Item?.Equals(cartridgeUid) == true || loader.InstalledPrograms.Contains(cartridgeUid);
|
return !onlyInstalled && loader.CartridgeSlot.Item?.Equals(cartridgeUid) == true || loader.InstalledPrograms.Contains(cartridgeUid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Medical.Components;
|
using Content.Server.Medical.Components;
|
||||||
using Content.Server.Cloning.Components;
|
using Content.Server.Cloning.Components;
|
||||||
using Content.Server.DeviceLinking.Events;
|
|
||||||
using Content.Server.DeviceLinking.Systems;
|
using Content.Server.DeviceLinking.Systems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
@@ -62,12 +60,12 @@ namespace Content.Server.Cloning
|
|||||||
TryClone(uid, consoleComponent.CloningPod.Value, consoleComponent.GeneticScanner.Value, consoleComponent: consoleComponent);
|
TryClone(uid, consoleComponent.CloningPod.Value, consoleComponent.GeneticScanner.Value, consoleComponent: consoleComponent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
UpdateUserInterface(consoleComponent);
|
UpdateUserInterface(uid, consoleComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPowerChanged(EntityUid uid, CloningConsoleComponent component, ref PowerChangedEvent args)
|
private void OnPowerChanged(EntityUid uid, CloningConsoleComponent component, ref PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
UpdateUserInterface(component);
|
UpdateUserInterface(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMapInit(EntityUid uid, CloningConsoleComponent component, MapInitEvent args)
|
private void OnMapInit(EntityUid uid, CloningConsoleComponent component, MapInitEvent args)
|
||||||
@@ -115,12 +113,12 @@ namespace Content.Server.Cloning
|
|||||||
if (args.Port == CloningConsoleComponent.PodPort)
|
if (args.Port == CloningConsoleComponent.PodPort)
|
||||||
component.CloningPod = null;
|
component.CloningPod = null;
|
||||||
|
|
||||||
UpdateUserInterface(component);
|
UpdateUserInterface(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUIOpen(EntityUid uid, CloningConsoleComponent component, AfterActivatableUIOpenEvent args)
|
private void OnUIOpen(EntityUid uid, CloningConsoleComponent component, AfterActivatableUIOpenEvent args)
|
||||||
{
|
{
|
||||||
UpdateUserInterface(component);
|
UpdateUserInterface(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAnchorChanged(EntityUid uid, CloningConsoleComponent component, ref AnchorStateChangedEvent args)
|
private void OnAnchorChanged(EntityUid uid, CloningConsoleComponent component, ref AnchorStateChangedEvent args)
|
||||||
@@ -130,22 +128,22 @@ namespace Content.Server.Cloning
|
|||||||
RecheckConnections(uid, component.CloningPod, component.GeneticScanner, component);
|
RecheckConnections(uid, component.CloningPod, component.GeneticScanner, component);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UpdateUserInterface(component);
|
UpdateUserInterface(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateUserInterface(CloningConsoleComponent consoleComponent)
|
public void UpdateUserInterface(EntityUid consoleUid, CloningConsoleComponent consoleComponent)
|
||||||
{
|
{
|
||||||
var ui = _uiSystem.GetUiOrNull(consoleComponent.Owner, CloningConsoleUiKey.Key);
|
if (!_uiSystem.TryGetUi(consoleUid, CloningConsoleUiKey.Key, out var ui))
|
||||||
if (ui == null)
|
|
||||||
return;
|
return;
|
||||||
if (!_powerReceiverSystem.IsPowered(consoleComponent.Owner))
|
|
||||||
|
if (!_powerReceiverSystem.IsPowered(consoleUid))
|
||||||
{
|
{
|
||||||
_uiSystem.CloseAll(ui);
|
_uiSystem.CloseAll(ui);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newState = GetUserInterfaceState(consoleComponent);
|
var newState = GetUserInterfaceState(consoleComponent);
|
||||||
_uiSystem.SetUiState(ui, newState);
|
UserInterfaceSystem.SetUiState(ui, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TryClone(EntityUid uid, EntityUid cloningPodUid, EntityUid scannerUid, CloningPodComponent? cloningPod = null, MedicalScannerComponent? scannerComp = null, CloningConsoleComponent? consoleComponent = null)
|
public void TryClone(EntityUid uid, EntityUid cloningPodUid, EntityUid scannerUid, CloningPodComponent? cloningPod = null, MedicalScannerComponent? scannerComp = null, CloningConsoleComponent? consoleComponent = null)
|
||||||
@@ -192,7 +190,7 @@ namespace Content.Server.Cloning
|
|||||||
consoleComp.CloningPodInRange = podDistance <= consoleComp.MaxDistance;
|
consoleComp.CloningPodInRange = podDistance <= consoleComp.MaxDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUserInterface(consoleComp);
|
UpdateUserInterface(console, consoleComp);
|
||||||
}
|
}
|
||||||
private CloningConsoleBoundUserInterfaceState GetUserInterfaceState(CloningConsoleComponent consoleComponent)
|
private CloningConsoleBoundUserInterfaceState GetUserInterfaceState(CloningConsoleComponent consoleComponent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ using Robust.Shared.Random;
|
|||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Content.Shared.Humanoid;
|
|
||||||
using Content.Shared.Doors.Components;
|
using Content.Shared.Doors.Components;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -66,6 +65,7 @@ namespace Content.Server.Cloning
|
|||||||
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||||
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
|
|
||||||
public readonly Dictionary<Mind.Mind, EntityUid> ClonesWaitingForMind = new();
|
public readonly Dictionary<Mind.Mind, EntityUid> ClonesWaitingForMind = new();
|
||||||
public const float EasyModeCloningCost = 0.7f;
|
public const float EasyModeCloningCost = 0.7f;
|
||||||
@@ -87,7 +87,7 @@ namespace Content.Server.Cloning
|
|||||||
|
|
||||||
private void OnComponentInit(EntityUid uid, CloningPodComponent clonePod, ComponentInit args)
|
private void OnComponentInit(EntityUid uid, CloningPodComponent clonePod, ComponentInit args)
|
||||||
{
|
{
|
||||||
clonePod.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(clonePod.Owner, "clonepod-bodyContainer");
|
clonePod.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "clonepod-bodyContainer");
|
||||||
_signalSystem.EnsureSinkPorts(uid, CloningPodComponent.PodPort);
|
_signalSystem.EnsureSinkPorts(uid, CloningPodComponent.PodPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +124,12 @@ namespace Content.Server.Cloning
|
|||||||
if (clonedComponent.Parent == EntityUid.Invalid ||
|
if (clonedComponent.Parent == EntityUid.Invalid ||
|
||||||
!EntityManager.EntityExists(clonedComponent.Parent) ||
|
!EntityManager.EntityExists(clonedComponent.Parent) ||
|
||||||
!TryComp<CloningPodComponent>(clonedComponent.Parent, out var cloningPodComponent) ||
|
!TryComp<CloningPodComponent>(clonedComponent.Parent, out var cloningPodComponent) ||
|
||||||
clonedComponent.Owner != cloningPodComponent.BodyContainer.ContainedEntity)
|
uid != cloningPodComponent.BodyContainer.ContainedEntity)
|
||||||
{
|
{
|
||||||
EntityManager.RemoveComponent<BeingClonedComponent>(clonedComponent.Owner);
|
EntityManager.RemoveComponent<BeingClonedComponent>(uid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UpdateStatus(CloningPodStatus.Cloning, cloningPodComponent);
|
UpdateStatus(clonedComponent.Parent, CloningPodStatus.Cloning, cloningPodComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPortDisconnected(EntityUid uid, CloningPodComponent pod, PortDisconnectedEvent args)
|
private void OnPortDisconnected(EntityUid uid, CloningPodComponent pod, PortDisconnectedEvent args)
|
||||||
@@ -147,7 +147,7 @@ namespace Content.Server.Cloning
|
|||||||
_cloningConsoleSystem.RecheckConnections(component.ConnectedConsole.Value, uid, console.GeneticScanner, console);
|
_cloningConsoleSystem.RecheckConnections(component.ConnectedConsole.Value, uid, console.GeneticScanner, console);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_cloningConsoleSystem.UpdateUserInterface(console);
|
_cloningConsoleSystem.UpdateUserInterface(component.ConnectedConsole.Value, console);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, CloningPodComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, CloningPodComponent component, ExaminedEvent args)
|
||||||
@@ -230,11 +230,11 @@ namespace Content.Server.Cloning
|
|||||||
chance *= failChanceModifier;
|
chance *= failChanceModifier;
|
||||||
|
|
||||||
if (cellularDmg > 0 && clonePod.ConnectedConsole != null)
|
if (cellularDmg > 0 && clonePod.ConnectedConsole != null)
|
||||||
_chatSystem.TrySendInGameICMessage(clonePod.ConnectedConsole.Value, Loc.GetString("cloning-console-cellular-warning", ("percent", Math.Round(100 - (chance * 100)))), InGameICChatType.Speak, false);
|
_chatSystem.TrySendInGameICMessage(clonePod.ConnectedConsole.Value, Loc.GetString("cloning-console-cellular-warning", ("percent", Math.Round(100 - chance * 100))), InGameICChatType.Speak, false);
|
||||||
|
|
||||||
if (_robustRandom.Prob(chance))
|
if (_robustRandom.Prob(chance))
|
||||||
{
|
{
|
||||||
UpdateStatus(CloningPodStatus.Gore, clonePod);
|
UpdateStatus(uid, CloningPodStatus.Gore, clonePod);
|
||||||
clonePod.FailedClone = true;
|
clonePod.FailedClone = true;
|
||||||
AddComp<ActiveCloningPodComponent>(uid);
|
AddComp<ActiveCloningPodComponent>(uid);
|
||||||
return true;
|
return true;
|
||||||
@@ -242,21 +242,21 @@ namespace Content.Server.Cloning
|
|||||||
}
|
}
|
||||||
// end of genetic damage checks
|
// end of genetic damage checks
|
||||||
|
|
||||||
var mob = Spawn(speciesPrototype.Prototype, Transform(clonePod.Owner).MapPosition);
|
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
|
||||||
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
||||||
|
|
||||||
var ev = new CloningEvent(bodyToClone, mob);
|
var ev = new CloningEvent(bodyToClone, mob);
|
||||||
RaiseLocalEvent(bodyToClone, ref ev);
|
RaiseLocalEvent(bodyToClone, ref ev);
|
||||||
|
|
||||||
if (!ev.NameHandled)
|
if (!ev.NameHandled)
|
||||||
MetaData(mob).EntityName = MetaData(bodyToClone).EntityName;
|
_metaSystem.SetEntityName(mob, MetaData(bodyToClone).EntityName);
|
||||||
|
|
||||||
var cloneMindReturn = EntityManager.AddComponent<BeingClonedComponent>(mob);
|
var cloneMindReturn = EntityManager.AddComponent<BeingClonedComponent>(mob);
|
||||||
cloneMindReturn.Mind = mind;
|
cloneMindReturn.Mind = mind;
|
||||||
cloneMindReturn.Parent = clonePod.Owner;
|
cloneMindReturn.Parent = uid;
|
||||||
clonePod.BodyContainer.Insert(mob);
|
clonePod.BodyContainer.Insert(mob);
|
||||||
ClonesWaitingForMind.Add(mind, mob);
|
ClonesWaitingForMind.Add(mind, mob);
|
||||||
UpdateStatus(CloningPodStatus.NoMind, clonePod);
|
UpdateStatus(uid, CloningPodStatus.NoMind, clonePod);
|
||||||
_euiManager.OpenEui(new AcceptCloningEui(mind, this), client);
|
_euiManager.OpenEui(new AcceptCloningEui(mind, this), client);
|
||||||
|
|
||||||
AddComp<ActiveCloningPodComponent>(uid);
|
AddComp<ActiveCloningPodComponent>(uid);
|
||||||
@@ -276,17 +276,18 @@ namespace Content.Server.Cloning
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateStatus(CloningPodStatus status, CloningPodComponent cloningPod)
|
public void UpdateStatus(EntityUid podUid, CloningPodStatus status, CloningPodComponent cloningPod)
|
||||||
{
|
{
|
||||||
cloningPod.Status = status;
|
cloningPod.Status = status;
|
||||||
_appearance.SetData(cloningPod.Owner, CloningPodVisuals.Status, cloningPod.Status);
|
_appearance.SetData(podUid, CloningPodVisuals.Status, cloningPod.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
foreach (var (_, cloning) in EntityManager.EntityQuery<ActiveCloningPodComponent, CloningPodComponent>())
|
var query = EntityQueryEnumerator<ActiveCloningPodComponent, CloningPodComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var _, out var cloning))
|
||||||
{
|
{
|
||||||
if (!_powerReceiverSystem.IsPowered(cloning.Owner))
|
if (!_powerReceiverSystem.IsPowered(uid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cloning.BodyContainer.ContainedEntity == null && !cloning.FailedClone)
|
if (cloning.BodyContainer.ContainedEntity == null && !cloning.FailedClone)
|
||||||
@@ -297,9 +298,9 @@ namespace Content.Server.Cloning
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (cloning.FailedClone)
|
if (cloning.FailedClone)
|
||||||
EndFailedCloning(cloning.Owner, cloning);
|
EndFailedCloning(uid, cloning);
|
||||||
else
|
else
|
||||||
Eject(cloning.Owner, cloning);
|
Eject(uid, cloning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +329,7 @@ namespace Content.Server.Cloning
|
|||||||
clonePod.BodyContainer.Remove(entity);
|
clonePod.BodyContainer.Remove(entity);
|
||||||
clonePod.CloningProgress = 0f;
|
clonePod.CloningProgress = 0f;
|
||||||
clonePod.UsedBiomass = 0;
|
clonePod.UsedBiomass = 0;
|
||||||
UpdateStatus(CloningPodStatus.Idle, clonePod);
|
UpdateStatus(uid, CloningPodStatus.Idle, clonePod);
|
||||||
RemCompDeferred<ActiveCloningPodComponent>(uid);
|
RemCompDeferred<ActiveCloningPodComponent>(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +337,7 @@ namespace Content.Server.Cloning
|
|||||||
{
|
{
|
||||||
clonePod.FailedClone = false;
|
clonePod.FailedClone = false;
|
||||||
clonePod.CloningProgress = 0f;
|
clonePod.CloningProgress = 0f;
|
||||||
UpdateStatus(CloningPodStatus.Idle, clonePod);
|
UpdateStatus(uid, CloningPodStatus.Idle, clonePod);
|
||||||
var transform = Transform(uid);
|
var transform = Transform(uid);
|
||||||
var indices = _transformSystem.GetGridOrMapTilePosition(uid);
|
var indices = _transformSystem.GetGridOrMapTilePosition(uid);
|
||||||
|
|
||||||
@@ -350,7 +351,7 @@ namespace Content.Server.Cloning
|
|||||||
|
|
||||||
Solution bloodSolution = new();
|
Solution bloodSolution = new();
|
||||||
|
|
||||||
int i = 0;
|
var i = 0;
|
||||||
while (i < 1)
|
while (i < 1)
|
||||||
{
|
{
|
||||||
tileMix?.AdjustMoles(Gas.Miasma, 6f);
|
tileMix?.AdjustMoles(Gas.Miasma, 6f);
|
||||||
@@ -386,7 +387,8 @@ namespace Content.Server.Cloning
|
|||||||
public readonly EntityUid Source;
|
public readonly EntityUid Source;
|
||||||
public readonly EntityUid Target;
|
public readonly EntityUid Target;
|
||||||
|
|
||||||
public CloningEvent(EntityUid source, EntityUid target) {
|
public CloningEvent(EntityUid source, EntityUid target)
|
||||||
|
{
|
||||||
Source = source;
|
Source = source;
|
||||||
Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace Content.Server.Communications
|
|||||||
[Dependency] private readonly StationSystem _stationSystem = default!;
|
[Dependency] private readonly StationSystem _stationSystem = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
|
|
||||||
private const int MaxMessageLength = 256;
|
private const int MaxMessageLength = 256;
|
||||||
private const int MaxMessageNewlines = 2;
|
private const int MaxMessageNewlines = 2;
|
||||||
@@ -46,7 +47,7 @@ namespace Content.Server.Communications
|
|||||||
{
|
{
|
||||||
// All events that refresh the BUI
|
// All events that refresh the BUI
|
||||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||||
SubscribeLocalEvent<CommunicationsConsoleComponent, ComponentInit>((_, comp, _) => UpdateCommsConsoleInterface(comp));
|
SubscribeLocalEvent<CommunicationsConsoleComponent, ComponentInit>((uid, comp, _) => UpdateCommsConsoleInterface(uid, comp));
|
||||||
SubscribeLocalEvent<RoundEndSystemChangedEvent>(_ => OnGenericBroadcastEvent());
|
SubscribeLocalEvent<RoundEndSystemChangedEvent>(_ => OnGenericBroadcastEvent());
|
||||||
SubscribeLocalEvent<AlertLevelDelayFinishedEvent>(_ => OnGenericBroadcastEvent());
|
SubscribeLocalEvent<AlertLevelDelayFinishedEvent>(_ => OnGenericBroadcastEvent());
|
||||||
|
|
||||||
@@ -59,7 +60,8 @@ namespace Content.Server.Communications
|
|||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
foreach (var comp in EntityQuery<CommunicationsConsoleComponent>())
|
var query = EntityQueryEnumerator<CommunicationsConsoleComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var comp))
|
||||||
{
|
{
|
||||||
// TODO refresh the UI in a less horrible way
|
// TODO refresh the UI in a less horrible way
|
||||||
if (comp.AnnouncementCooldownRemaining >= 0f)
|
if (comp.AnnouncementCooldownRemaining >= 0f)
|
||||||
@@ -75,7 +77,7 @@ namespace Content.Server.Communications
|
|||||||
comp.UIUpdateAccumulator -= UIUpdateInterval;
|
comp.UIUpdateAccumulator -= UIUpdateInterval;
|
||||||
|
|
||||||
if (comp.UserInterface is { } ui && ui.SubscribedSessions.Count > 0)
|
if (comp.UserInterface is { } ui && ui.SubscribedSessions.Count > 0)
|
||||||
UpdateCommsConsoleInterface(comp);
|
UpdateCommsConsoleInterface(uid, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
@@ -86,9 +88,10 @@ namespace Content.Server.Communications
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnGenericBroadcastEvent()
|
private void OnGenericBroadcastEvent()
|
||||||
{
|
{
|
||||||
foreach (var comp in EntityQuery<CommunicationsConsoleComponent>())
|
var query = EntityQueryEnumerator<CommunicationsConsoleComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var comp))
|
||||||
{
|
{
|
||||||
UpdateCommsConsoleInterface(comp);
|
UpdateCommsConsoleInterface(uid, comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,13 +101,12 @@ namespace Content.Server.Communications
|
|||||||
/// <param name="args">Alert level changed event arguments</param>
|
/// <param name="args">Alert level changed event arguments</param>
|
||||||
private void OnAlertLevelChanged(AlertLevelChangedEvent args)
|
private void OnAlertLevelChanged(AlertLevelChangedEvent args)
|
||||||
{
|
{
|
||||||
foreach (var comp in EntityQuery<CommunicationsConsoleComponent>(true))
|
var query = EntityQueryEnumerator<CommunicationsConsoleComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var comp))
|
||||||
{
|
{
|
||||||
var entStation = _stationSystem.GetOwningStation(comp.Owner);
|
var entStation = _stationSystem.GetOwningStation(uid);
|
||||||
if (args.Station == entStation)
|
if (args.Station == entStation)
|
||||||
{
|
UpdateCommsConsoleInterface(uid, comp);
|
||||||
UpdateCommsConsoleInterface(comp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,9 +115,10 @@ namespace Content.Server.Communications
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateCommsConsoleInterface()
|
public void UpdateCommsConsoleInterface()
|
||||||
{
|
{
|
||||||
foreach (var comp in EntityQuery<CommunicationsConsoleComponent>())
|
var query = EntityQueryEnumerator<CommunicationsConsoleComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var comp))
|
||||||
{
|
{
|
||||||
UpdateCommsConsoleInterface(comp);
|
UpdateCommsConsoleInterface(uid, comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,10 +126,8 @@ namespace Content.Server.Communications
|
|||||||
/// Updates the UI for a particular comms console.
|
/// Updates the UI for a particular comms console.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="comp"></param>
|
/// <param name="comp"></param>
|
||||||
public void UpdateCommsConsoleInterface(CommunicationsConsoleComponent comp)
|
public void UpdateCommsConsoleInterface(EntityUid uid, CommunicationsConsoleComponent comp)
|
||||||
{
|
{
|
||||||
var uid = comp.Owner;
|
|
||||||
|
|
||||||
var stationUid = _stationSystem.GetOwningStation(uid);
|
var stationUid = _stationSystem.GetOwningStation(uid);
|
||||||
List<string>? levels = null;
|
List<string>? levels = null;
|
||||||
string currentLevel = default!;
|
string currentLevel = default!;
|
||||||
@@ -154,19 +155,18 @@ namespace Content.Server.Communications
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
comp.UserInterface?.SetState(
|
if (comp.UserInterface is not null)
|
||||||
new CommunicationsConsoleInterfaceState(
|
UserInterfaceSystem.SetUiState(comp.UserInterface, new CommunicationsConsoleInterfaceState(
|
||||||
CanAnnounce(comp),
|
CanAnnounce(comp),
|
||||||
CanCallOrRecall(comp),
|
CanCallOrRecall(comp),
|
||||||
levels,
|
levels,
|
||||||
currentLevel,
|
currentLevel,
|
||||||
currentDelay,
|
currentDelay,
|
||||||
_roundEndSystem.ExpectedCountdownEnd
|
_roundEndSystem.ExpectedCountdownEnd
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanAnnounce(CommunicationsConsoleComponent comp)
|
private static bool CanAnnounce(CommunicationsConsoleComponent comp)
|
||||||
{
|
{
|
||||||
return comp.AnnouncementCooldownRemaining <= 0f;
|
return comp.AnnouncementCooldownRemaining <= 0f;
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,8 @@ namespace Content.Server.Communications
|
|||||||
private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent comp,
|
private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent comp,
|
||||||
CommunicationsConsoleAnnounceMessage message)
|
CommunicationsConsoleAnnounceMessage message)
|
||||||
{
|
{
|
||||||
var msgChars = (message.Message.Length <= MaxMessageLength ? message.Message.Trim() : $"{message.Message.Trim().Substring(0, MaxMessageLength)}...").ToCharArray();
|
var msgWords = message.Message.Trim();
|
||||||
|
var msgChars = (msgWords.Length <= MaxMessageLength ? msgWords : $"{msgWords[0..MaxMessageLength]}...").ToCharArray();
|
||||||
|
|
||||||
var newlines = 0;
|
var newlines = 0;
|
||||||
for (var i = 0; i < msgChars.Length; i++)
|
for (var i = 0; i < msgChars.Length; i++)
|
||||||
@@ -260,7 +261,7 @@ namespace Content.Server.Communications
|
|||||||
}
|
}
|
||||||
|
|
||||||
comp.AnnouncementCooldownRemaining = comp.DelayBetweenAnnouncements;
|
comp.AnnouncementCooldownRemaining = comp.DelayBetweenAnnouncements;
|
||||||
UpdateCommsConsoleInterface(comp);
|
UpdateCommsConsoleInterface(uid, comp);
|
||||||
|
|
||||||
// allow admemes with vv
|
// allow admemes with vv
|
||||||
Loc.TryGetString(comp.AnnouncementDisplayName, out var title);
|
Loc.TryGetString(comp.AnnouncementDisplayName, out var title);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public sealed class ConfigurationSystem : EntitySystem
|
|||||||
private void UpdateUi(EntityUid uid, ConfigurationComponent component)
|
private void UpdateUi(EntityUid uid, ConfigurationComponent component)
|
||||||
{
|
{
|
||||||
if (_uiSystem.TryGetUi(uid, ConfigurationUiKey.Key, out var ui))
|
if (_uiSystem.TryGetUi(uid, ConfigurationUiKey.Key, out var ui))
|
||||||
ui.SetState(new ConfigurationBoundUserInterfaceState(component.Config));
|
UserInterfaceSystem.SetUiState(ui, new ConfigurationBoundUserInterfaceState(component.Config));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUpdate(EntityUid uid, ConfigurationComponent component, ConfigurationUpdatedMessage args)
|
private void OnUpdate(EntityUid uid, ConfigurationComponent component, ConfigurationUpdatedMessage args)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Content.Server.Administration.Logs;
|
|||||||
using Content.Server.Decals;
|
using Content.Server.Decals;
|
||||||
using Content.Server.Nutrition.EntitySystems;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Audio;
|
|
||||||
using Content.Shared.Crayon;
|
using Content.Shared.Crayon;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Decals;
|
using Content.Shared.Decals;
|
||||||
@@ -13,15 +12,15 @@ using Content.Shared.Interaction.Events;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Crayon;
|
namespace Content.Server.Crayon;
|
||||||
|
|
||||||
public sealed class CrayonSystem : SharedCrayonSystem
|
public sealed class CrayonSystem : SharedCrayonSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly DecalSystem _decals = default!;
|
[Dependency] private readonly DecalSystem _decals = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
@@ -71,7 +70,7 @@ public sealed class CrayonSystem : SharedCrayonSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.UseSound != null)
|
if (component.UseSound != null)
|
||||||
_audio.PlayPvs(component.UseSound, uid, AudioHelpers.WithVariation(0.125f));
|
_audio.PlayPvs(component.UseSound, uid, AudioParams.Default.WithVariation(0.125f));
|
||||||
|
|
||||||
// Decrease "Ammo"
|
// Decrease "Ammo"
|
||||||
component.Charges--;
|
component.Charges--;
|
||||||
@@ -100,7 +99,7 @@ public sealed class CrayonSystem : SharedCrayonSystem
|
|||||||
if (component.UserInterface?.SubscribedSessions.Contains(actor.PlayerSession) == true)
|
if (component.UserInterface?.SubscribedSessions.Contains(actor.PlayerSession) == true)
|
||||||
{
|
{
|
||||||
// Tell the user interface the selected stuff
|
// Tell the user interface the selected stuff
|
||||||
_uiSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
|
UserInterfaceSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Server.DeviceLinking.Components;
|
using Content.Server.DeviceLinking.Components;
|
||||||
using Content.Server.Interaction;
|
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.MachineLinking;
|
using Content.Shared.MachineLinking;
|
||||||
@@ -17,7 +16,6 @@ public sealed class SignalTimerSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||||
[Dependency] private readonly InteractionSystem _interaction = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -42,7 +40,7 @@ public sealed class SignalTimerSystem : EntitySystem
|
|||||||
|
|
||||||
if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
|
if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
|
||||||
{
|
{
|
||||||
_ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(component.Label,
|
UserInterfaceSystem.SetUiState(bui, new SignalTimerBoundUserInterfaceState(component.Label,
|
||||||
TimeSpan.FromSeconds(component.Delay).Minutes.ToString("D2"),
|
TimeSpan.FromSeconds(component.Delay).Minutes.ToString("D2"),
|
||||||
TimeSpan.FromSeconds(component.Delay).Seconds.ToString("D2"),
|
TimeSpan.FromSeconds(component.Delay).Seconds.ToString("D2"),
|
||||||
component.CanEditLabel,
|
component.CanEditLabel,
|
||||||
@@ -62,7 +60,7 @@ public sealed class SignalTimerSystem : EntitySystem
|
|||||||
|
|
||||||
if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
|
if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
|
||||||
{
|
{
|
||||||
_ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(signalTimer.Label,
|
UserInterfaceSystem.SetUiState(bui, new SignalTimerBoundUserInterfaceState(signalTimer.Label,
|
||||||
TimeSpan.FromSeconds(signalTimer.Delay).Minutes.ToString("D2"),
|
TimeSpan.FromSeconds(signalTimer.Delay).Minutes.ToString("D2"),
|
||||||
TimeSpan.FromSeconds(signalTimer.Delay).Seconds.ToString("D2"),
|
TimeSpan.FromSeconds(signalTimer.Delay).Seconds.ToString("D2"),
|
||||||
signalTimer.CanEditLabel,
|
signalTimer.CanEditLabel,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user