Use another plug location for placing plugs on a building when current plug location is already blocked
This commit is contained in:
@@ -229,7 +229,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var location = host.Location;
|
var location = host.Location;
|
||||||
return host.TraitsImplementing<Pluggable>().Any(p => location + p.Info.Offset == cell && p.AcceptsPlug(host, plug.Type));
|
return host.TraitsImplementing<Pluggable>().Any(p => p.AcceptsPlug(host, plug.Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IRenderable> IOrderGenerator.Render(WorldRenderer wr, World world) { yield break; }
|
IEnumerable<IRenderable> IOrderGenerator.Render(WorldRenderer wr, World world) { yield break; }
|
||||||
|
|||||||
@@ -144,8 +144,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var location = host.Location;
|
var location = host.Location;
|
||||||
var pluggable = host.TraitsImplementing<Pluggable>()
|
var pluggableLocations = host.TraitsImplementing<Pluggable>()
|
||||||
.FirstOrDefault(p => location + p.Info.Offset == targetLocation && p.AcceptsPlug(host, plugInfo.Type));
|
.Where(p => p.AcceptsPlug(host, plugInfo.Type));
|
||||||
|
|
||||||
|
var pluggable = pluggableLocations.FirstOrDefault(p => location + p.Info.Offset == targetLocation)
|
||||||
|
?? pluggableLocations.FirstOrDefault();
|
||||||
|
|
||||||
if (pluggable == null)
|
if (pluggable == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user