Fix SpawnMPUnits being limited to MobileInfo

This commit is contained in:
abcdefg30
2017-02-09 13:11:01 +01:00
parent a385835939
commit e53724b1de

View File

@@ -86,8 +86,9 @@ namespace OpenRA.Mods.Common.Traits
foreach (var s in unitGroup.SupportActors) foreach (var s in unitGroup.SupportActors)
{ {
var mi = w.Map.Rules.Actors[s.ToLowerInvariant()].TraitInfo<MobileInfo>(); var actorRules = w.Map.Rules.Actors[s.ToLowerInvariant()];
var validCells = supportSpawnCells.Where(c => mi.CanEnterCell(w, null, c)); var ip = actorRules.TraitInfo<IPositionableInfo>();
var validCells = supportSpawnCells.Where(c => ip.CanEnterCell(w, null, c));
if (!validCells.Any()) if (!validCells.Any())
{ {
Log.Write("debug", "No cells available to spawn starting unit {0} for player {1}".F(s, p)); Log.Write("debug", "No cells available to spawn starting unit {0} for player {1}".F(s, p));
@@ -95,7 +96,8 @@ namespace OpenRA.Mods.Common.Traits
} }
var cell = validCells.Random(w.SharedRandom); var cell = validCells.Random(w.SharedRandom);
var subCell = mi.SharesCell ? w.ActorMap.FreeSubCell(cell) : 0; var ios = actorRules.TraitInfo<IOccupySpaceInfo>();
var subCell = ios.SharesCell ? w.ActorMap.FreeSubCell(cell) : 0;
w.CreateActor(s.ToLowerInvariant(), new TypeDictionary w.CreateActor(s.ToLowerInvariant(), new TypeDictionary
{ {