Merge branch 'master' into 2020-08-19-firelocks

# Conflicts:
#	Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
#	Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
#	SpaceStation14.sln.DotSettings
This commit is contained in:
Víctor Aguilera Puerto
2020-08-28 14:35:45 +02:00
494 changed files with 11527 additions and 3829 deletions

View File

@@ -70,14 +70,12 @@ namespace Content.Client.Chat
// Flag Enums for holding filtered channels // Flag Enums for holding filtered channels
private ChatChannel _filteredChannels; private ChatChannel _filteredChannels;
#pragma warning disable 649 [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IClientNetManager _netManager; [Dependency] private readonly IClientConsole _console = default!;
[Dependency] private readonly IClientConsole _console; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager;
[Dependency] private readonly IClientConGroupController _groupController = default!; [Dependency] private readonly IClientConGroupController _groupController = default!;
#pragma warning restore 649
private ChatBox _currentChatBox; private ChatBox _currentChatBox;
private Control _speechBubbleRoot; private Control _speechBubbleRoot;

View File

@@ -7,6 +7,7 @@ using Content.Client.Parallax;
using Content.Client.Sandbox; using Content.Client.Sandbox;
using Content.Client.StationEvents; using Content.Client.StationEvents;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.AdminMenu;
using Content.Client.UserInterface.Stylesheets; using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.Interfaces; using Content.Shared.Interfaces;
@@ -33,6 +34,7 @@ namespace Content.Client
IoCManager.Register<IScreenshotHook, ScreenshotHook>(); IoCManager.Register<IScreenshotHook, ScreenshotHook>();
IoCManager.Register<IClickMapManager, ClickMapManager>(); IoCManager.Register<IClickMapManager, ClickMapManager>();
IoCManager.Register<IStationEventManager, StationEventManager>(); IoCManager.Register<IStationEventManager, StationEventManager>();
IoCManager.Register<IAdminMenuManager, AdminMenuManager>();
} }
} }
} }

View File

@@ -21,14 +21,12 @@ namespace Content.Client
{ {
public class ClientNotifyManager : SharedNotifyManager, IClientNotifyManager public class ClientNotifyManager : SharedNotifyManager, IClientNotifyManager
{ {
#pragma warning disable 649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private IPlayerManager _playerManager; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private IInputManager _inputManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private IEyeManager _eyeManager; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private IClientNetManager _netManager; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private IEntityManager _entityManager;
#pragma warning restore 649
private readonly List<PopupLabel> _aliveLabels = new List<PopupLabel>(); private readonly List<PopupLabel> _aliveLabels = new List<PopupLabel>();
private bool _initialized; private bool _initialized;

View File

@@ -14,9 +14,7 @@ namespace Content.Client
/// </summary> /// </summary>
public class ClientPreferencesManager : SharedPreferencesManager, IClientPreferencesManager public class ClientPreferencesManager : SharedPreferencesManager, IClientPreferencesManager
{ {
#pragma warning disable 649 [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IClientNetManager _netManager;
#pragma warning restore 649
public event Action OnServerDataLoaded; public event Action OnServerDataLoaded;
public GameSettings Settings { get; private set; } public GameSettings Settings { get; private set; }

View File

@@ -12,9 +12,7 @@ namespace Content.Client.Command
{ {
public class CommunicationsConsoleMenu : SS14Window public class CommunicationsConsoleMenu : SS14Window
{ {
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
protected override Vector2? CustomSize => new Vector2(600, 400); protected override Vector2? CustomSize => new Vector2(600, 400);

View File

@@ -22,11 +22,9 @@ namespace Content.Client.Construction
{ {
public class ConstructionMenu : SS14Window public class ConstructionMenu : SS14Window
{ {
#pragma warning disable CS0649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IEntitySystemManager _systemManager = default!;
[Dependency] private readonly IEntitySystemManager _systemManager;
#pragma warning restore
private readonly Button BuildButton; private readonly Button BuildButton;
private readonly Button EraseButton; private readonly Button EraseButton;

View File

@@ -9,6 +9,7 @@ using Content.Client.Sandbox;
using Content.Client.State; using Content.Client.State;
using Content.Client.StationEvents; using Content.Client.StationEvents;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.AdminMenu;
using Content.Client.UserInterface.Stylesheets; using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components; using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Cargo; using Content.Shared.GameObjects.Components.Cargo;
@@ -39,14 +40,12 @@ namespace Content.Client
{ {
public class EntryPoint : GameClient public class EntryPoint : GameClient
{ {
#pragma warning disable 649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IBaseClient _baseClient; [Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner = default!;
[Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner; [Dependency] private readonly IGameController _gameController = default!;
[Dependency] private readonly IGameController _gameController; [Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IStateManager _stateManager; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager;
#pragma warning restore 649
public override void Init() public override void Init()
{ {
@@ -152,6 +151,7 @@ namespace Content.Client
IoCManager.Resolve<ISandboxManager>().Initialize(); IoCManager.Resolve<ISandboxManager>().Initialize();
IoCManager.Resolve<IClientPreferencesManager>().Initialize(); IoCManager.Resolve<IClientPreferencesManager>().Initialize();
IoCManager.Resolve<IStationEventManager>().Initialize(); IoCManager.Resolve<IStationEventManager>().Initialize();
IoCManager.Resolve<IAdminMenuManager>().Initialize();
_baseClient.RunLevelChanged += (sender, args) => _baseClient.RunLevelChanged += (sender, args) =>
{ {

View File

@@ -17,18 +17,16 @@ namespace Content.Client
{ {
internal sealed class EscapeMenuOwner : IEscapeMenuOwner internal sealed class EscapeMenuOwner : IEscapeMenuOwner
{ {
#pragma warning disable 649 [Dependency] private readonly IClientConsole _clientConsole = default!;
[Dependency] private readonly IClientConsole _clientConsole; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager; [Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IPlacementManager _placementManager; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IStateManager _stateManager; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
private EscapeMenu _escapeMenu; private EscapeMenu _escapeMenu;

View File

@@ -10,10 +10,9 @@ namespace Content.Client.GameObjects.Components.Access
{ {
public class IdCardConsoleBoundUserInterface : BoundUserInterface public class IdCardConsoleBoundUserInterface : BoundUserInterface
{ {
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{ {
} }

View File

@@ -0,0 +1,58 @@
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Shared.IoC;
using Robust.Shared.GameObjects;
using Content.Shared.GameObjects.Components.ActionBlocking;
using Content.Shared.Preferences.Appearance;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.ActionBlocking
{
[RegisterComponent]
public class CuffableComponent : SharedCuffableComponent
{
[ViewVariables]
private string _currentRSI = default;
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is CuffableComponentState cuffState))
{
return;
}
CanStillInteract = cuffState.CanStillInteract;
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
{
sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, cuffState.NumHandsCuffed > 0);
sprite.LayerSetColor(HumanoidVisualLayers.Handcuffs, cuffState.Color);
if (cuffState.NumHandsCuffed > 0)
{
if (_currentRSI != cuffState.RSI) // we don't want to keep loading the same RSI
{
_currentRSI = cuffState.RSI;
sprite.LayerSetState(HumanoidVisualLayers.Handcuffs, new RSI.StateId(cuffState.IconState), new ResourcePath(cuffState.RSI));
}
else
{
sprite.LayerSetState(HumanoidVisualLayers.Handcuffs, new RSI.StateId(cuffState.IconState)); // TODO: safety check to see if RSI contains the state?
}
}
}
}
public override void OnRemove()
{
base.OnRemove();
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
{
sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, false);
}
}
}
}

View File

@@ -0,0 +1,27 @@
using Robust.Shared.GameObjects;
using Content.Shared.GameObjects.Components.ActionBlocking;
using Robust.Client.Graphics;
using Robust.Client.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Client.GameObjects.Components.ActionBlocking
{
[RegisterComponent]
public class HandcuffComponent : SharedHandcuffComponent
{
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
var cuffState = curState as HandcuffedComponentState;
if (cuffState == null || cuffState.IconState == string.Empty)
{
return;
}
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
{
sprite.LayerSetState(0, new RSI.StateId(cuffState.IconState)); // TODO: safety check to see if RSI contains the state?
}
}
}
}

View File

@@ -14,12 +14,10 @@ namespace Content.Client.GameObjects.Components.Actor
[RegisterComponent] [RegisterComponent]
public sealed class CharacterInfoComponent : Component, ICharacterUI public sealed class CharacterInfoComponent : Component, ICharacterUI
{ {
private CharacterInfoControl _control; [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
#pragma warning disable 649 private CharacterInfoControl _control;
[Dependency] private readonly ILocalizationManager _loc;
[Dependency] private readonly IResourceCache _resourceCache;
#pragma warning restore 649
public override string Name => "CharacterInfo"; public override string Name => "CharacterInfo";

View File

@@ -20,12 +20,9 @@ namespace Content.Client.GameObjects.Components.Actor
[RegisterComponent] [RegisterComponent]
public class CharacterInterface : Component public class CharacterInterface : Component
{ {
public override string Name => "Character Interface Component"; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] public override string Name => "Character Interface Component";
#pragma warning disable 649
private readonly IGameHud _gameHud;
#pragma warning restore 649
/// <summary> /// <summary>
/// Window to hold each of the character interfaces /// Window to hold each of the character interfaces

View File

@@ -17,9 +17,7 @@ namespace Content.Client.GameObjects.Components.Body
[ComponentReference(typeof(IBodyManagerComponent))] [ComponentReference(typeof(IBodyManagerComponent))]
public class BodyManagerComponent : SharedBodyManagerComponent, IClientDraggable public class BodyManagerComponent : SharedBodyManagerComponent, IClientDraggable
{ {
#pragma warning disable 649
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
#pragma warning restore 649
public bool ClientCanDropOn(CanDropEventArgs eventArgs) public bool ClientCanDropOn(CanDropEventArgs eventArgs)
{ {

View File

@@ -10,9 +10,7 @@ namespace Content.Client.GameObjects.Components.Cargo
[RegisterComponent] [RegisterComponent]
public class GalacticMarketComponent : SharedGalacticMarketComponent public class GalacticMarketComponent : SharedGalacticMarketComponent
{ {
#pragma warning disable CS0649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private IPrototypeManager _prototypeManager;
#pragma warning restore
/// <summary> /// <summary>
/// Event called when the database is updated. /// Event called when the database is updated.

View File

@@ -21,6 +21,8 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
/// </summary> /// </summary>
public class ChemMasterWindow : SS14Window public class ChemMasterWindow : SS14Window
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
/// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary> /// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary>
private readonly VBoxContainer ContainerInfo; private readonly VBoxContainer ContainerInfo;
@@ -45,11 +47,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
public Button CreatePills { get; } public Button CreatePills { get; }
public Button CreateBottles { get; } public Button CreateBottles { get; }
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
protected override Vector2? CustomSize => (400, 200); protected override Vector2? CustomSize => (400, 200);
/// <summary> /// <summary>
@@ -69,9 +66,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
Children = Children =
{ {
new Label {Text = _localizationManager.GetString("Container")}, new Label {Text = Loc.GetString("Container")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand}, new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
(EjectButton = new Button {Text = _localizationManager.GetString("Eject")}) (EjectButton = new Button {Text = Loc.GetString("Eject")})
} }
}, },
//Wrap the container info in a PanelContainer so we can color it's background differently. //Wrap the container info in a PanelContainer so we can color it's background differently.
@@ -94,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
new Label new Label
{ {
Text = _localizationManager.GetString("No container loaded.") Text = Loc.GetString("No container loaded.")
} }
} }
}), }),
@@ -109,10 +106,10 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
Children = Children =
{ {
new Label {Text = _localizationManager.GetString("Buffer")}, new Label {Text = Loc.GetString("Buffer")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand}, new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
(BufferTransferButton = new Button {Text = _localizationManager.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}), (BufferTransferButton = new Button {Text = Loc.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}),
(BufferDiscardButton = new Button {Text = _localizationManager.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }}) (BufferDiscardButton = new Button {Text = Loc.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }})
} }
}, },
@@ -136,7 +133,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
new Label new Label
{ {
Text = _localizationManager.GetString("Buffer empty.") Text = Loc.GetString("Buffer empty.")
} }
} }
}), }),
@@ -151,7 +148,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
Children = Children =
{ {
new Label {Text = _localizationManager.GetString("Packaging ")}, new Label {Text = Loc.GetString("Packaging ")},
} }
}, },
@@ -185,7 +182,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
new Label new Label
{ {
Text = _localizationManager.GetString("Pills:") Text = Loc.GetString("Pills:")
}, },
}, },
@@ -212,7 +209,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
}; };
PillInfo.AddChild((pillVolume)); PillInfo.AddChild((pillVolume));
CreatePills = new Button {Text = _localizationManager.GetString("Create")}; CreatePills = new Button {Text = Loc.GetString("Create")};
PillInfo.AddChild(CreatePills); PillInfo.AddChild(CreatePills);
//Bottles //Bottles
@@ -222,7 +219,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
{ {
new Label new Label
{ {
Text = _localizationManager.GetString("Bottles:") Text = Loc.GetString("Bottles:")
}, },
}, },
@@ -249,7 +246,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
}; };
BottleInfo.AddChild((bottleVolume)); BottleInfo.AddChild((bottleVolume));
CreateBottles = new Button {Text = _localizationManager.GetString("Create")}; CreateBottles = new Button {Text = Loc.GetString("Create")};
BottleInfo.AddChild(CreateBottles); BottleInfo.AddChild(CreateBottles);
} }
@@ -314,7 +311,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
if (!state.HasBeaker) if (!state.HasBeaker)
{ {
ContainerInfo.Children.Add(new Label {Text = _localizationManager.GetString("No container loaded.")}); ContainerInfo.Children.Add(new Label {Text = Loc.GetString("No container loaded.")});
return; return;
} }
@@ -333,7 +330,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
foreach (var reagent in state.ContainerReagents) foreach (var reagent in state.ContainerReagents)
{ {
var name = _localizationManager.GetString("Unknown reagent"); var name = Loc.GetString("Unknown reagent");
//Try to the prototype for the given reagent. This gives us it's name. //Try to the prototype for the given reagent. This gives us it's name.
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
{ {
@@ -370,7 +367,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
if (!state.BufferReagents.Any()) if (!state.BufferReagents.Any())
{ {
BufferInfo.Children.Add(new Label {Text = _localizationManager.GetString("Buffer empty.")}); BufferInfo.Children.Add(new Label {Text = Loc.GetString("Buffer empty.")});
return; return;
} }
@@ -388,7 +385,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
foreach (var reagent in state.BufferReagents) foreach (var reagent in state.BufferReagents)
{ {
var name = _localizationManager.GetString("Unknown reagent"); var name = Loc.GetString("Unknown reagent");
//Try to the prototype for the given reagent. This gives us it's name. //Try to the prototype for the given reagent. This gives us it's name.
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
{ {

View File

@@ -17,10 +17,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
[UsedImplicitly] [UsedImplicitly]
public class ReagentDispenserBoundUserInterface : BoundUserInterface public class ReagentDispenserBoundUserInterface : BoundUserInterface
{ {
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
private ReagentDispenserWindow _window; private ReagentDispenserWindow _window;
private ReagentDispenserBoundUserInterfaceState _lastState; private ReagentDispenserBoundUserInterfaceState _lastState;
@@ -41,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
//Setup window layout/elements //Setup window layout/elements
_window = new ReagentDispenserWindow _window = new ReagentDispenserWindow
{ {
Title = _localizationManager.GetString("Reagent dispenser"), Title = Loc.GetString("Reagent dispenser"),
}; };
_window.OpenCentered(); _window.OpenCentered();

View File

@@ -20,6 +20,8 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// </summary> /// </summary>
public class ReagentDispenserWindow : SS14Window public class ReagentDispenserWindow : SS14Window
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
/// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary> /// <summary>Contains info about the reagent container such as it's contents, if one is loaded into the dispenser.</summary>
private readonly VBoxContainer ContainerInfo; private readonly VBoxContainer ContainerInfo;
@@ -50,11 +52,6 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// <summary>A grid of buttons for each reagent which can be dispensed.</summary> /// <summary>A grid of buttons for each reagent which can be dispensed.</summary>
public GridContainer ChemicalList { get; } public GridContainer ChemicalList { get; }
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
protected override Vector2? CustomSize => (500, 600); protected override Vector2? CustomSize => (500, 600);
/// <summary> /// <summary>
@@ -76,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{ {
Children = Children =
{ {
new Label {Text = _localizationManager.GetString("Amount")}, new Label {Text = Loc.GetString("Amount")},
//Padding //Padding
new Control {CustomMinimumSize = (20, 0)}, new Control {CustomMinimumSize = (20, 0)},
(DispenseButton1 = new Button {Text = "1", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenRight }}), (DispenseButton1 = new Button {Text = "1", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenRight }}),
@@ -100,9 +97,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{ {
Children = Children =
{ {
new Label {Text = _localizationManager.GetString("Container: ")}, new Label {Text = Loc.GetString("Container: ")},
(ClearButton = new Button {Text = _localizationManager.GetString("Clear"), StyleClasses = {StyleBase.ButtonOpenRight}}), (ClearButton = new Button {Text = Loc.GetString("Clear"), StyleClasses = {StyleBase.ButtonOpenRight}}),
(EjectButton = new Button {Text = _localizationManager.GetString("Eject"), StyleClasses = {StyleBase.ButtonOpenLeft}}) (EjectButton = new Button {Text = Loc.GetString("Eject"), StyleClasses = {StyleBase.ButtonOpenLeft}})
} }
}, },
//Wrap the container info in a PanelContainer so we can color it's background differently. //Wrap the container info in a PanelContainer so we can color it's background differently.
@@ -125,7 +122,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{ {
new Label new Label
{ {
Text = _localizationManager.GetString("No container loaded.") Text = Loc.GetString("No container loaded.")
} }
} }
}), }),
@@ -155,7 +152,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
} }
else else
{ {
ChemicalList.AddChild(new Button {Text = _localizationManager.GetString("Reagent name not found")}); ChemicalList.AddChild(new Button {Text = Loc.GetString("Reagent name not found")});
} }
} }
} }
@@ -243,7 +240,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
if (!state.HasBeaker) if (!state.HasBeaker)
{ {
ContainerInfo.Children.Add(new Label {Text = _localizationManager.GetString("No container loaded.")}); ContainerInfo.Children.Add(new Label {Text = Loc.GetString("No container loaded.")});
return; return;
} }
@@ -267,7 +264,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
foreach (var reagent in state.ContainerReagents) foreach (var reagent in state.ContainerReagents)
{ {
var name = _localizationManager.GetString("Unknown reagent"); var name = Loc.GetString("Unknown reagent");
//Try to the prototype for the given reagent. This gives us it's name. //Try to the prototype for the given reagent. This gives us it's name.
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
{ {

View File

@@ -11,12 +11,9 @@ namespace Content.Client.GameObjects.Components.Command
{ {
public class CommunicationsConsoleBoundUserInterface : BoundUserInterface public class CommunicationsConsoleBoundUserInterface : BoundUserInterface
{ {
[ViewVariables] [Dependency] private readonly IGameTiming _gameTiming = default!;
private CommunicationsConsoleMenu _menu;
#pragma warning disable 649 [ViewVariables] private CommunicationsConsoleMenu _menu;
[Dependency] private IGameTiming _gameTiming;
#pragma warning restore 649
public bool CountdownStarted { get; private set; } public bool CountdownStarted { get; private set; }

View File

@@ -2,7 +2,6 @@
using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems; using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -12,9 +11,6 @@ namespace Content.Client.GameObjects.Components.Construction
[RegisterComponent] [RegisterComponent]
public class ConstructionGhostComponent : Component, IExamine public class ConstructionGhostComponent : Component, IExamine
{ {
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _loc;
#pragma warning restore 649
public override string Name => "ConstructionGhost"; public override string Name => "ConstructionGhost";
[ViewVariables] public ConstructionPrototype Prototype { get; set; } [ViewVariables] public ConstructionPrototype Prototype { get; set; }
@@ -22,7 +18,7 @@ namespace Content.Client.GameObjects.Components.Construction
void IExamine.Examine(FormattedMessage message, bool inDetailsRange) void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{ {
message.AddText(_loc.GetString("Building: {0}\n", Prototype.Name)); message.AddText(Loc.GetString("Building: {0}\n", Prototype.Name));
EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, 0, inDetailsRange); EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, 0, inDetailsRange);
} }
} }

View File

@@ -4,6 +4,7 @@ using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components.Disposal namespace Content.Client.GameObjects.Components.Disposal
{ {
[RegisterComponent] [RegisterComponent]
[ComponentReference(typeof(SharedDisposalUnitComponent))]
public class DisposalUnitComponent : SharedDisposalUnitComponent public class DisposalUnitComponent : SharedDisposalUnitComponent
{ {
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using Robust.Client.Animations; using Robust.Client.Animations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations; using Robust.Client.GameObjects.Components.Animations;
@@ -13,6 +13,7 @@ namespace Content.Client.GameObjects.Components
{ {
public override string Name => "EmergencyLight"; public override string Name => "EmergencyLight";
/// <inheritdoc/>
protected override void Startup() protected override void Startup()
{ {
base.Startup(); base.Startup();

View File

@@ -0,0 +1,119 @@
using System;
using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components
{
[UsedImplicitly]
public class FlashLightVisualizer : AppearanceVisualizer
{
private readonly Animation _radiatingLightAnimation = new Animation
{
Length = TimeSpan.FromSeconds(1),
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(PointLightComponent),
InterpolationMode = AnimationInterpolationMode.Linear,
Property = nameof(PointLightComponent.Radius),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(3.0f, 0),
new AnimationTrackProperty.KeyFrame(2.0f, 0.5f),
new AnimationTrackProperty.KeyFrame(3.0f, 1)
}
}
}
};
private readonly Animation _blinkingLightAnimation = new Animation
{
Length = TimeSpan.FromSeconds(1),
AnimationTracks =
{
new AnimationTrackComponentProperty()
{
ComponentType = typeof(PointLightComponent),
//To create the blinking effect we go from nearly zero radius, to the light radius, and back
//We do this instead of messing with the `PointLightComponent.enabled` because we don't want the animation to affect component behavior
InterpolationMode = AnimationInterpolationMode.Nearest,
Property = nameof(PointLightComponent.Radius),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(0.1f, 0),
new AnimationTrackProperty.KeyFrame(2f, 0.5f),
new AnimationTrackProperty.KeyFrame(0.1f, 1)
}
}
}
};
private Action<string> _radiatingCallback;
private Action<string> _blinkingCallback;
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
if (component.TryGetData(HandheldLightVisuals.Power,
out HandheldLightPowerStates state))
{
PlayAnimation(component, state);
}
}
private void PlayAnimation(AppearanceComponent component, HandheldLightPowerStates state)
{
component.Owner.EnsureComponent(out AnimationPlayerComponent animationPlayer);
switch (state)
{
case HandheldLightPowerStates.LowPower:
if (!animationPlayer.HasRunningAnimation("radiatingLight"))
{
animationPlayer.Play(_radiatingLightAnimation, "radiatingLight");
_radiatingCallback = (s) => animationPlayer.Play(_radiatingLightAnimation, s);
animationPlayer.AnimationCompleted += _radiatingCallback;
}
break;
case HandheldLightPowerStates.Dying:
animationPlayer.Stop("radiatingLight");
animationPlayer.AnimationCompleted -= _radiatingCallback;
if (!animationPlayer.HasRunningAnimation("blinkingLight"))
{
animationPlayer.Play(_blinkingLightAnimation, "blinkingLight");
_blinkingCallback = (s) => animationPlayer.Play(_blinkingLightAnimation, s);
animationPlayer.AnimationCompleted += _blinkingCallback;
}
break;
case HandheldLightPowerStates.FullPower:
if (animationPlayer.HasRunningAnimation("blinkingLight"))
{
animationPlayer.Stop("blinkingLight");
animationPlayer.AnimationCompleted -= _blinkingCallback;
}
if (animationPlayer.HasRunningAnimation("radiatingLight"))
{
animationPlayer.Stop("radiatingLight");
animationPlayer.AnimationCompleted -= _radiatingCallback;
}
break;
}
}
}
}

View File

@@ -18,11 +18,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
[UsedImplicitly] [UsedImplicitly]
public class HumanInventoryInterfaceController : InventoryInterfaceController public class HumanInventoryInterfaceController : InventoryInterfaceController
{ {
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ILocalizationManager _loc; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager;
#pragma warning restore 649
private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons
= new Dictionary<Slots, List<ItemSlotButton>>(); = new Dictionary<Slots, List<ItemSlotButton>>();
@@ -43,7 +41,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
base.Initialize(); base.Initialize();
_window = new HumanInventoryWindow(_loc, _resourceCache); _window = new HumanInventoryWindow(_loc, _resourceCache);
_window.OnClose += () => _gameHud.InventoryButtonDown = false; _window.OnClose += () => GameHud.InventoryButtonDown = false;
foreach (var (slot, button) in _window.Buttons) foreach (var (slot, button) in _window.Buttons)
{ {
button.OnPressed = (e) => AddToInventory(e, slot); button.OnPressed = (e) => AddToInventory(e, slot);
@@ -153,7 +151,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
base.PlayerAttached(); base.PlayerAttached();
_gameHud.InventoryQuickButtonContainer.AddChild(_quickButtonsContainer); GameHud.InventoryQuickButtonContainer.AddChild(_quickButtonsContainer);
// Update all the buttons to make sure they check out. // Update all the buttons to make sure they check out.
@@ -175,7 +173,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
base.PlayerDetached(); base.PlayerDetached();
_gameHud.InventoryQuickButtonContainer.RemoveChild(_quickButtonsContainer); GameHud.InventoryQuickButtonContainer.RemoveChild(_quickButtonsContainer);
foreach (var (slot, list) in _inventoryButtons) foreach (var (slot, list) in _inventoryButtons)
{ {

View File

@@ -12,9 +12,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
public abstract class InventoryInterfaceController : IDisposable public abstract class InventoryInterfaceController : IDisposable
{ {
#pragma warning disable 649 [Dependency] protected readonly IGameHud GameHud = default!;
[Dependency] protected readonly IGameHud _gameHud;
#pragma warning restore 649
protected InventoryInterfaceController(ClientInventoryComponent owner) protected InventoryInterfaceController(ClientInventoryComponent owner)
{ {
@@ -31,8 +29,8 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
public virtual void PlayerAttached() public virtual void PlayerAttached()
{ {
_gameHud.InventoryButtonVisible = true; GameHud.InventoryButtonVisible = true;
_gameHud.InventoryButtonToggled = b => GameHud.InventoryButtonToggled = b =>
{ {
if (b) if (b)
{ {
@@ -47,7 +45,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
public virtual void PlayerDetached() public virtual void PlayerDetached()
{ {
_gameHud.InventoryButtonVisible = false; GameHud.InventoryButtonVisible = false;
Window.Close(); Window.Close();
} }

View File

@@ -4,8 +4,10 @@ using Content.Shared.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components.Inventory; using Content.Shared.GameObjects.Components.Inventory;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface; using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface; using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
using Robust.Shared.Localization;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Client.GameObjects.Components.HUD.Inventory namespace Content.Client.GameObjects.Components.HUD.Inventory
@@ -15,6 +17,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
public Dictionary<Slots, string> Inventory { get; private set; } public Dictionary<Slots, string> Inventory { get; private set; }
public Dictionary<string, string> Hands { get; private set; } public Dictionary<string, string> Hands { get; private set; }
public Dictionary<EntityUid, string> Handcuffs { get; private set; }
[ViewVariables] [ViewVariables]
private StrippingMenu _strippingMenu; private StrippingMenu _strippingMenu;
@@ -28,6 +31,8 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
base.Open(); base.Open();
_strippingMenu = new StrippingMenu($"{Owner.Owner.Name}'s inventory"); _strippingMenu = new StrippingMenu($"{Owner.Owner.Name}'s inventory");
_strippingMenu.OnClose += Close;
_strippingMenu.OpenCentered(); _strippingMenu.OpenCentered();
UpdateMenu(); UpdateMenu();
} }
@@ -48,6 +53,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
_strippingMenu.ClearButtons(); _strippingMenu.ClearButtons();
if (Inventory != null) if (Inventory != null)
{
foreach (var (slot, name) in Inventory) foreach (var (slot, name) in Inventory)
{ {
_strippingMenu.AddButton(EquipmentSlotDefines.SlotNames[slot], name, (ev) => _strippingMenu.AddButton(EquipmentSlotDefines.SlotNames[slot], name, (ev) =>
@@ -55,8 +61,10 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
SendMessage(new StrippingInventoryButtonPressed(slot)); SendMessage(new StrippingInventoryButtonPressed(slot));
}); });
} }
}
if (Hands != null) if (Hands != null)
{
foreach (var (hand, name) in Hands) foreach (var (hand, name) in Hands)
{ {
_strippingMenu.AddButton(hand, name, (ev) => _strippingMenu.AddButton(hand, name, (ev) =>
@@ -66,6 +74,18 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
} }
} }
if (Handcuffs != null)
{
foreach (var (id, name) in Handcuffs)
{
_strippingMenu.AddButton(Loc.GetString("Restraints"), name, (ev) =>
{
SendMessage(new StrippingHandcuffButtonPressed(id));
});
}
}
}
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
base.UpdateState(state); base.UpdateState(state);
@@ -74,6 +94,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
Inventory = stripState.Inventory; Inventory = stripState.Inventory;
Hands = stripState.Hands; Hands = stripState.Hands;
Handcuffs = stripState.Handcuffs;
UpdateMenu(); UpdateMenu();
} }

View File

@@ -13,7 +13,10 @@ namespace Content.Client.GameObjects.Components
[RegisterComponent] [RegisterComponent]
public sealed class HandheldLightComponent : SharedHandheldLightComponent, IItemStatus public sealed class HandheldLightComponent : SharedHandheldLightComponent, IItemStatus
{ {
private bool _hasCell;
[ViewVariables] public float? Charge { get; private set; } [ViewVariables] public float? Charge { get; private set; }
[ViewVariables] protected override bool HasCell => _hasCell;
public Control MakeControl() public Control MakeControl()
{ {
@@ -26,6 +29,7 @@ namespace Content.Client.GameObjects.Components
return; return;
Charge = cast.Charge; Charge = cast.Charge;
_hasCell = cast.HasCell;
} }
private sealed class StatusControl : Control private sealed class StatusControl : Control

View File

@@ -27,13 +27,9 @@ namespace Content.Client.GameObjects.Components.Instruments
/// </summary> /// </summary>
public event Action? OnMidiPlaybackEnded; public event Action? OnMidiPlaybackEnded;
#pragma warning disable 649
[Dependency] private readonly IMidiManager _midiManager = default!; [Dependency] private readonly IMidiManager _midiManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IClientNetManager _netManager = default!; [Dependency] private readonly IClientNetManager _netManager = default!;
#pragma warning restore 649
private IMidiRenderer? _renderer; private IMidiRenderer? _renderer;

View File

@@ -9,15 +9,13 @@ namespace Content.Client.GameObjects.Components
[RegisterComponent] [RegisterComponent]
public class InteractionOutlineComponent : Component public class InteractionOutlineComponent : Component
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private const string ShaderInRange = "SelectionOutlineInrange"; private const string ShaderInRange = "SelectionOutlineInrange";
private const string ShaderOutOfRange = "SelectionOutline"; private const string ShaderOutOfRange = "SelectionOutline";
public override string Name => "InteractionOutline"; public override string Name => "InteractionOutline";
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
private ShaderInstance _selectionShaderInstance; private ShaderInstance _selectionShaderInstance;
private ShaderInstance _selectionShaderInRangeInstance; private ShaderInstance _selectionShaderInRangeInstance;

View File

@@ -17,11 +17,9 @@ namespace Content.Client.GameObjects.Components.Items
[ComponentReference(typeof(ISharedHandsComponent))] [ComponentReference(typeof(ISharedHandsComponent))]
public class HandsComponent : SharedHandsComponent public class HandsComponent : SharedHandsComponent
{ {
private HandsGui? _gui;
#pragma warning disable 649
[Dependency] private readonly IGameHud _gameHud = default!; [Dependency] private readonly IGameHud _gameHud = default!;
#pragma warning restore 649
private HandsGui? _gui;
/// <inheritdoc /> /// <inheritdoc />
private readonly List<Hand> _hands = new List<Hand>(); private readonly List<Hand> _hands = new List<Hand>();
@@ -158,7 +156,8 @@ namespace Content.Client.GameObjects.Components.Items
} }
else else
{ {
var (rsi, state) = maybeInHands.Value; var (rsi, state, color) = maybeInHands.Value;
_sprite.LayerSetColor($"hand-{name}", color);
_sprite.LayerSetVisible($"hand-{name}", true); _sprite.LayerSetVisible($"hand-{name}", true);
_sprite.LayerSetState($"hand-{name}", state, rsi); _sprite.LayerSetState($"hand-{name}", state, rsi);
} }

View File

@@ -12,6 +12,7 @@ using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Items namespace Content.Client.GameObjects.Components.Items
@@ -25,6 +26,8 @@ namespace Content.Client.GameObjects.Components.Items
[ViewVariables] protected ResourcePath RsiPath; [ViewVariables] protected ResourcePath RsiPath;
[ViewVariables(VVAccess.ReadWrite)] protected Color Color;
private string _equippedPrefix; private string _equippedPrefix;
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
@@ -40,7 +43,7 @@ namespace Content.Client.GameObjects.Components.Items
} }
} }
public (RSI rsi, RSI.StateId stateId)? GetInHandStateInfo(HandLocation hand) public (RSI rsi, RSI.StateId stateId, Color color)? GetInHandStateInfo(HandLocation hand)
{ {
if (RsiPath == null) if (RsiPath == null)
{ {
@@ -52,7 +55,7 @@ namespace Content.Client.GameObjects.Components.Items
var stateId = EquippedPrefix != null ? $"{EquippedPrefix}-inhand-{handName}" : $"inhand-{handName}"; var stateId = EquippedPrefix != null ? $"{EquippedPrefix}-inhand-{handName}" : $"inhand-{handName}";
if (rsi.TryGetState(stateId, out _)) if (rsi.TryGetState(stateId, out _))
{ {
return (rsi, stateId); return (rsi, stateId, Color);
} }
return null; return null;
@@ -62,6 +65,7 @@ namespace Content.Client.GameObjects.Components.Items
{ {
base.ExposeData(serializer); base.ExposeData(serializer);
serializer.DataFieldCached(ref Color, "color", Color.White);
serializer.DataFieldCached(ref RsiPath, "sprite", null); serializer.DataFieldCached(ref RsiPath, "sprite", null);
serializer.DataFieldCached(ref _equippedPrefix, "HeldPrefix", null); serializer.DataFieldCached(ref _equippedPrefix, "HeldPrefix", null);
} }

View File

@@ -20,10 +20,9 @@ namespace Content.Client.GameObjects.Components.Kitchen
{ {
public class MicrowaveBoundUserInterface : BoundUserInterface public class MicrowaveBoundUserInterface : BoundUserInterface
{ {
#pragma warning disable 649 [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
private MicrowaveMenu _menu; private MicrowaveMenu _menu;
private Dictionary<int, EntityUid> _solids = new Dictionary<int, EntityUid>(); private Dictionary<int, EntityUid> _solids = new Dictionary<int, EntityUid>();

View File

@@ -0,0 +1,56 @@
using System;
using Content.Shared.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components
{
[UsedImplicitly]
public class LanternVisualizer : AppearanceVisualizer
{
private readonly Animation _radiatingLightAnimation = new Animation
{
Length = TimeSpan.FromSeconds(5),
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(PointLightComponent),
InterpolationMode = AnimationInterpolationMode.Linear,
Property = nameof(PointLightComponent.Radius),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(3.0f, 0),
new AnimationTrackProperty.KeyFrame(2.0f, 1.5f),
new AnimationTrackProperty.KeyFrame(3.0f, 3f)
}
}
}
};
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.Deleted)
{
return;
}
PlayAnimation(component);
}
private void PlayAnimation(AppearanceComponent component)
{
component.Owner.EnsureComponent(out AnimationPlayerComponent animationPlayer);
if (animationPlayer.HasRunningAnimation("radiatingLight")) return;
animationPlayer.Play(_radiatingLightAnimation, "radiatingLight");
animationPlayer.AnimationCompleted += s => animationPlayer.Play(_radiatingLightAnimation, s);
}
}
}

View File

@@ -24,6 +24,10 @@ namespace Content.Client.GameObjects.Components.Mobs
[ComponentReference(typeof(SharedOverlayEffectsComponent))] [ComponentReference(typeof(SharedOverlayEffectsComponent))]
public sealed class ClientOverlayEffectsComponent : SharedOverlayEffectsComponent//, ICharacterUI public sealed class ClientOverlayEffectsComponent : SharedOverlayEffectsComponent//, ICharacterUI
{ {
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
[Dependency] private readonly IClientNetManager _netManager = default!;
/// <summary> /// <summary>
/// A list of overlay containers representing the current overlays applied /// A list of overlay containers representing the current overlays applied
/// </summary> /// </summary>
@@ -36,13 +40,6 @@ namespace Content.Client.GameObjects.Components.Mobs
set => SetEffects(value); set => SetEffects(value);
} }
#pragma warning disable 649
// Required dependencies
[Dependency] private readonly IOverlayManager _overlayManager;
[Dependency] private readonly IReflectionManager _reflectionManager;
[Dependency] private readonly IClientNetManager _netManager;
#pragma warning restore 649
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();

View File

@@ -23,12 +23,10 @@ namespace Content.Client.GameObjects.Components.Mobs
[ComponentReference(typeof(SharedStatusEffectsComponent))] [ComponentReference(typeof(SharedStatusEffectsComponent))]
public sealed class ClientStatusEffectsComponent : SharedStatusEffectsComponent public sealed class ClientStatusEffectsComponent : SharedStatusEffectsComponent
{ {
#pragma warning disable 649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming;
#pragma warning restore 649
private StatusEffectsUI _ui; private StatusEffectsUI _ui;
private Dictionary<StatusEffect, StatusEffectStatus> _status = new Dictionary<StatusEffect, StatusEffectStatus>(); private Dictionary<StatusEffect, StatusEffectStatus> _status = new Dictionary<StatusEffect, StatusEffectStatus>();

View File

@@ -12,10 +12,8 @@ namespace Content.Client.GameObjects.Components.Mobs
[ComponentReference(typeof(SharedCombatModeComponent))] [ComponentReference(typeof(SharedCombatModeComponent))]
public sealed class CombatModeComponent : SharedCombatModeComponent public sealed class CombatModeComponent : SharedCombatModeComponent
{ {
#pragma warning disable 649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud;
#pragma warning restore 649
public override bool IsInCombatMode public override bool IsInCombatMode
{ {

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
@@ -12,26 +13,26 @@ namespace Content.Client.GameObjects.Components.Mobs
[UsedImplicitly] [UsedImplicitly]
public sealed class DamageStateVisualizer : AppearanceVisualizer public sealed class DamageStateVisualizer : AppearanceVisualizer
{ {
private DamageStateVisualData _data = DamageStateVisualData.Normal; private DamageState _data = DamageState.Alive;
private Dictionary<DamageStateVisualData, string> _stateMap = new Dictionary<DamageStateVisualData,string>(); private readonly Dictionary<DamageState, string> _stateMap = new Dictionary<DamageState, string>();
private int? _originalDrawDepth = null; private int? _originalDrawDepth;
public override void LoadData(YamlMappingNode node) public override void LoadData(YamlMappingNode node)
{ {
base.LoadData(node); base.LoadData(node);
if (node.TryGetNode("normal", out var normal)) if (node.TryGetNode("normal", out var normal))
{ {
_stateMap.Add(DamageStateVisualData.Normal, normal.AsString()); _stateMap.Add(DamageState.Alive, normal.AsString());
} }
if (node.TryGetNode("crit", out var crit)) if (node.TryGetNode("crit", out var crit))
{ {
_stateMap.Add(DamageStateVisualData.Crit, crit.AsString()); _stateMap.Add(DamageState.Critical, crit.AsString());
} }
if (node.TryGetNode("dead", out var dead)) if (node.TryGetNode("dead", out var dead))
{ {
_stateMap.Add(DamageStateVisualData.Dead, dead.AsString()); _stateMap.Add(DamageState.Dead, dead.AsString());
} }
} }
@@ -39,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Mobs
{ {
base.OnChangeData(component); base.OnChangeData(component);
var sprite = component.Owner.GetComponent<ISpriteComponent>(); var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (!component.TryGetData(DamageStateVisuals.State, out DamageStateVisualData data)) if (!component.TryGetData(DamageStateVisuals.State, out DamageState data))
{ {
return; return;
} }
@@ -57,7 +58,7 @@ namespace Content.Client.GameObjects.Components.Mobs
} }
// So they don't draw over mobs anymore // So they don't draw over mobs anymore
if (_data == DamageStateVisualData.Dead) if (_data == DamageState.Dead)
{ {
_originalDrawDepth = sprite.DrawDepth; _originalDrawDepth = sprite.DrawDepth;
sprite.DrawDepth = (int) DrawDepth.FloorObjects; sprite.DrawDepth = (int) DrawDepth.FloorObjects;

View File

@@ -1,8 +1,9 @@
using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Content.Shared.Preferences.Appearance; using Content.Shared.Preferences.Appearance;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Content.Client.GameObjects.Components.ActionBlocking;
namespace Content.Client.GameObjects.Components.Mobs namespace Content.Client.GameObjects.Components.Mobs
{ {
@@ -49,6 +50,15 @@ namespace Content.Client.GameObjects.Components.Mobs
sprite.LayerSetVisible(HumanoidVisualLayers.StencilMask, Sex == Sex.Female); sprite.LayerSetVisible(HumanoidVisualLayers.StencilMask, Sex == Sex.Female);
if (Owner.TryGetComponent<CuffableComponent>(out var cuffed))
{
sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, !cuffed.CanStillInteract);
}
else
{
sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, false);
}
var hairStyle = Appearance.HairStyleName; var hairStyle = Appearance.HairStyleName;
if (string.IsNullOrWhiteSpace(hairStyle) || !HairStyles.HairStylesMap.ContainsKey(hairStyle)) if (string.IsNullOrWhiteSpace(hairStyle) || !HairStyles.HairStylesMap.ContainsKey(hairStyle))
hairStyle = HairStyles.DefaultHairStyle; hairStyle = HairStyles.DefaultHairStyle;

View File

@@ -12,6 +12,10 @@ namespace Content.Client.GameObjects.Components.Observer
[RegisterComponent] [RegisterComponent]
public class GhostComponent : SharedGhostComponent public class GhostComponent : SharedGhostComponent
{ {
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IComponentManager _componentManager = default!;
private GhostGui _gui; private GhostGui _gui;
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
@@ -19,12 +23,6 @@ namespace Content.Client.GameObjects.Components.Observer
private bool _isAttached; private bool _isAttached;
#pragma warning disable 649
[Dependency] private readonly IGameHud _gameHud;
[Dependency] private readonly IPlayerManager _playerManager;
[Dependency] private IComponentManager _componentManager;
#pragma warning restore 649
public override void OnRemove() public override void OnRemove()
{ {
base.OnRemove(); base.OnRemove();

View File

@@ -19,10 +19,9 @@ namespace Content.Client.GameObjects.Components.PDA
{ {
public class PDABoundUserInterface : BoundUserInterface public class PDABoundUserInterface : BoundUserInterface
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager;
#pragma warning restore 649
private PDAMenu _menu; private PDAMenu _menu;
private PDAMenuPopup failPopup; private PDAMenuPopup failPopup;
@@ -70,7 +69,7 @@ namespace Content.Client.GameObjects.Components.PDA
}; };
} }
SendMessage(new PDAUplinkBuyListingMessage(listing)); SendMessage(new PDAUplinkBuyListingMessage(listing.ItemId));
}; };
_menu.OnCategoryButtonPressed += (args, category) => _menu.OnCategoryButtonPressed += (args, category) =>

View File

@@ -1,45 +0,0 @@
using System;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.Components.Animations;
using Robust.Shared.Animations;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components
{
[RegisterComponent]
public class RadiatingLightComponent : Component
{
public override string Name => "RadiatingLight";
protected override void Startup()
{
base.Startup();
var animation = new Animation
{
Length = TimeSpan.FromSeconds(4),
AnimationTracks =
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(PointLightComponent),
InterpolationMode = AnimationInterpolationMode.Linear,
Property = nameof(PointLightComponent.Radius),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(3.0f, 0),
new AnimationTrackProperty.KeyFrame(2.0f, 1),
new AnimationTrackProperty.KeyFrame(3.0f, 2)
}
}
}
};
var playerComponent = Owner.EnsureComponent<AnimationPlayerComponent>();
playerComponent.Play(animation, "emergency");
playerComponent.AnimationCompleted += s => playerComponent.Play(animation, s);
}
}
}

View File

@@ -12,10 +12,8 @@ namespace Content.Client.GameObjects.Components.Research
{ {
public class LatheBoundUserInterface : BoundUserInterface public class LatheBoundUserInterface : BoundUserInterface
{ {
#pragma warning disable CS0649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency]
private IPrototypeManager _prototypeManager;
#pragma warning restore
[ViewVariables] [ViewVariables]
private LatheMenu _menu; private LatheMenu _menu;
[ViewVariables] [ViewVariables]

View File

@@ -10,10 +10,7 @@ namespace Content.Client.GameObjects.Components.Research
[ComponentReference(typeof(SharedLatheDatabaseComponent))] [ComponentReference(typeof(SharedLatheDatabaseComponent))]
public class LatheDatabaseComponent : SharedLatheDatabaseComponent public class LatheDatabaseComponent : SharedLatheDatabaseComponent
{ {
#pragma warning disable CS0649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency]
private IPrototypeManager _prototypeManager;
#pragma warning restore
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {

View File

@@ -11,10 +11,7 @@ namespace Content.Client.GameObjects.Components.Research
[ComponentReference(typeof(SharedLatheDatabaseComponent))] [ComponentReference(typeof(SharedLatheDatabaseComponent))]
public class ProtolatheDatabaseComponent : SharedProtolatheDatabaseComponent public class ProtolatheDatabaseComponent : SharedProtolatheDatabaseComponent
{ {
#pragma warning disable CS0649 [Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency]
private IPrototypeManager _prototypeManager;
#pragma warning restore
/// <summary> /// <summary>
/// Invoked when the database gets updated. /// Invoked when the database gets updated.

View File

@@ -14,10 +14,6 @@ namespace Content.Client.GameObjects.Components.Research
private int[] _serverIds = new int[]{}; private int[] _serverIds = new int[]{};
private int _selectedServerId = -1; private int _selectedServerId = -1;
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
protected override Vector2? CustomSize => (300, 300); protected override Vector2? CustomSize => (300, 300);
public ResearchClientBoundUserInterface Owner { get; set; } public ResearchClientBoundUserInterface Owner { get; set; }
@@ -25,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Research
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = _localizationManager.GetString("Research Server Selection"); Title = Loc.GetString("Research Server Selection");
_servers = new ItemList() {SelectMode = ItemList.ItemListSelectMode.Single}; _servers = new ItemList() {SelectMode = ItemList.ItemListSelectMode.Single};

View File

@@ -16,11 +16,10 @@ namespace Content.Client.GameObjects.Components.Sound
[RegisterComponent] [RegisterComponent]
public class LoopingSoundComponent : SharedLoopingSoundComponent public class LoopingSoundComponent : SharedLoopingSoundComponent
{ {
[Dependency] private readonly IRobustRandom _random = default!;
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new Dictionary<ScheduledSound, IPlayingAudioStream>(); private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new Dictionary<ScheduledSound, IPlayingAudioStream>();
private AudioSystem _audioSystem; private AudioSystem _audioSystem;
#pragma warning disable 649
[Dependency] private readonly IRobustRandom _random;
#pragma warning restore 649
public override void StopAllSounds() public override void StopAllSounds()
{ {

View File

@@ -0,0 +1,109 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Content.Client.UserInterface;
using Content.Client.UserInterface.Suspicion;
using Content.Shared.GameObjects.Components.Suspicion;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using Robust.Shared.Players;
namespace Content.Client.GameObjects.Components.Suspicion
{
[RegisterComponent]
public class SuspicionRoleComponent : SharedSuspicionRoleComponent
{
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private SuspicionGui? _gui;
private string? _role;
private bool? _antagonist;
public string? Role
{
get => _role;
set
{
_role = value;
_gui?.UpdateLabel();
Dirty();
}
}
public bool? Antagonist
{
get => _antagonist;
set
{
_antagonist = value;
_gui?.UpdateLabel();
Dirty();
}
}
public HashSet<IEntity> Allies { get; } = new HashSet<IEntity>();
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);
if (!(curState is SuspicionRoleComponentState state))
{
return;
}
_role = state.Role;
_antagonist = state.Antagonist;
}
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
base.HandleMessage(message, component);
switch (message)
{
case PlayerAttachedMsg _:
if (_gui == null)
{
_gui = new SuspicionGui();
}
else
{
_gui.Parent?.RemoveChild(_gui);
}
_gameHud.SuspicionContainer.AddChild(_gui);
_gui.UpdateLabel();
break;
case PlayerDetachedMsg _:
_gui?.Parent?.RemoveChild(_gui);
break;
}
}
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null)
{
base.HandleNetworkMessage(message, netChannel, session);
switch (message)
{
case SuspicionAlliesMessage msg:
Allies.Clear();
Allies.UnionWith(msg.Allies.Select(_entityManager.GetEntity));
break;
}
}
public override void OnRemove()
{
base.OnRemove();
_gui?.Dispose();
}
}
}

View File

@@ -0,0 +1,160 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
[RegisterComponent]
public class ClientBatteryBarrelComponent : Component, IItemStatus
{
public override string Name => "BatteryBarrel";
public override uint? NetID => ContentNetIDs.BATTERY_BARREL;
private StatusControl _statusControl;
/// <summary>
/// Count of bullets in the magazine.
/// </summary>
/// <remarks>
/// Null if no magazine is inserted.
/// </remarks>
[ViewVariables]
public (int count, int max)? MagazineCount { get; private set; }
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is BatteryBarrelComponentState cast))
return;
MagazineCount = cast.Magazine;
_statusControl?.Update();
}
public Control MakeControl()
{
_statusControl = new StatusControl(this);
_statusControl.Update();
return _statusControl;
}
public void DestroyControl(Control control)
{
if (_statusControl == control)
{
_statusControl = null;
}
}
private sealed class StatusControl : Control
{
private readonly ClientBatteryBarrelComponent _parent;
private readonly HBoxContainer _bulletsList;
private readonly Label _noBatteryLabel;
private readonly Label _ammoCount;
public StatusControl(ClientBatteryBarrelComponent parent)
{
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
(_bulletsList = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 4
}),
(_noBatteryLabel = new Label
{
Text = "No Battery!",
StyleClasses = {StyleNano.StyleClassItemStatus}
})
}
},
new Control() { CustomMinimumSize = (5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
}),
}
});
}
public void Update()
{
_bulletsList.RemoveAllChildren();
if (_parent.MagazineCount == null)
{
_noBatteryLabel.Visible = true;
_ammoCount.Visible = false;
return;
}
var (count, capacity) = _parent.MagazineCount.Value;
_noBatteryLabel.Visible = false;
_ammoCount.Visible = true;
_ammoCount.Text = $"x{count:00}";
capacity = Math.Min(capacity, 8);
FillBulletRow(_bulletsList, count, capacity);
}
private static void FillBulletRow(Control container, int count, int capacity)
{
var colorGone = Color.FromHex("#000000");
var color = Color.FromHex("#E00000");
// Draw the empty ones
for (var i = count; i < capacity; i++)
{
container.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat()
{
BackgroundColor = colorGone,
},
CustomMinimumSize = (10, 15),
});
}
// Draw the full ones, but limit the count to the capacity
count = Math.Min(count, capacity);
for (var i = 0; i < count; i++)
{
container.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat()
{
BackgroundColor = color,
},
CustomMinimumSize = (10, 15),
});
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -0,0 +1,206 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using System;
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
[RegisterComponent]
public class ClientBoltActionBarrelComponent : Component, IItemStatus
{
public override string Name => "BoltActionBarrel";
public override uint? NetID => ContentNetIDs.BOLTACTION_BARREL;
private StatusControl _statusControl;
/// <summary>
/// chambered is true when a bullet is chambered
/// spent is true when the chambered bullet is spent
/// </summary>
[ViewVariables]
public (bool chambered, bool spent) Chamber { get; private set; }
/// <summary>
/// Count of bullets in the magazine.
/// </summary>
/// <remarks>
/// Null if no magazine is inserted.
/// </remarks>
[ViewVariables]
public (int count, int max)? MagazineCount { get; private set; }
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is BoltActionBarrelComponentState cast))
return;
Chamber = cast.Chamber;
MagazineCount = cast.Magazine;
_statusControl?.Update();
}
public Control MakeControl()
{
_statusControl = new StatusControl(this);
_statusControl.Update();
return _statusControl;
}
public void DestroyControl(Control control)
{
if (_statusControl == control)
{
_statusControl = null;
}
}
private sealed class StatusControl : Control
{
private readonly ClientBoltActionBarrelComponent _parent;
private readonly HBoxContainer _bulletsListTop;
private readonly HBoxContainer _bulletsListBottom;
private readonly TextureRect _chamberedBullet;
private readonly Label _noMagazineLabel;
public StatusControl(ClientBoltActionBarrelComponent parent)
{
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
{
Text = "No Magazine!",
StyleClasses = {StyleNano.StyleClassItemStatus}
})
}
},
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
})
}
}
}
});
}
public void Update()
{
_chamberedBullet.ModulateSelfOverride =
_parent.Chamber.chambered ?
_parent.Chamber.spent ? Color.Red : Color.FromHex("#d7df60")
: Color.Black;
_bulletsListTop.RemoveAllChildren();
_bulletsListBottom.RemoveAllChildren();
if (_parent.MagazineCount == null)
{
_noMagazineLabel.Visible = true;
return;
}
var (count, capacity) = _parent.MagazineCount.Value;
_noMagazineLabel.Visible = false;
string texturePath;
if (capacity <= 20)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png";
}
else if (capacity <= 30)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png";
}
else
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png";
}
var texture = StaticIoC.ResC.GetTexture(texturePath);
const int tinyMaxRow = 60;
if (capacity > tinyMaxRow)
{
FillBulletRow(_bulletsListBottom, Math.Min(tinyMaxRow, count), tinyMaxRow, texture);
FillBulletRow(_bulletsListTop, Math.Max(0, count - tinyMaxRow), capacity - tinyMaxRow, texture);
}
else
{
FillBulletRow(_bulletsListBottom, count, capacity, texture);
}
}
private static void FillBulletRow(Control container, int count, int capacity, Texture texture)
{
var colorA = Color.FromHex("#b68f0e");
var colorB = Color.FromHex("#d7df60");
var colorGoneA = Color.FromHex("#000000");
var colorGoneB = Color.FromHex("#222222");
var altColor = false;
for (var i = count; i < capacity; i++)
{
container.AddChild(new TextureRect
{
Texture = texture,
ModulateSelfOverride = altColor ? colorGoneA : colorGoneB
});
altColor ^= true;
}
for (var i = 0; i < count; i++)
{
container.AddChild(new TextureRect
{
Texture = texture,
ModulateSelfOverride = altColor ? colorA : colorB
});
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -1,4 +1,4 @@
using System; using System;
using Content.Client.Animations; using Content.Client.Animations;
using Content.Client.UserInterface.Stylesheets; using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
@@ -138,35 +138,35 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
private sealed class StatusControl : Control private sealed class StatusControl : Control
{ {
private readonly ClientMagazineBarrelComponent _parent; private readonly ClientMagazineBarrelComponent _parent;
private readonly HBoxContainer _bulletsListTop; private readonly HBoxContainer _bulletsList;
private readonly HBoxContainer _bulletsListBottom;
private readonly TextureRect _chamberedBullet; private readonly TextureRect _chamberedBullet;
private readonly Label _noMagazineLabel; private readonly Label _noMagazineLabel;
private readonly Label _ammoCount;
public StatusControl(ClientMagazineBarrelComponent parent) public StatusControl(ClientMagazineBarrelComponent parent)
{ {
_parent = parent; _parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand; SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter; SizeFlagsVertical = SizeFlags.ShrinkCenter;
AddChild(new VBoxContainer
AddChild(new HBoxContainer
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered_rotated.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0, SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
Children = }),
{ new Control() { CustomMinimumSize = (5,0) },
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Control new Control
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
Children = Children =
{ {
(_bulletsListBottom = new HBoxContainer (_bulletsList = new HBoxContainer
{ {
SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0 SeparationOverride = 0
@@ -178,14 +178,12 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
}) })
} }
}, },
(_chamberedBullet = new TextureRect new Control() { CustomMinimumSize = (5,0) },
(_ammoCount = new Label
{ {
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"), StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill, }),
})
}
}
} }
}); });
} }
@@ -195,46 +193,26 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
_chamberedBullet.ModulateSelfOverride = _chamberedBullet.ModulateSelfOverride =
_parent.Chambered ? Color.FromHex("#d7df60") : Color.Black; _parent.Chambered ? Color.FromHex("#d7df60") : Color.Black;
_bulletsListTop.RemoveAllChildren(); _bulletsList.RemoveAllChildren();
_bulletsListBottom.RemoveAllChildren();
if (_parent.MagazineCount == null) if (_parent.MagazineCount == null)
{ {
_noMagazineLabel.Visible = true; _noMagazineLabel.Visible = true;
_ammoCount.Visible = false;
return; return;
} }
var (count, capacity) = _parent.MagazineCount.Value; var (count, capacity) = _parent.MagazineCount.Value;
_noMagazineLabel.Visible = false; _noMagazineLabel.Visible = false;
_ammoCount.Visible = true;
string texturePath; var texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png";
if (capacity <= 20)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png";
}
else if (capacity <= 30)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png";
}
else
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png";
}
var texture = StaticIoC.ResC.GetTexture(texturePath); var texture = StaticIoC.ResC.GetTexture(texturePath);
const int tinyMaxRow = 60; _ammoCount.Text = $"x{count:00}";
capacity = Math.Min(capacity, 20);
if (capacity > tinyMaxRow) FillBulletRow(_bulletsList, count, capacity, texture);
{
FillBulletRow(_bulletsListBottom, Math.Min(tinyMaxRow, count), tinyMaxRow, texture);
FillBulletRow(_bulletsListTop, Math.Max(0, count - tinyMaxRow), capacity - tinyMaxRow, texture);
}
else
{
FillBulletRow(_bulletsListBottom, count, capacity, texture);
}
} }
private static void FillBulletRow(Control container, int count, int capacity, Texture texture) private static void FillBulletRow(Control container, int count, int capacity, Texture texture)
@@ -246,23 +224,32 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
var altColor = false; var altColor = false;
// Draw the empty ones
for (var i = count; i < capacity; i++) for (var i = count; i < capacity; i++)
{ {
container.AddChild(new TextureRect container.AddChild(new TextureRect
{ {
Texture = texture, Texture = texture,
ModulateSelfOverride = altColor ? colorGoneA : colorGoneB ModulateSelfOverride = altColor ? colorGoneA : colorGoneB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
}); });
altColor ^= true; altColor ^= true;
} }
// Draw the full ones, but limit the count to the capacity
count = Math.Min(count, capacity);
for (var i = 0; i < count; i++) for (var i = 0; i < count; i++)
{ {
container.AddChild(new TextureRect container.AddChild(new TextureRect
{ {
Texture = texture, Texture = texture,
ModulateSelfOverride = altColor ? colorA : colorB ModulateSelfOverride = altColor ? colorA : colorB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
}); });
altColor ^= true; altColor ^= true;

View File

@@ -0,0 +1,208 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Text;
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
[RegisterComponent]
public class ClientPumpBarrelComponent : Component, IItemStatus
{
public override string Name => "PumpBarrel";
public override uint? NetID => ContentNetIDs.PUMP_BARREL;
private StatusControl _statusControl;
/// <summary>
/// chambered is true when a bullet is chambered
/// spent is true when the chambered bullet is spent
/// </summary>
[ViewVariables]
public (bool chambered, bool spent) Chamber { get; private set; }
/// <summary>
/// Count of bullets in the magazine.
/// </summary>
/// <remarks>
/// Null if no magazine is inserted.
/// </remarks>
[ViewVariables]
public (int count, int max)? MagazineCount { get; private set; }
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is PumpBarrelComponentState cast))
return;
Chamber = cast.Chamber;
MagazineCount = cast.Magazine;
_statusControl?.Update();
}
public Control MakeControl()
{
_statusControl = new StatusControl(this);
_statusControl.Update();
return _statusControl;
}
public void DestroyControl(Control control)
{
if (_statusControl == control)
{
_statusControl = null;
}
}
private sealed class StatusControl : Control
{
private readonly ClientPumpBarrelComponent _parent;
private readonly HBoxContainer _bulletsListTop;
private readonly HBoxContainer _bulletsListBottom;
private readonly TextureRect _chamberedBullet;
private readonly Label _noMagazineLabel;
public StatusControl(ClientPumpBarrelComponent parent)
{
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
{
Text = "No Magazine!",
StyleClasses = {StyleNano.StyleClassItemStatus}
})
}
},
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
})
}
}
}
});
}
public void Update()
{
_chamberedBullet.ModulateSelfOverride =
_parent.Chamber.chambered ?
_parent.Chamber.spent ? Color.Red : Color.FromHex("#d7df60")
: Color.Black;
_bulletsListTop.RemoveAllChildren();
_bulletsListBottom.RemoveAllChildren();
if (_parent.MagazineCount == null)
{
_noMagazineLabel.Visible = true;
return;
}
var (count, capacity) = _parent.MagazineCount.Value;
_noMagazineLabel.Visible = false;
string texturePath;
if (capacity <= 20)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png";
}
else if (capacity <= 30)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png";
}
else
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png";
}
var texture = StaticIoC.ResC.GetTexture(texturePath);
const int tinyMaxRow = 60;
if (capacity > tinyMaxRow)
{
FillBulletRow(_bulletsListBottom, Math.Min(tinyMaxRow, count), tinyMaxRow, texture);
FillBulletRow(_bulletsListTop, Math.Max(0, count - tinyMaxRow), capacity - tinyMaxRow, texture);
}
else
{
FillBulletRow(_bulletsListBottom, count, capacity, texture);
}
}
private static void FillBulletRow(Control container, int count, int capacity, Texture texture)
{
var colorA = Color.FromHex("#b68f0e");
var colorB = Color.FromHex("#d7df60");
var colorGoneA = Color.FromHex("#000000");
var colorGoneB = Color.FromHex("#222222");
var altColor = false;
for (var i = count; i < capacity; i++)
{
container.AddChild(new TextureRect
{
Texture = texture,
ModulateSelfOverride = altColor ? colorGoneA : colorGoneB
});
altColor ^= true;
}
for (var i = 0; i < count; i++)
{
container.AddChild(new TextureRect
{
Texture = texture,
ModulateSelfOverride = altColor ? colorA : colorB
});
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -0,0 +1,175 @@
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
[RegisterComponent]
public class ClientRevolverBarrelComponent : Component, IItemStatus
{
public override string Name => "RevolverBarrel";
public override uint? NetID => ContentNetIDs.REVOLVER_BARREL;
private StatusControl _statusControl;
/// <summary>
/// A array that lists the bullet states
/// true means a spent bullet
/// false means a "shootable" bullet
/// null means no bullet
/// </summary>
[ViewVariables]
public bool?[] Bullets { get; private set; }
[ViewVariables]
public int CurrentSlot { get; private set; }
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
if (!(curState is RevolverBarrelComponentState cast))
return;
CurrentSlot = cast.CurrentSlot;
Bullets = cast.Bullets;
_statusControl?.Update();
}
public Control MakeControl()
{
_statusControl = new StatusControl(this);
_statusControl.Update();
return _statusControl;
}
public void DestroyControl(Control control)
{
if (_statusControl == control)
{
_statusControl = null;
}
}
private sealed class StatusControl : Control
{
private readonly ClientRevolverBarrelComponent _parent;
private readonly HBoxContainer _bulletsList;
public StatusControl(ClientRevolverBarrelComponent parent)
{
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
AddChild((_bulletsList = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SeparationOverride = 0
}));
}
public void Update()
{
_bulletsList.RemoveAllChildren();
var capacity = _parent.Bullets.Length;
string texturePath;
if (capacity <= 20)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/normal.png";
}
else if (capacity <= 30)
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/small.png";
}
else
{
texturePath = "/Textures/Interface/ItemStatus/Bullets/tiny.png";
}
var texture = StaticIoC.ResC.GetTexture(texturePath);
var spentTexture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/empty.png");
FillBulletRow(_bulletsList, texture, spentTexture);
}
private void FillBulletRow(Control container, Texture texture, Texture emptyTexture)
{
var colorA = Color.FromHex("#b68f0e");
var colorB = Color.FromHex("#d7df60");
var colorSpentA = Color.FromHex("#b50e25");
var colorSpentB = Color.FromHex("#d3745f");
var colorGoneA = Color.FromHex("#000000");
var colorGoneB = Color.FromHex("#222222");
var altColor = false;
var scale = 1.3f;
for (var i = 0; i < _parent.Bullets.Length; i++)
{
var bulletSpent = _parent.Bullets[i];
// Add a outline
var box = new Control()
{
CustomMinimumSize = texture.Size * scale,
};
if (i == _parent.CurrentSlot)
{
box.AddChild(new TextureRect
{
Texture = texture,
TextureScale = (scale, scale),
ModulateSelfOverride = Color.Green,
});
}
Color color;
Texture bulletTexture = texture;
if (bulletSpent.HasValue)
{
if (bulletSpent.Value)
{
color = altColor ? colorSpentA : colorSpentB;
bulletTexture = emptyTexture;
}
else
{
color = altColor ? colorA : colorB;
}
}
else
{
color = altColor ? colorGoneA : colorGoneB;
}
box.AddChild(new TextureRect
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = bulletTexture,
ModulateSelfOverride = color,
});
altColor ^= true;
container.AddChild(box);
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -10,6 +10,9 @@ namespace Content.Client.GameObjects.Components.Wires
{ {
base.OnChangeData(component); base.OnChangeData(component);
if (component.Owner.Deleted)
return;
var sprite = component.Owner.GetComponent<ISpriteComponent>(); var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state)) if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state))
{ {

View File

@@ -15,9 +15,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
#if DEBUG #if DEBUG
public class ClientAiDebugSystem : EntitySystem public class ClientAiDebugSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private IEyeManager _eyeManager;
#pragma warning restore 649
private AiDebugMode _tooltips = AiDebugMode.None; private AiDebugMode _tooltips = AiDebugMode.None;
private readonly Dictionary<IEntity, PanelContainer> _aiBoxes = new Dictionary<IEntity,PanelContainer>(); private readonly Dictionary<IEntity, PanelContainer> _aiBoxes = new Dictionary<IEntity,PanelContainer>();

View File

@@ -0,0 +1,10 @@
using Content.Shared.GameObjects.EntitySystems.Atmos;
using JetBrains.Annotations;
namespace Content.Client.GameObjects.EntitySystems
{
[UsedImplicitly]
public class AtmosphereSystem : SharedAtmosphereSystem
{
}
}

View File

@@ -11,10 +11,8 @@ namespace Content.Client.GameObjects.EntitySystems
{ {
public sealed class CharacterInterfaceSystem : EntitySystem public sealed class CharacterInterfaceSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager;
#pragma warning restore 649
public override void Initialize() public override void Initialize()
{ {

View File

@@ -11,10 +11,8 @@ namespace Content.Client.GameObjects.EntitySystems
{ {
public sealed class ClientInventorySystem : EntitySystem public sealed class ClientInventorySystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager;
#pragma warning restore 649
public override void Initialize() public override void Initialize()
{ {

View File

@@ -17,11 +17,9 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
public sealed class CombatModeSystem : SharedCombatModeSystem public sealed class CombatModeSystem : SharedCombatModeSystem
{ {
#pragma warning disable 649 [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming;
#pragma warning restore 649
public override void Initialize() public override void Initialize()
{ {

View File

@@ -24,11 +24,9 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
public class ConstructionSystem : SharedConstructionSystem public class ConstructionSystem : SharedConstructionSystem
{ {
#pragma warning disable 649 [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager;
#pragma warning restore 649
private int _nextId; private int _nextId;
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new Dictionary<int, ConstructionGhostComponent>(); private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new Dictionary<int, ConstructionGhostComponent>();

View File

@@ -30,6 +30,13 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
public class DragDropSystem : EntitySystem public class DragDropSystem : EntitySystem
{ {
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
// drag will be triggered when mouse leaves this deadzone around the click position. // drag will be triggered when mouse leaves this deadzone around the click position.
private const float DragDeadzone = 2f; private const float DragDeadzone = 2f;
// how often to recheck possible targets (prevents calling expensive // how often to recheck possible targets (prevents calling expensive
@@ -44,15 +51,6 @@ namespace Content.Client.GameObjects.EntitySystems
private const string ShaderDropTargetInRange = "SelectionOutlineInrange"; private const string ShaderDropTargetInRange = "SelectionOutlineInrange";
private const string ShaderDropTargetOutOfRange = "SelectionOutline"; private const string ShaderDropTargetOutOfRange = "SelectionOutline";
#pragma warning disable 649
[Dependency] private readonly IStateManager _stateManager;
[Dependency] private readonly IEntityManager _entityManager;
[Dependency] private readonly IInputManager _inputManager;
[Dependency] private readonly IEyeManager _eyeManager;
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly IMapManager _mapManager;
#pragma warning restore 649
// entity performing the drag action // entity performing the drag action
private IEntity _dragger; private IEntity _dragger;
private IEntity _draggedEntity; private IEntity _draggedEntity;

View File

@@ -25,14 +25,12 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
internal sealed class ExamineSystem : ExamineSystemShared internal sealed class ExamineSystem : ExamineSystemShared
{ {
public const string StyleClassEntityTooltip = "entity-tooltip"; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
#pragma warning disable 649 public const string StyleClassEntityTooltip = "entity-tooltip";
[Dependency] private IInputManager _inputManager;
[Dependency] private IUserInterfaceManager _userInterfaceManager;
[Dependency] private IEntityManager _entityManager;
[Dependency] private IPlayerManager _playerManager;
#pragma warning restore 649
private Popup _examineTooltipOpen; private Popup _examineTooltipOpen;
private CancellationTokenSource _requestCancelTokenSource; private CancellationTokenSource _requestCancelTokenSource;

View File

@@ -2,12 +2,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Content.Client.Atmos; using Content.Client.Atmos;
using Content.Client.GameObjects.Components.Atmos;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.GameObjects.EntitySystems.Atmos; using Content.Shared.GameObjects.EntitySystems.Atmos;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.Interfaces.Graphics.Overlays; using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
@@ -47,15 +44,19 @@ namespace Content.Client.GameObjects.EntitySystems
private Dictionary<GridId, Dictionary<MapIndices, GasOverlayChunk>> _tileData = private Dictionary<GridId, Dictionary<MapIndices, GasOverlayChunk>> _tileData =
new Dictionary<GridId, Dictionary<MapIndices, GasOverlayChunk>>(); new Dictionary<GridId, Dictionary<MapIndices, GasOverlayChunk>>();
private AtmosphereSystem _atmosphereSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
SubscribeNetworkEvent<GasOverlayMessage>(HandleGasOverlayMessage); SubscribeNetworkEvent<GasOverlayMessage>(HandleGasOverlayMessage);
_mapManager.OnGridRemoved += OnGridRemoved; _mapManager.OnGridRemoved += OnGridRemoved;
_atmosphereSystem = Get<AtmosphereSystem>();
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++) for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
{ {
var overlay = Atmospherics.GetOverlay(i); var overlay = _atmosphereSystem.GetOverlay(i);
switch (overlay) switch (overlay)
{ {
case SpriteSpecifier.Rsi animated: case SpriteSpecifier.Rsi animated:

View File

@@ -19,9 +19,7 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
internal sealed class IconSmoothSystem : EntitySystem internal sealed class IconSmoothSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IMapManager _mapManager;
#pragma warning restore 649
private readonly Queue<IEntity> _dirtyEntities = new Queue<IEntity>(); private readonly Queue<IEntity> _dirtyEntities = new Queue<IEntity>();

View File

@@ -17,9 +17,7 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
public sealed class MeleeWeaponSystem : EntitySystem public sealed class MeleeWeaponSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
public override void Initialize() public override void Initialize()
{ {

View File

@@ -17,14 +17,11 @@ namespace Content.Client.GameObjects.EntitySystems
{ {
public class RangedWeaponSystem : EntitySystem public class RangedWeaponSystem : EntitySystem
{ {
[Dependency] private readonly IPlayerManager _playerManager = default!;
#pragma warning disable 649 [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEyeManager _eyeManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IMapManager _mapManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IInputManager _inputManager;
[Dependency] private readonly IGameTiming _gameTiming;
#pragma warning restore 649
private InputSystem _inputSystem; private InputSystem _inputSystem;
private CombatModeSystem _combatModeSystem; private CombatModeSystem _combatModeSystem;

View File

@@ -7,9 +7,7 @@ namespace Content.Client.GameObjects.EntitySystems
{ {
public class StatusEffectsSystem : EntitySystem public class StatusEffectsSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private IGameTiming _gameTiming;
#pragma warning restore 649
public override void FrameUpdate(float frameTime) public override void FrameUpdate(float frameTime)
{ {

View File

@@ -15,12 +15,10 @@ namespace Content.Client.GameObjects.EntitySystems
/// </summary> /// </summary>
internal sealed class SubFloorHideSystem : EntitySystem internal sealed class SubFloorHideSystem : EntitySystem
{ {
private bool _enableAll; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
#pragma warning disable 649 private bool _enableAll;
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
#pragma warning restore 649
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public bool EnableAll public bool EnableAll

View File

@@ -42,16 +42,14 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly] [UsedImplicitly]
public sealed class VerbSystem : EntitySystem public sealed class VerbSystem : EntitySystem
{ {
#pragma warning disable 649 [Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IStateManager _stateManager; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IMapManager _mapManager;
#pragma warning restore 649
private EntityList _currentEntityList; private EntityList _currentEntityList;
private VerbPopup _currentVerbListRoot; private VerbPopup _currentVerbListRoot;

View File

@@ -17,10 +17,8 @@ namespace Content.Client.GameTicking
{ {
public class ClientGameTicker : SharedGameTicker, IClientGameTicker public class ClientGameTicker : SharedGameTicker, IClientGameTicker
{ {
#pragma warning disable 649 [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private IClientNetManager _netManager; [Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private IStateManager _stateManager;
#pragma warning restore 649
[ViewVariables] private bool _initialized; [ViewVariables] private bool _initialized;

View File

@@ -11,10 +11,8 @@ namespace Content.Client.Graphics.Overlays
{ {
public class CircleMaskOverlay : Overlay public class CircleMaskOverlay : Overlay
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager;
#pragma warning restore 649
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _shader; private readonly ShaderInstance _shader;

View File

@@ -16,11 +16,9 @@ namespace Content.Client.Graphics.Overlays
{ {
public class FlashOverlay : Overlay, IConfigurable<TimedOverlayParameter> public class FlashOverlay : Overlay, IConfigurable<TimedOverlayParameter>
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IClyde _displayManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming;
#pragma warning restore 649
public override OverlaySpace Space => OverlaySpace.ScreenSpace; public override OverlaySpace Space => OverlaySpace.ScreenSpace;
private readonly ShaderInstance _shader; private readonly ShaderInstance _shader;

View File

@@ -11,10 +11,9 @@ namespace Content.Client.Graphics.Overlays
{ {
public class GradientCircleMaskOverlay : Overlay public class GradientCircleMaskOverlay : Overlay
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager;
#pragma warning restore 649
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _shader; private readonly ShaderInstance _shader;

View File

@@ -86,9 +86,6 @@
"CanSpill", "CanSpill",
"SpeedLoader", "SpeedLoader",
"Hitscan", "Hitscan",
"BoltActionBarrel",
"PumpBarrel",
"RevolverBarrel",
"ExplosiveProjectile", "ExplosiveProjectile",
"StunnableProjectile", "StunnableProjectile",
"RandomPottedPlant", "RandomPottedPlant",
@@ -108,7 +105,6 @@
"SecureEntityStorage", "SecureEntityStorage",
"PresetIdCard", "PresetIdCard",
"SolarControlConsole", "SolarControlConsole",
"BatteryBarrel",
"FlashExplosive", "FlashExplosive",
"FlashProjectile", "FlashProjectile",
"Utensil", "Utensil",
@@ -162,6 +158,11 @@
"GasVapor", "GasVapor",
"MobStateManager", "MobStateManager",
"Metabolism", "Metabolism",
"AiFactionTag",
"PressureProtection",
"DebugPump",
"DebugVent",
"DebugSiphon",
}; };
} }
} }

View File

@@ -50,6 +50,7 @@ namespace Content.Client.Input
common.AddFunction(ContentKeyFunctions.OpenEntitySpawnWindow); common.AddFunction(ContentKeyFunctions.OpenEntitySpawnWindow);
common.AddFunction(ContentKeyFunctions.OpenSandboxWindow); common.AddFunction(ContentKeyFunctions.OpenSandboxWindow);
common.AddFunction(ContentKeyFunctions.OpenTileSpawnWindow); common.AddFunction(ContentKeyFunctions.OpenTileSpawnWindow);
common.AddFunction(ContentKeyFunctions.OpenAdminMenu);
} }
} }
} }

View File

@@ -20,10 +20,8 @@ namespace Content.Client.Instruments
{ {
public class InstrumentMenu : SS14Window public class InstrumentMenu : SS14Window
{ {
#pragma warning disable 649 [Dependency] private readonly IMidiManager _midiManager = default!;
[Dependency] private IMidiManager _midiManager; [Dependency] private readonly IFileDialogManager _fileDialogManager = default!;
[Dependency] private IFileDialogManager _fileDialogManager;
#pragma warning restore 649
private InstrumentBoundUserInterface _owner; private InstrumentBoundUserInterface _owner;
private Button midiLoopButton; private Button midiLoopButton;

View File

@@ -19,11 +19,9 @@ namespace Content.Client.Parallax
{ {
internal sealed class ParallaxManager : IParallaxManager, IPostInjectInit internal sealed class ParallaxManager : IParallaxManager, IPostInjectInit
{ {
#pragma warning disable 649 [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly ILogManager _logManager; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager;
#pragma warning restore 649
private static readonly ResourcePath ParallaxConfigPath = new ResourcePath("/parallax_config.toml"); private static readonly ResourcePath ParallaxConfigPath = new ResourcePath("/parallax_config.toml");

View File

@@ -13,12 +13,10 @@ namespace Content.Client.Parallax
{ {
public class ParallaxOverlay : Overlay public class ParallaxOverlay : Overlay
{ {
#pragma warning disable 649 [Dependency] private readonly IParallaxManager _parallaxManager = default!;
[Dependency] private readonly IParallaxManager _parallaxManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager; [Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IClyde _displayManager; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
public override bool AlwaysDirty => true; public override bool AlwaysDirty => true;
private const float Slowness = 0.5f; private const float Slowness = 0.5f;

View File

@@ -14,9 +14,7 @@ namespace Content.Client.Research
{ {
public class LatheMenu : SS14Window public class LatheMenu : SS14Window
{ {
#pragma warning disable CS0649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private IPrototypeManager PrototypeManager;
#pragma warning restore
private ItemList Items; private ItemList Items;
private ItemList Materials; private ItemList Materials;
@@ -174,7 +172,7 @@ namespace Content.Client.Research
foreach (var (id, amount) in Owner.Storage) foreach (var (id, amount) in Owner.Storage)
{ {
if (!PrototypeManager.TryIndex(id, out MaterialPrototype materialPrototype)) continue; if (!_prototypeManager.TryIndex(id, out MaterialPrototype materialPrototype)) continue;
var material = materialPrototype.Material; var material = materialPrototype.Material;
Materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false); Materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false);
} }

View File

@@ -32,9 +32,7 @@ namespace Content.Client.Research
private ItemList _unlockableTechnologies; private ItemList _unlockableTechnologies;
private ItemList _futureTechnologies; private ItemList _futureTechnologies;
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
public Button UnlockButton { get; private set; } public Button UnlockButton { get; private set; }
public Button ServerSelectionButton { get; private set; } public Button ServerSelectionButton { get; private set; }

View File

@@ -74,19 +74,18 @@ namespace Content.Client.Sandbox
vBox.AddChild(ShowBbButton); vBox.AddChild(ShowBbButton);
} }
} }
internal class SandboxManager : SharedSandboxManager, ISandboxManager internal class SandboxManager : SharedSandboxManager, ISandboxManager
{ {
#pragma warning disable 649 [Dependency] private readonly IClientConsole _console = default!;
[Dependency] private readonly IClientConsole _console; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IClientNetManager _netManager; [Dependency] private readonly ILocalizationManager _localization = default!;
[Dependency] private readonly ILocalizationManager _localization; [Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IPlacementManager _placementManager; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager;
#pragma warning restore 649
public bool SandboxAllowed { get; private set; } public bool SandboxAllowed { get; private set; }

View File

@@ -14,12 +14,10 @@ namespace Content.Client.State
{ {
public class GameScreen : GameScreenBase public class GameScreen : GameScreenBase
{ {
#pragma warning disable 649 [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IGameHud _gameHud; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IChatManager _chatManager;
#pragma warning restore 649
[ViewVariables] private ChatBox _gameChat; [ViewVariables] private ChatBox _gameChat;

View File

@@ -28,17 +28,15 @@ namespace Content.Client.State
// Instantiated dynamically through the StateManager, Dependencies will be resolved. // Instantiated dynamically through the StateManager, Dependencies will be resolved.
public partial class GameScreenBase : Robust.Client.State.State public partial class GameScreenBase : Robust.Client.State.State
{ {
#pragma warning disable 649 [Dependency] protected readonly IClientEntityManager EntityManager = default!;
[Dependency] protected readonly IClientEntityManager EntityManager; [Dependency] protected readonly IInputManager InputManager = default!;
[Dependency] protected readonly IInputManager InputManager; [Dependency] protected readonly IPlayerManager PlayerManager = default!;
[Dependency] protected readonly IPlayerManager PlayerManager; [Dependency] protected readonly IEyeManager EyeManager = default!;
[Dependency] protected readonly IEyeManager EyeManager; [Dependency] protected readonly IEntitySystemManager EntitySystemManager = default!;
[Dependency] protected readonly IEntitySystemManager EntitySystemManager; [Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly IGameTiming Timing; [Dependency] protected readonly IMapManager MapManager = default!;
[Dependency] protected readonly IMapManager MapManager; [Dependency] protected readonly IUserInterfaceManager UserInterfaceManager = default!;
[Dependency] protected readonly IUserInterfaceManager UserInterfaceManager; [Dependency] protected readonly IConfigurationManager ConfigurationManager = default!;
[Dependency] protected readonly IConfigurationManager ConfigurationManager;
#pragma warning restore 649
private IEntity _lastHoveredEntity; private IEntity _lastHoveredEntity;

View File

@@ -16,13 +16,11 @@ namespace Content.Client.State
{ {
public class LauncherConnecting : Robust.Client.State.State public class LauncherConnecting : Robust.Client.State.State
{ {
#pragma warning disable 649 [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IStylesheetManager _stylesheetManager = default!;
[Dependency] private readonly IStylesheetManager _stylesheetManager; [Dependency] private readonly IClientNetManager _clientNetManager = default!;
[Dependency] private readonly IClientNetManager _clientNetManager; [Dependency] private readonly IGameController _gameController = default!;
[Dependency] private readonly IGameController _gameController; [Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IBaseClient _baseClient;
#pragma warning restore 649
private Control _control; private Control _control;
private Label _connectStatus; private Label _connectStatus;

View File

@@ -1,6 +1,4 @@
using System; using Content.Client.Interfaces;
using System.Linq;
using Content.Client.Interfaces;
using Content.Client.Interfaces.Chat; using Content.Client.Interfaces.Chat;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Shared.Input; using Content.Shared.Input;
@@ -18,25 +16,25 @@ using Robust.Shared.Localization;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
using System;
using System.Linq;
using static Content.Shared.SharedGameTicker; using static Content.Shared.SharedGameTicker;
namespace Content.Client.State namespace Content.Client.State
{ {
public class LobbyState : Robust.Client.State.State public class LobbyState : Robust.Client.State.State
{ {
#pragma warning disable 649 [Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IBaseClient _baseClient; [Dependency] private readonly IClientConsole _console = default!;
[Dependency] private readonly IClientConsole _console; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IChatManager _chatManager; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IClientGameTicker _clientGameTicker = default!;
[Dependency] private readonly IClientGameTicker _clientGameTicker; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
[Dependency] private readonly IClientPreferencesManager _preferencesManager;
#pragma warning restore 649
[ViewVariables] private CharacterSetupGui _characterSetup; [ViewVariables] private CharacterSetupGui _characterSetup;
[ViewVariables] private LobbyGui _lobby; [ViewVariables] private LobbyGui _lobby;
@@ -211,12 +209,11 @@ namespace Content.Client.State
private void UpdatePlayerList() private void UpdatePlayerList()
{ {
_lobby.OnlinePlayerItemList.Clear(); _lobby.OnlinePlayerList.Clear();
_lobby.PlayerReadyList.Clear();
foreach (var session in _playerManager.Sessions.OrderBy(s => s.Name)) foreach (var session in _playerManager.Sessions.OrderBy(s => s.Name))
{ {
_lobby.OnlinePlayerItemList.AddItem(session.Name);
var readyState = ""; var readyState = "";
// Don't show ready state if we're ingame // Don't show ready state if we're ingame
@@ -236,7 +233,7 @@ namespace Content.Client.State
_ => "", _ => "",
}; };
} }
_lobby.PlayerReadyList.AddItem(readyState, null, false); _lobby.OnlinePlayerList.AddItem(session.Name, readyState);
} }
} }

View File

@@ -27,15 +27,13 @@ namespace Content.Client.State
{ {
private const string PublicServerAddress = "server.spacestation14.io"; private const string PublicServerAddress = "server.spacestation14.io";
#pragma warning disable 649 [Dependency] private readonly IBaseClient _client = default!;
[Dependency] private readonly IBaseClient _client; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IClientNetManager _netManager; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager; [Dependency] private readonly IGameController _controllerProxy = default!;
[Dependency] private readonly IGameController _controllerProxy; [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ILocalizationManager _loc; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager userInterfaceManager;
#pragma warning restore 649
private MainMenuControl _mainMenuControl; private MainMenuControl _mainMenuControl;
private OptionsMenu OptionsMenu; private OptionsMenu OptionsMenu;
@@ -48,7 +46,7 @@ namespace Content.Client.State
public override void Startup() public override void Startup()
{ {
_mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager); _mainMenuControl = new MainMenuControl(_resourceCache, _configurationManager);
userInterfaceManager.StateRoot.AddChild(_mainMenuControl); _userInterfaceManager.StateRoot.AddChild(_mainMenuControl);
_mainMenuControl.QuitButton.OnPressed += QuitButtonPressed; _mainMenuControl.QuitButton.OnPressed += QuitButtonPressed;
_mainMenuControl.OptionsButton.OnPressed += OptionsButtonPressed; _mainMenuControl.OptionsButton.OnPressed += OptionsButtonPressed;
@@ -108,7 +106,7 @@ namespace Content.Client.State
if (!UsernameHelpers.IsNameValid(inputName, out var reason)) if (!UsernameHelpers.IsNameValid(inputName, out var reason))
{ {
var invalidReason = _loc.GetString(reason.ToText()); var invalidReason = _loc.GetString(reason.ToText());
userInterfaceManager.Popup( _userInterfaceManager.Popup(
_loc.GetString("Invalid username:\n{0}", invalidReason), _loc.GetString("Invalid username:\n{0}", invalidReason),
_loc.GetString("Invalid Username")); _loc.GetString("Invalid Username"));
return; return;
@@ -130,7 +128,7 @@ namespace Content.Client.State
} }
catch (ArgumentException e) catch (ArgumentException e)
{ {
userInterfaceManager.Popup($"Unable to connect: {e.Message}", "Connection error."); _userInterfaceManager.Popup($"Unable to connect: {e.Message}", "Connection error.");
Logger.Warning(e.ToString()); Logger.Warning(e.ToString());
_netManager.ConnectFailed -= _onConnectFailed; _netManager.ConnectFailed -= _onConnectFailed;
} }
@@ -185,7 +183,7 @@ namespace Content.Client.State
private void _onConnectFailed(object _, NetConnectFailArgs args) private void _onConnectFailed(object _, NetConnectFailArgs args)
{ {
userInterfaceManager.Popup($"Failed to connect:\n{args.Reason}"); _userInterfaceManager.Popup($"Failed to connect:\n{args.Reason}");
_netManager.ConnectFailed -= _onConnectFailed; _netManager.ConnectFailed -= _onConnectFailed;
_setConnectingState(false); _setConnectingState(false);
} }

View File

@@ -9,5 +9,6 @@ namespace Content.Client.StationEvents
public List<string>? StationEvents { get; } public List<string>? StationEvents { get; }
public void Initialize(); public void Initialize();
public event Action OnStationEventsReceived; public event Action OnStationEventsReceived;
public void RequestEvents();
} }
} }

View File

@@ -0,0 +1,103 @@
using Content.Shared.Input;
using Robust.Client.Console;
using Robust.Client.Interfaces.Input;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
using System.Collections.Generic;
namespace Content.Client.UserInterface.AdminMenu
{
internal class AdminMenuManager : IAdminMenuManager
{
[Dependency] private INetManager _netManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IClientConGroupController _clientConGroupController = default!;
private SS14Window _window;
private List<SS14Window> _commandWindows;
public void Initialize()
{
_commandWindows = new List<SS14Window>();
// Reset the AdminMenu Window on disconnect
_netManager.Disconnect += (sender, channel) => ResetWindow();
_inputManager.SetInputCommand(ContentKeyFunctions.OpenAdminMenu,
InputCmdHandler.FromDelegate(session => Toggle()));
}
public void ResetWindow()
{
_window?.Close();
_window = null;
foreach (var window in _commandWindows)
window?.Dispose();
_commandWindows.Clear();
}
public void OpenCommand(SS14Window window)
{
_commandWindows.Add(window);
window.OpenCentered();
}
public void Open()
{
if (_window == null)
_window = new AdminMenuWindow();
_window.OpenCentered();
}
public void Close()
{
_window?.Close();
foreach (var window in _commandWindows)
window?.Dispose();
_commandWindows.Clear();
}
/// <summary>
/// Checks if the player can open the window
/// </summary>
/// <returns>True if the player is allowed</returns>
public bool CanOpen()
{
return _clientConGroupController.CanAdminMenu();
}
/// <summary>
/// Checks if the player can open the window and tries to open it
/// </summary>
public void TryOpen()
{
if (CanOpen())
Open();
}
public void Toggle()
{
if (_window != null && _window.IsOpen)
{
Close();
}
else
{
TryOpen();
}
}
}
internal interface IAdminMenuManager
{
void Initialize();
void Open();
void OpenCommand(SS14Window window);
bool CanOpen();
void TryOpen();
void Toggle();
}
}

View File

@@ -0,0 +1,670 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.StationEvents;
using Content.Shared.Atmos;
using Robust.Client.Console;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.UserInterface.AdminMenu
{
public class AdminMenuWindow : SS14Window
{
public TabContainer MasterTabContainer;
public VBoxContainer PlayerList;
private List<CommandButton> _adminButtons = new List<CommandButton>
{
new KickCommandButton(),
new DirectCommandButton("Admin Ghost", "aghost"),
//TODO: teleport
};
private List<CommandButton> _adminbusButtons = new List<CommandButton>
{
new SpawnEntitiesCommandButton(),
new SpawnTilesCommandButton(),
new StationEventsCommandButton(),
};
private List<CommandButton> _debugButtons = new List<CommandButton>
{
new AddAtmosCommandButton(),
new FillGasCommandButton(),
};
private List<CommandButton> _roundButtons = new List<CommandButton>
{
new DirectCommandButton("Start Round", "startround"),
new DirectCommandButton("End Round", "endround"),
new DirectCommandButton("Restart Round", "restartround"),
};
private List<CommandButton> _serverButtons = new List<CommandButton>
{
new DirectCommandButton("Reboot", "restart"),
new DirectCommandButton("Shutdown", "shutdown"),
};
private void RefreshPlayerList(ButtonEventArgs args)
{
PlayerList.RemoveAllChildren();
var sessions = IoCManager.Resolve<IPlayerManager>().Sessions;
var header = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label { Text = "Name",
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label { Text = "Player",
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label { Text = "Status",
SizeFlagsStretchRatio = 1f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label { Text = "Ping",
SizeFlagsStretchRatio = 1f,
SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right },
}
};
PlayerList.AddChild(header);
PlayerList.AddChild(new Controls.HighDivider());
foreach (var player in sessions)
{
var hbox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {
Text = player.Name,
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label {
Text = player.AttachedEntity?.Name,
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label {
Text = player.Status.ToString(),
SizeFlagsStretchRatio = 1f,
SizeFlagsHorizontal = SizeFlags.FillExpand },
new Label {
Text = player.Ping.ToString(),
SizeFlagsStretchRatio = 1f,
SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right },
}
};
PlayerList.AddChild(hbox);
}
}
private void AddCommandButton(List<CommandButton> buttons, Control parent)
{
foreach (var cmd in buttons)
{
// Check if the player can do the command
if (!cmd.CanPress())
continue;
//TODO: make toggle?
var button = new Button
{
Text = cmd.Name
};
button.OnPressed += cmd.ButtonPressed;
parent.AddChild(button);
}
}
public AdminMenuWindow() //TODO: search for buttons?
{
CustomMinimumSize = (415,0);
Title = Loc.GetString("Admin Menu");
#region PlayerList
// Players // List of all the players, their entities and status
var playerTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
PlayerList = new VBoxContainer();
var refreshButton = new Button
{
Text = "Refresh"
};
refreshButton.OnPressed += RefreshPlayerList;
RefreshPlayerList(null!);
var playerVBox = new VBoxContainer
{
Children =
{
refreshButton,
PlayerList
}
};
playerTabContainer.AddChild(playerVBox);
#endregion PlayerList
#region Admin Tab
// Admin Tab // Actual admin stuff
var adminTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
var adminButtonGrid = new GridContainer
{
Columns = 4,
};
AddCommandButton(_adminButtons, adminButtonGrid);
adminTabContainer.AddChild(adminButtonGrid);
#endregion
#region Adminbus
// Adminbus // Fun Commands
var adminbusTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
var adminbusButtonGrid = new GridContainer
{
Columns = 4,
};
AddCommandButton(_adminbusButtons, adminbusButtonGrid);
adminbusTabContainer.AddChild(adminbusButtonGrid);
#endregion
#region Debug
// Debug // Mostly dev tools, like addatmos
var debugTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
var debugButtonGrid = new GridContainer
{
Columns = 4,
};
AddCommandButton(_debugButtons, debugButtonGrid);
debugTabContainer.AddChild(debugButtonGrid);
#endregion
#region Round
// Round // Commands like Check Antags, End Round, RestartRound
var roundTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
var roundButtonGrid = new GridContainer
{
Columns = 4,
};
AddCommandButton(_roundButtons, roundButtonGrid);
roundTabContainer.AddChild(roundButtonGrid);
#endregion
#region Server
// Server // Commands like Restart, Shutdown
var serverTabContainer = new MarginContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 4,
MarginRightOverride = 4,
MarginBottomOverride = 4,
CustomMinimumSize = (50, 50),
};
var serverButtonGrid = new GridContainer
{
Columns = 4,
};
AddCommandButton(_serverButtons, serverButtonGrid);
serverTabContainer.AddChild(serverButtonGrid);
#endregion
//The master menu that contains all of the tabs.
MasterTabContainer = new TabContainer();
//Add all the tabs to the Master container.
MasterTabContainer.AddChild(adminTabContainer);
MasterTabContainer.SetTabTitle(0, Loc.GetString("Admin"));
MasterTabContainer.AddChild(adminbusTabContainer);
MasterTabContainer.SetTabTitle(1, Loc.GetString("Adminbus"));
MasterTabContainer.AddChild(debugTabContainer);
MasterTabContainer.SetTabTitle(2, Loc.GetString("Debug"));
MasterTabContainer.AddChild(roundTabContainer);
MasterTabContainer.SetTabTitle(3, Loc.GetString("Round"));
MasterTabContainer.AddChild(serverTabContainer);
MasterTabContainer.SetTabTitle(4, Loc.GetString("Server"));
MasterTabContainer.AddChild(playerTabContainer);
MasterTabContainer.SetTabTitle(5, Loc.GetString("Players"));
Contents.AddChild(MasterTabContainer);
//Request station events, so we can use them later
IoCManager.Resolve<IStationEventManager>().RequestEvents();
}
#region CommandButtonBaseClass
private abstract class CommandButton
{
public virtual string Name { get; }
public virtual string RequiredCommand { get; }
public abstract void ButtonPressed(ButtonEventArgs args);
public virtual bool CanPress()
{
return RequiredCommand == string.Empty ||
IoCManager.Resolve<IClientConGroupController>().CanCommand(RequiredCommand);
}
public CommandButton() : this(string.Empty, string.Empty) {}
public CommandButton(string name, string command)
{
Name = name;
RequiredCommand = command;
}
}
// Button that opens a UI
private abstract class UICommandButton : CommandButton
{
// The text on the submit button
public virtual string? SubmitText { get; }
/// <summary>
/// Called when the Submit button is pressed
/// </summary>
/// <param name="val">Dictionary of the parameter names and values</param>
public abstract void Submit();
public override void ButtonPressed(ButtonEventArgs args)
{
var manager = IoCManager.Resolve<IAdminMenuManager>();
var window = new CommandWindow(this);
window.Submit += Submit;
manager.OpenCommand(window);
}
// List of all the UI Elements
public abstract List<CommandUIControl> UI { get; }
}
// Button that directly calls a Command
private class DirectCommandButton : CommandButton
{
public DirectCommandButton(string name, string command) : base(name, command) { }
public override void ButtonPressed(ButtonEventArgs args)
{
IoCManager.Resolve<IClientConsole>().ProcessCommand(RequiredCommand);
}
}
#endregion
#region CommandButtons
private class SpawnEntitiesCommandButton : CommandButton
{
public override string Name => "Spawn Entities";
//TODO: override CanPress
public override void ButtonPressed(ButtonEventArgs args)
{
var manager = IoCManager.Resolve<IAdminMenuManager>();
var window = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>(),
IoCManager.Resolve<ILocalizationManager>());
manager.OpenCommand(window);
}
}
private class SpawnTilesCommandButton : CommandButton
{
public override string Name => "Spawn Tiles";
//TODO: override CanPress
public override void ButtonPressed(ButtonEventArgs args)
{
var manager = IoCManager.Resolve<IAdminMenuManager>();
var window = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IResourceCache>());
manager.OpenCommand(window);
}
}
private class StationEventsCommandButton : UICommandButton
{
public override string Name => "Station Events";
public override string RequiredCommand => "events";
public override string? SubmitText => "Run";
private CommandUIDropDown _eventsDropDown = new CommandUIDropDown
{
Name = "Event",
GetData = () =>
{
var events = IoCManager.Resolve<IStationEventManager>().StationEvents;
if (events == null)
return new List<object> { "Not loaded" };
events.Add("Random");
return events.ToList<object>();
},
GetDisplayName = (obj) => (string) obj,
GetValueFromData = (obj) => ((string) obj).ToLower(),
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
{
_eventsDropDown,
new CommandUIButton
{
Name = "Pause",
Handler = () =>
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events pause");
},
},
new CommandUIButton
{
Name = "Resume",
Handler = () =>
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events resume");
},
},
};
public override void Submit()
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events run \"{_eventsDropDown.GetValue()}\"");
}
}
private class KickCommandButton : UICommandButton
{
public override string Name => "Kick";
public override string RequiredCommand => "kick";
private CommandUIDropDown _playerDropDown = new CommandUIDropDown
{
Name = "Player",
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})",
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
};
private CommandUILineEdit _reason = new CommandUILineEdit
{
Name = "Reason"
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
{
_playerDropDown,
_reason
};
public override void Submit()
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"kick \"{_playerDropDown.GetValue()}\" \"{CommandParsing.Escape(_reason.GetValue())}\"");
}
}
private class AddAtmosCommandButton : UICommandButton
{
public override string Name => "Add Atmos";
public override string RequiredCommand => "addatmos";
private CommandUIDropDown _grid = new CommandUIDropDown
{
Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
GetDisplayName = (obj) => $"{((IMapGrid) obj).Index}{(IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID == ((IMapGrid) obj).Index ? " (Current)" : "")}",
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
{
_grid,
};
public override void Submit()
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"addatmos {_grid.GetValue()}");
}
}
private class FillGasCommandButton : UICommandButton
{
public override string Name => "Fill Gas";
public override string RequiredCommand => "fillgas";
private CommandUIDropDown _grid = new CommandUIDropDown
{
Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
GetDisplayName = (obj) => $"{((IMapGrid) obj).Index}{(IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID == ((IMapGrid) obj).Index ? " (Current)" : "")}",
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
};
private CommandUIDropDown _gas = new CommandUIDropDown
{
Name = "Gas",
GetData = () =>
{
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
return atmosSystem.Gases.ToList<object>();
},
GetDisplayName = (obj) => $"{((GasPrototype) obj).Name} ({((GasPrototype) obj).ID})",
GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(),
};
private CommandUISpinBox _amount = new CommandUISpinBox
{
Name = "Amount"
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
{
_grid,
_gas,
_amount,
};
public override void Submit()
{
IoCManager.Resolve<IClientConsole>().ProcessCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
}
}
#endregion
#region CommandUIControls
private abstract class CommandUIControl
{
public string? Name;
public Control? Control;
public abstract Control GetControl();
public abstract string GetValue();
}
private class CommandUIDropDown : CommandUIControl
{
public Func<List<object>>? GetData;
// The string that the player sees in the list
public Func<object, string>? GetDisplayName;
// The value that is given to Submit
public Func<object, string>? GetValueFromData;
// Cache
protected List<object>? Data; //TODO: make this like IEnumerable or smth, so you don't have to do this ToList<object> shittery
public override Control GetControl() //TODO: fix optionbutton being shitty after moving the window
{
var opt = new OptionButton { CustomMinimumSize = (100, 0), SizeFlagsHorizontal = SizeFlags.FillExpand };
Data = GetData!();
foreach (var item in Data)
opt.AddItem(GetDisplayName!(item));
opt.OnItemSelected += eventArgs => opt.SelectId(eventArgs.Id);
Control = opt;
return Control;
}
public override string GetValue()
{
return GetValueFromData!(Data![((OptionButton)Control!).SelectedId]);
}
}
private class CommandUICheckBox : CommandUIControl
{
public override Control GetControl()
{
Control = new CheckBox { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter };
return Control;
}
public override string GetValue()
{
return ((CheckBox)Control!).Pressed ? "1" : "0";
}
}
private class CommandUILineEdit : CommandUIControl
{
public override Control GetControl()
{
Control = new LineEdit { CustomMinimumSize = (100, 0), SizeFlagsHorizontal = SizeFlags.FillExpand };
return Control;
}
public override string GetValue()
{
return ((LineEdit)Control!).Text;
}
}
private class CommandUISpinBox : CommandUIControl
{
public override Control GetControl()
{
Control = new SpinBox { CustomMinimumSize = (100, 0), SizeFlagsHorizontal = SizeFlags.FillExpand };
return Control;
}
public override string GetValue()
{
return ((SpinBox)Control!).Value.ToString();
}
}
private class CommandUIButton : CommandUIControl
{
public Action? Handler { get; set; }
public override Control GetControl()
{
Control = new Button {
CustomMinimumSize = (100, 0),
SizeFlagsHorizontal = SizeFlags.FillExpand,
Text = Name };
return Control;
}
public override string GetValue()
{
return "";
}
}
#endregion
#region CommandWindow
private class CommandWindow : SS14Window
{
List<CommandUIControl> _controls;
public Action? Submit { get; set; }
public CommandWindow(UICommandButton button)
{
Title = button.Name;
_controls = button.UI;
var container = new VBoxContainer //TODO: add margin between different controls
{
};
// Init Controls in a hbox + a label
foreach (var control in _controls)
{
var c = control.GetControl();
if (c is Button)
{
((Button) c).OnPressed += (args) =>
{
((CommandUIButton) control).Handler?.Invoke();
};
container.AddChild(c);
}
else
{
var label = new Label
{
Text = control.Name,
CustomMinimumSize = (100, 0)
};
var divider = new Control
{
CustomMinimumSize = (50, 0)
};
var hbox = new HBoxContainer
{
Children =
{
label,
divider,
c
},
};
container.AddChild(hbox);
}
}
// Init Submit Button
var submitButton = new Button
{
Text = button.SubmitText ?? button.Name
};
submitButton.OnPressed += SubmitPressed;
container.AddChild(submitButton);
Contents.AddChild(container);
}
public void SubmitPressed(ButtonEventArgs args)
{
Submit?.Invoke();
}
}
#endregion
}
}

View File

@@ -15,9 +15,7 @@ namespace Content.Client.UserInterface.Cargo
{ {
public class CargoConsoleMenu : SS14Window public class CargoConsoleMenu : SS14Window
{ {
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ILocalizationManager _loc;
#pragma warning restore 649
protected override Vector2? CustomSize => (400, 600); protected override Vector2? CustomSize => (400, 600);

View File

@@ -8,9 +8,7 @@ namespace Content.Client.UserInterface.Cargo
{ {
class CargoConsoleOrderMenu : SS14Window class CargoConsoleOrderMenu : SS14Window
{ {
#pragma warning disable 649 [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ILocalizationManager _loc;
#pragma warning restore 649
public LineEdit Requester { get; set; } public LineEdit Requester { get; set; }
public LineEdit Reason { get; set; } public LineEdit Reason { get; set; }

View File

@@ -10,16 +10,14 @@ namespace Content.Client.UserInterface.Cargo
{ {
public class GalacticBankSelectionMenu : SS14Window public class GalacticBankSelectionMenu : SS14Window
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
private ItemList _accounts; private ItemList _accounts;
private int _accountCount = 0; private int _accountCount = 0;
private string[] _accountNames = new string[] { }; private string[] _accountNames = new string[] { };
private int[] _accountIds = new int[] { }; private int[] _accountIds = new int[] { };
private int _selectedAccountId = -1; private int _selectedAccountId = -1;
#pragma warning disable 649
[Dependency] private readonly ILocalizationManager _loc;
#pragma warning restore 649
protected override Vector2? CustomSize => (300, 300); protected override Vector2? CustomSize => (300, 300);
public CargoConsoleBoundUserInterface Owner; public CargoConsoleBoundUserInterface Owner;

View File

@@ -47,6 +47,7 @@ namespace Content.Client.UserInterface
Action<bool> SandboxButtonToggled { get; set; } Action<bool> SandboxButtonToggled { get; set; }
Control HandsContainer { get; } Control HandsContainer { get; }
Control SuspicionContainer { get; }
Control InventoryQuickButtonContainer { get; } Control InventoryQuickButtonContainer { get; }
bool CombatPanelVisible { get; set; } bool CombatPanelVisible { get; set; }
@@ -74,13 +75,12 @@ namespace Content.Client.UserInterface
private Button _combatModeButton; private Button _combatModeButton;
private VBoxContainer _combatPanelContainer; private VBoxContainer _combatPanelContainer;
#pragma warning disable 649 [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ILocalizationManager _loc; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager;
#pragma warning restore 649
public Control HandsContainer { get; private set; } public Control HandsContainer { get; private set; }
public Control SuspicionContainer { get; private set; }
public Control InventoryQuickButtonContainer { get; private set; } public Control InventoryQuickButtonContainer { get; private set; }
public bool CombatPanelVisible public bool CombatPanelVisible
@@ -244,6 +244,17 @@ namespace Content.Client.UserInterface
LayoutContainer.SetAnchorAndMarginPreset(HandsContainer, LayoutContainer.LayoutPreset.CenterBottom); LayoutContainer.SetAnchorAndMarginPreset(HandsContainer, LayoutContainer.LayoutPreset.CenterBottom);
LayoutContainer.SetGrowHorizontal(HandsContainer, LayoutContainer.GrowDirection.Both); LayoutContainer.SetGrowHorizontal(HandsContainer, LayoutContainer.GrowDirection.Both);
LayoutContainer.SetGrowVertical(HandsContainer, LayoutContainer.GrowDirection.Begin); LayoutContainer.SetGrowVertical(HandsContainer, LayoutContainer.GrowDirection.Begin);
SuspicionContainer = new MarginContainer
{
SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter
};
RootControl.AddChild(SuspicionContainer);
LayoutContainer.SetAnchorAndMarginPreset(SuspicionContainer, LayoutContainer.LayoutPreset.BottomLeft, margin: 10);
LayoutContainer.SetGrowHorizontal(SuspicionContainer, LayoutContainer.GrowDirection.End);
LayoutContainer.SetGrowVertical(SuspicionContainer, LayoutContainer.GrowDirection.Begin);
} }
private void ButtonTutorialOnOnToggled() private void ButtonTutorialOnOnToggled()

View File

@@ -17,11 +17,9 @@ namespace Content.Client.UserInterface
{ {
public class HandsGui : Control public class HandsGui : Control
{ {
#pragma warning disable 0649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager;
#pragma warning restore 0649
private readonly TextureRect _activeHandRect; private readonly TextureRect _activeHandRect;

View File

@@ -21,15 +21,13 @@ namespace Content.Client.UserInterface
{ {
public class ItemSlotManager : IItemSlotManager public class ItemSlotManager : IItemSlotManager
{ {
#pragma warning disable 0649 [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPlayerManager _playerManager; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IGameTiming _gameTiming; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IInputManager _inputManager; [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystemManager; [Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEntityManager _entityManager; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IMapManager _mapManager;
#pragma warning restore 0649
public bool SetItemSlot(ItemSlotButton button, IEntity entity) public bool SetItemSlot(ItemSlotButton button, IEntity entity)
{ {

View File

@@ -16,10 +16,8 @@ namespace Content.Client.UserInterface
{ {
public sealed class LateJoinGui : SS14Window public sealed class LateJoinGui : SS14Window
{ {
#pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager; [Dependency] private readonly IClientConsole _console = default!;
[Dependency] private readonly IClientConsole _console;
#pragma warning restore 649
protected override Vector2? CustomSize => (360, 560); protected override Vector2? CustomSize => (360, 560);

View File

@@ -9,6 +9,8 @@ using Robust.Client.UserInterface.Controls;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using System;
using System.Collections.Generic;
namespace Content.Client.UserInterface namespace Content.Client.UserInterface
{ {
@@ -21,8 +23,7 @@ namespace Content.Client.UserInterface
public Button CreditsButton { get; } public Button CreditsButton { get; }
public Button LeaveButton { get; } public Button LeaveButton { get; }
public ChatBox Chat { get; } public ChatBox Chat { get; }
public ItemList OnlinePlayerItemList { get; } public LobbyPlayerList OnlinePlayerList { get; }
public ItemList PlayerReadyList { get; }
public ServerInfo ServerInfo { get; } public ServerInfo ServerInfo { get; }
public LobbyCharacterPreviewPanel CharacterPreview { get; } public LobbyCharacterPreviewPanel CharacterPreview { get; }
@@ -226,17 +227,11 @@ namespace Content.Client.UserInterface
CustomMinimumSize = (50,50), CustomMinimumSize = (50,50),
Children = Children =
{ {
(OnlinePlayerItemList = new ItemList (OnlinePlayerList = new LobbyPlayerList
{ {
SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
}), })
(PlayerReadyList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 0.2f
}),
} }
} }
} }
@@ -262,4 +257,82 @@ namespace Content.Client.UserInterface
} }
} }
} }
public class LobbyPlayerList : Control
{
private ScrollContainer _scroll;
private VBoxContainer _vBox;
public LobbyPlayerList()
{
var panel = new PanelContainer()
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#202028") },
};
_vBox = new VBoxContainer();
_scroll = new ScrollContainer();
_scroll.AddChild(_vBox);
panel.AddChild(_scroll);
AddChild(panel);
}
// Adds a row
public void AddItem(string name, string status)
{
var hbox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
// Player Name
hbox.AddChild(new PanelContainer()
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#373744"),
ContentMarginBottomOverride = 2,
ContentMarginLeftOverride = 4,
ContentMarginRightOverride = 4,
ContentMarginTopOverride = 2
},
Children =
{
new Label
{
Text = name
}
},
SizeFlagsHorizontal = SizeFlags.FillExpand
});
// Status
hbox.AddChild(new PanelContainer()
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#373744"),
ContentMarginBottomOverride = 2,
ContentMarginLeftOverride = 4,
ContentMarginRightOverride = 4,
ContentMarginTopOverride = 2
},
Children =
{
new Label
{
Text = status
}
},
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 0.2f,
});
_vBox.AddChild(hbox);
}
// Deletes all rows
public void Clear()
{
_vBox.RemoveAllChildren();
}
}
} }

View File

@@ -69,8 +69,8 @@ namespace Content.Client.UserInterface
scrollContainer.SizeFlagsVertical = SizeFlags.FillExpand; scrollContainer.SizeFlagsVertical = SizeFlags.FillExpand;
var innerScrollContainer = new VBoxContainer(); var innerScrollContainer = new VBoxContainer();
//Put antags on top of the list. //Put observers at the bottom of the list. Put antags on top.
var manifestSortedList = info.OrderBy(p => !p.Antag); var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);
//Create labels for each player info. //Create labels for each player info.
foreach (var plyinfo in manifestSortedList) foreach (var plyinfo in manifestSortedList)
{ {
@@ -79,12 +79,21 @@ namespace Content.Client.UserInterface
SizeFlagsVertical = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.Fill,
}; };
if (plyinfo.Observer)
{
playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
plyinfo.PlayerOOCName, plyinfo.PlayerICName));
}
else
{
//TODO: On Hover display a popup detailing more play info. //TODO: On Hover display a popup detailing more play info.
//For example: their antag goals and if they completed them sucessfully. //For example: their antag goals and if they completed them sucessfully.
var icNameColor = plyinfo.Antag ? "red" : "white"; var icNameColor = plyinfo.Antag ? "red" : "white";
playerInfoText.SetMarkup( playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].", Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
plyinfo.PlayerOOCName, icNameColor, plyinfo.PlayerICName, Loc.GetString(plyinfo.Role))); plyinfo.PlayerOOCName, icNameColor, plyinfo.PlayerICName, Loc.GetString(plyinfo.Role)));
}
innerScrollContainer.AddChild(playerInfoText); innerScrollContainer.AddChild(playerInfoText);
} }

View File

@@ -7,10 +7,8 @@ namespace Content.Client.UserInterface.Stylesheets
{ {
public sealed class StylesheetManager : IStylesheetManager public sealed class StylesheetManager : IStylesheetManager
{ {
#pragma warning disable 649 [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IResourceCache _resourceCache;
#pragma warning restore 649
public Stylesheet SheetNano { get; private set; } public Stylesheet SheetNano { get; private set; }
public Stylesheet SheetSpace { get; private set; } public Stylesheet SheetSpace { get; private set; }

View File

@@ -0,0 +1,116 @@
using System;
using System.Globalization;
using Content.Client.GameObjects.Components.Suspicion;
using Content.Shared.Interfaces;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.UserInterface.Suspicion
{
public class SuspicionGui : Control
{
#pragma warning disable 0649
[Dependency] private readonly IPlayerManager _playerManager;
#pragma warning restore 0649
private readonly VBoxContainer _container;
private readonly Button _roleButton;
private string _previousRoleName;
private bool _previousAntagonist;
public SuspicionGui()
{
IoCManager.InjectDependencies(this);
AddChild(_container = new VBoxContainer
{
SeparationOverride = 0,
Children =
{
(_roleButton = new Button
{
Name = "Suspicion Role Button"
})
}
});
_roleButton.CustomMinimumSize = (200, 60);
_roleButton.OnPressed += RoleButtonPressed;
}
private void RoleButtonPressed(ButtonEventArgs obj)
{
if (!TryGetComponent(out var role))
{
return;
}
if (!role.Antagonist ?? false)
{
return;
}
var allies = string.Join(", ", role.Allies);
var message = role.Allies.Count switch
{
0 => Loc.GetString("You have no allies"),
1 => Loc.GetString("Your ally is {0}", allies),
var n when n > 2 => Loc.GetString("Your allies are {0}", allies),
_ => throw new ArgumentException($"Invalid number of allies: {role.Allies.Count}")
};
role.Owner.PopupMessage(role.Owner, message);
}
private bool TryGetComponent(out SuspicionRoleComponent suspicion)
{
suspicion = default;
return _playerManager?.LocalPlayer?.ControlledEntity?.TryGetComponent(out suspicion) == true;
}
public void UpdateLabel()
{
if (!TryGetComponent(out var suspicion))
{
Visible = false;
return;
}
if (suspicion.Role == null || suspicion.Antagonist == null)
{
Visible = false;
return;
}
if (_previousRoleName == suspicion.Role && _previousAntagonist == suspicion.Antagonist)
{
return;
}
_previousRoleName = suspicion.Role;
_previousAntagonist = suspicion.Antagonist.Value;
var buttonText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_previousRoleName);
buttonText = Loc.GetString(buttonText);
_roleButton.Text = buttonText;
_roleButton.ModulateSelfOverride = _previousAntagonist ? Color.Red : Color.Green;
Visible = true;
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
UpdateLabel();
}
}
}

View File

@@ -92,7 +92,8 @@ Toggle UI: [color=#a4885c]{17}[/color]
Toggle debug overlay: [color=#a4885c]{18}[/color] Toggle debug overlay: [color=#a4885c]{18}[/color]
Toggle entity spawner: [color=#a4885c]{19}[/color] Toggle entity spawner: [color=#a4885c]{19}[/color]
Toggle tile spawner: [color=#a4885c]{20}[/color] Toggle tile spawner: [color=#a4885c]{20}[/color]
Toggle sandbox window: [color=#a4885c]{21}[/color]", Toggle sandbox window: [color=#a4885c]{21}[/color]
Toggle admin menu [color=#a4885c]{31}[/color]",
Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight), Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight),
Key(SwapHands), Key(SwapHands),
Key(ActivateItemInHand), Key(ActivateItemInHand),
@@ -120,7 +121,8 @@ Toggle sandbox window: [color=#a4885c]{21}[/color]",
Key(FocusAdminChat), Key(FocusAdminChat),
Key(Point), Key(Point),
Key(TryPullObject), Key(TryPullObject),
Key(MovePulledObject))); Key(MovePulledObject),
Key(OpenAdminMenu)));
//Gameplay //Gameplay
VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" }); VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" });

Some files were not shown because too many files have changed in this diff Show More