addgas and settemp under admeme menu (#3098)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -48,10 +48,12 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
new SpawnTilesCommandButton(),
|
new SpawnTilesCommandButton(),
|
||||||
new StationEventsCommandButton()
|
new StationEventsCommandButton()
|
||||||
};
|
};
|
||||||
private readonly List<CommandButton> _debugButtons = new()
|
private readonly List<CommandButton> _atmosButtons = new()
|
||||||
{
|
{
|
||||||
new AddAtmosCommandButton(),
|
new AddAtmosCommandButton(),
|
||||||
|
new AddGasCommandButton(),
|
||||||
new FillGasCommandButton(),
|
new FillGasCommandButton(),
|
||||||
|
new SetTempCommandButton(),
|
||||||
};
|
};
|
||||||
private readonly List<CommandButton> _roundButtons = new()
|
private readonly List<CommandButton> _roundButtons = new()
|
||||||
{
|
{
|
||||||
@@ -303,9 +305,9 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
adminbusTabContainer.AddChild(adminbusButtonGrid);
|
adminbusTabContainer.AddChild(adminbusButtonGrid);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Debug
|
#region Atmos
|
||||||
// Debug // Mostly dev tools, like addatmos
|
// Atmos // Commands to add, modify, or remove gases.
|
||||||
var debugTabContainer = new MarginContainer
|
var atmosTabContainer = new MarginContainer
|
||||||
{
|
{
|
||||||
MarginLeftOverride = 4,
|
MarginLeftOverride = 4,
|
||||||
MarginTopOverride = 4,
|
MarginTopOverride = 4,
|
||||||
@@ -313,12 +315,12 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
MarginBottomOverride = 4,
|
MarginBottomOverride = 4,
|
||||||
CustomMinimumSize = (50, 50),
|
CustomMinimumSize = (50, 50),
|
||||||
};
|
};
|
||||||
var debugButtonGrid = new GridContainer
|
var atmosButtonGrid = new GridContainer
|
||||||
{
|
{
|
||||||
Columns = 4,
|
Columns = 4,
|
||||||
};
|
};
|
||||||
AddCommandButton(_debugButtons, debugButtonGrid);
|
AddCommandButton(_atmosButtons, atmosButtonGrid);
|
||||||
debugTabContainer.AddChild(debugButtonGrid);
|
atmosTabContainer.AddChild(atmosButtonGrid);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Round
|
#region Round
|
||||||
@@ -366,8 +368,8 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
MasterTabContainer.SetTabTitle(0, Loc.GetString("Admin"));
|
MasterTabContainer.SetTabTitle(0, Loc.GetString("Admin"));
|
||||||
MasterTabContainer.AddChild(adminbusTabContainer);
|
MasterTabContainer.AddChild(adminbusTabContainer);
|
||||||
MasterTabContainer.SetTabTitle(1, Loc.GetString("Adminbus"));
|
MasterTabContainer.SetTabTitle(1, Loc.GetString("Adminbus"));
|
||||||
MasterTabContainer.AddChild(debugTabContainer);
|
MasterTabContainer.AddChild(atmosTabContainer);
|
||||||
MasterTabContainer.SetTabTitle(2, Loc.GetString("Debug"));
|
MasterTabContainer.SetTabTitle(2, Loc.GetString("Atmos"));
|
||||||
MasterTabContainer.AddChild(roundTabContainer);
|
MasterTabContainer.AddChild(roundTabContainer);
|
||||||
MasterTabContainer.SetTabTitle(3, Loc.GetString("Round"));
|
MasterTabContainer.SetTabTitle(3, Loc.GetString("Round"));
|
||||||
MasterTabContainer.AddChild(serverTabContainer);
|
MasterTabContainer.AddChild(serverTabContainer);
|
||||||
@@ -600,6 +602,61 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AddGasCommandButton : UICommandButton
|
||||||
|
{
|
||||||
|
public override string Name => "Add Gas";
|
||||||
|
public override string RequiredCommand => "addgas";
|
||||||
|
|
||||||
|
private readonly CommandUIDropDown _grid = new()
|
||||||
|
{
|
||||||
|
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 readonly CommandUISpinBox _tileX = new()
|
||||||
|
{
|
||||||
|
Name = "TileX",
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly CommandUISpinBox _tileY = new()
|
||||||
|
{
|
||||||
|
Name = "TileY",
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly CommandUIDropDown _gas = new()
|
||||||
|
{
|
||||||
|
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 readonly CommandUISpinBox _amount = new()
|
||||||
|
{
|
||||||
|
Name = "Amount"
|
||||||
|
};
|
||||||
|
|
||||||
|
public override List<CommandUIControl> UI => new()
|
||||||
|
{
|
||||||
|
_grid,
|
||||||
|
_gas,
|
||||||
|
_tileX,
|
||||||
|
_tileY,
|
||||||
|
_amount,
|
||||||
|
};
|
||||||
|
|
||||||
|
public override void Submit()
|
||||||
|
{
|
||||||
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addgas {_tileX.GetValue()} {_tileY.GetValue()} {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class FillGasCommandButton : UICommandButton
|
private class FillGasCommandButton : UICommandButton
|
||||||
{
|
{
|
||||||
public override string Name => "Fill Gas";
|
public override string Name => "Fill Gas";
|
||||||
@@ -642,6 +699,48 @@ namespace Content.Client.UserInterface.AdminMenu
|
|||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"fillgas {_grid.GetValue()} {_gas.GetValue()} {_amount.GetValue()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SetTempCommandButton : UICommandButton
|
||||||
|
{
|
||||||
|
public override string Name => "Set temperature";
|
||||||
|
public override string RequiredCommand => "settemp";
|
||||||
|
|
||||||
|
private readonly CommandUIDropDown _grid = new()
|
||||||
|
{
|
||||||
|
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 readonly CommandUISpinBox _tileX = new()
|
||||||
|
{
|
||||||
|
Name = "TileX",
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly CommandUISpinBox _tileY = new()
|
||||||
|
{
|
||||||
|
Name = "TileY",
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly CommandUISpinBox _temperature = new()
|
||||||
|
{
|
||||||
|
Name = "Temperature"
|
||||||
|
};
|
||||||
|
|
||||||
|
public override List<CommandUIControl> UI => new()
|
||||||
|
{
|
||||||
|
_grid,
|
||||||
|
_tileX,
|
||||||
|
_tileY,
|
||||||
|
_temperature,
|
||||||
|
};
|
||||||
|
|
||||||
|
public override void Submit()
|
||||||
|
{
|
||||||
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"settemp {_tileX.GetValue()} {_tileY.GetValue()} {_grid.GetValue()} {_temperature.GetValue()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CommandUIControls
|
#region CommandUIControls
|
||||||
|
|||||||
Reference in New Issue
Block a user