Add shortcut to flip for construction menu (#14152)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -148,6 +148,9 @@ namespace Content.Client.Construction.UI
|
||||
|
||||
foreach (var recipe in _prototypeManager.EnumeratePrototypes<ConstructionPrototype>())
|
||||
{
|
||||
if (recipe.Hide)
|
||||
continue;
|
||||
|
||||
if (!string.IsNullOrEmpty(search))
|
||||
{
|
||||
if (!recipe.Name.ToLowerInvariant().Contains(search.Trim().ToLowerInvariant()))
|
||||
@@ -342,6 +345,7 @@ namespace Content.Client.Construction.UI
|
||||
{
|
||||
_constructionSystem = system;
|
||||
system.ToggleCraftingWindow += SystemOnToggleMenu;
|
||||
system.FlipConstructionPrototype += SystemFlipConstructionPrototype;
|
||||
system.CraftingAvailabilityChanged += SystemCraftingAvailabilityChanged;
|
||||
system.ConstructionGuideAvailable += SystemGuideAvailable;
|
||||
if (_uiManager.GetActiveUIWidgetOrNull<GameTopMenuBar>() != null)
|
||||
@@ -358,6 +362,7 @@ namespace Content.Client.Construction.UI
|
||||
throw new InvalidOperationException();
|
||||
|
||||
system.ToggleCraftingWindow -= SystemOnToggleMenu;
|
||||
system.FlipConstructionPrototype -= SystemFlipConstructionPrototype;
|
||||
system.CraftingAvailabilityChanged -= SystemCraftingAvailabilityChanged;
|
||||
system.ConstructionGuideAvailable -= SystemGuideAvailable;
|
||||
_constructionSystem = null;
|
||||
@@ -392,6 +397,22 @@ namespace Content.Client.Construction.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void SystemFlipConstructionPrototype(object? sender, EventArgs eventArgs)
|
||||
{
|
||||
if (!_placementManager.IsActive || _placementManager.Eraser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_selected == null || _selected.Mirror == String.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_selected = _prototypeManager.Index<ConstructionPrototype>(_selected.Mirror);
|
||||
UpdateGhostPlacement();
|
||||
}
|
||||
|
||||
private void SystemGuideAvailable(object? sender, string e)
|
||||
{
|
||||
if (!CraftingAvailable)
|
||||
|
||||
Reference in New Issue
Block a user