Combine IMapGenerator interfaces.

This removes the need to instantiate a dummy
trait instance and is more idiomatic.
This commit is contained in:
Paul Chote
2025-03-02 08:39:56 +00:00
committed by Gustas Kažukauskas
parent 7ee79a0e64
commit 23b7b56c28
6 changed files with 29 additions and 62 deletions

View File

@@ -10,7 +10,6 @@
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Widgets;
@@ -48,7 +47,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var markerToolPanel = widget.Get("MARKER_TOOL_PANEL");
toolPanels.Add(MapTool.MarkerTiles, markerToolPanel);
if (world.WorldActor.TraitsImplementing<IMapGenerator>().Any())
if (world.Map.Rules.Actors[SystemActors.EditorWorld].HasTraitInfo<IMapGeneratorInfo>())
{
var mapGeneratorToolPanel = widget.GetOrNull("MAP_GENERATOR_TOOL_PANEL");
if (mapGeneratorToolPanel != null)