From 81020e70fabd7cb986538c309ff1753bc0e3ba37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 2 Nov 2022 22:06:30 +0100 Subject: [PATCH] Fix actors with immobile actors that don't occupy space to be placed everywhere way outside the map boundaries. --- OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 9afd3daacb..a4190f5438 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -74,7 +74,11 @@ namespace OpenRA.Mods.Common.Traits var subCellInit = reference.GetOrDefault(); var subCell = subCellInit != null ? subCellInit.Value : SubCell.Any; - Footprint = ios?.OccupiedCells(Info, location, subCell) ?? new Dictionary() { { location, SubCell.FullCell } }; + var occupiedCells = ios?.OccupiedCells(Info, location, subCell); + if (occupiedCells == null || occupiedCells.Count == 0) + Footprint = new Dictionary() { { location, SubCell.FullCell } }; + else + Footprint = occupiedCells; tooltip = Info.TraitInfos().FirstOrDefault(info => info.EnabledByDefault) as TooltipInfoBase ?? Info.TraitInfos().FirstOrDefault(info => info.EnabledByDefault);