Allow tools to disable themselves

This commit is contained in:
Gustas
2025-07-21 13:25:30 +03:00
committed by Matthias Mailänder
parent f8921226b8
commit 42181d77a5
10 changed files with 95 additions and 45 deletions

View File

@@ -26,10 +26,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public MapToolsLogic(Widget widget, World world)
{
var toolDropdownWidget = widget.Get<DropDownButtonWidget>("TOOLS_DROPDOWN");
var tools = world.Map.Rules.Actors[SystemActors.EditorWorld].TraitInfos<IEditorToolInfo>();
var tools = world.WorldActor.TraitsImplementing<IEditorTool>();
foreach (var tool in tools)
{
if (tool is IEditorMapGeneratorInfo gi && !gi.Tilesets.Contains(world.Map.Tileset))
if (!tool.IsEnabled)
continue;
var panel = Game.LoadWidget(world, tool.PanelWidget, widget, new WidgetArgs() { { "tool", tool } });