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;
|
||||
|
||||
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; }
|
||||
|
||||
@@ -144,8 +144,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var location = host.Location;
|
||||
var pluggable = host.TraitsImplementing<Pluggable>()
|
||||
.FirstOrDefault(p => location + p.Info.Offset == targetLocation && p.AcceptsPlug(host, plugInfo.Type));
|
||||
var pluggableLocations = host.TraitsImplementing<Pluggable>()
|
||||
.Where(p => p.AcceptsPlug(host, plugInfo.Type));
|
||||
|
||||
var pluggable = pluggableLocations.FirstOrDefault(p => location + p.Info.Offset == targetLocation)
|
||||
?? pluggableLocations.FirstOrDefault();
|
||||
|
||||
if (pluggable == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user