Use 'new' expression in places where the type is evident for content (#2590)

* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2020-11-27 11:00:49 +01:00
committed by GitHub
parent 4a56df749b
commit 5c0cf1b1a0
235 changed files with 431 additions and 433 deletions

View File

@@ -33,30 +33,30 @@ namespace Content.Client.UserInterface.AdminMenu
protected override Vector2? CustomSize => (500, 250);
private readonly List<CommandButton> _adminButtons = new List<CommandButton>
private readonly List<CommandButton> _adminButtons = new()
{
new KickCommandButton(),
new DirectCommandButton("Admin Ghost", "aghost"),
new TeleportCommandButton(),
};
private readonly List<CommandButton> _adminbusButtons = new List<CommandButton>
private readonly List<CommandButton> _adminbusButtons = new()
{
new SpawnEntitiesCommandButton(),
new SpawnTilesCommandButton(),
new StationEventsCommandButton(),
};
private readonly List<CommandButton> _debugButtons = new List<CommandButton>
private readonly List<CommandButton> _debugButtons = new()
{
new AddAtmosCommandButton(),
new FillGasCommandButton(),
};
private readonly List<CommandButton> _roundButtons = new List<CommandButton>
private readonly List<CommandButton> _roundButtons = new()
{
new DirectCommandButton("Start Round", "startround"),
new DirectCommandButton("End Round", "endround"),
new DirectCommandButton("Restart Round", "restartround"),
};
private readonly List<CommandButton> _serverButtons = new List<CommandButton>
private readonly List<CommandButton> _serverButtons = new()
{
new DirectCommandButton("Reboot", "restart"),
new DirectCommandButton("Shutdown", "shutdown"),
@@ -463,7 +463,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string RequiredCommand => "events";
public override string? SubmitText => "Run";
private readonly CommandUIDropDown _eventsDropDown = new CommandUIDropDown
private readonly CommandUIDropDown _eventsDropDown = new()
{
Name = "Event",
GetData = () =>
@@ -478,7 +478,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((string) obj).ToLower(),
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
public override List<CommandUIControl> UI => new()
{
_eventsDropDown,
new CommandUIButton
@@ -510,19 +510,19 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Kick";
public override string RequiredCommand => "kick";
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown
private readonly CommandUIDropDown _playerDropDown = new()
{
Name = "Player",
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})",
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
};
private readonly CommandUILineEdit _reason = new CommandUILineEdit
private readonly CommandUILineEdit _reason = new()
{
Name = "Reason"
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
public override List<CommandUIControl> UI => new()
{
_playerDropDown,
_reason
@@ -539,7 +539,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Teleport";
public override string RequiredCommand => "tpto";
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown
private readonly CommandUIDropDown _playerDropDown = new()
{
Name = "Player",
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
@@ -547,7 +547,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
public override List<CommandUIControl> UI => new()
{
_playerDropDown
};
@@ -563,7 +563,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Add Atmos";
public override string RequiredCommand => "addatmos";
private readonly CommandUIDropDown _grid = new CommandUIDropDown
private readonly CommandUIDropDown _grid = new()
{
Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
@@ -571,7 +571,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
public override List<CommandUIControl> UI => new()
{
_grid,
};
@@ -587,7 +587,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Fill Gas";
public override string RequiredCommand => "fillgas";
private readonly CommandUIDropDown _grid = new CommandUIDropDown
private readonly CommandUIDropDown _grid = new()
{
Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
@@ -595,7 +595,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
};
private readonly CommandUIDropDown _gas = new CommandUIDropDown
private readonly CommandUIDropDown _gas = new()
{
Name = "Gas",
GetData = () =>
@@ -607,12 +607,12 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(),
};
private readonly CommandUISpinBox _amount = new CommandUISpinBox
private readonly CommandUISpinBox _amount = new()
{
Name = "Amount"
};
public override List<CommandUIControl> UI => new List<CommandUIControl>
public override List<CommandUIControl> UI => new()
{
_grid,
_gas,