move Building et al into Mods/

This commit is contained in:
Bob
2010-11-04 17:26:56 +13:00
committed by Chris Forbes
parent fdfa1ddf97
commit 480c5edd75
60 changed files with 322 additions and 285 deletions

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Traits
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
{
// Todo: Valid terrain should be specified in the resource
if (!w.IsCellBuildable(new int2(x,y), false))
if (!AllowOreAt(new int2(x,y)))
continue;
content[x, y].type = resourceTypes.FirstOrDefault(
@@ -89,6 +89,14 @@ namespace OpenRA.Traits
}
}
bool AllowOreAt( int2 a )
{
if( !world.Map.IsInMap( a.X, a.Y ) ) return false;
if( !world.GetTerrainInfo( a ).Buildable ) return false;
if( world.WorldActor.Trait<UnitInfluence>().AnyUnitsAt( a ) ) return false;
return true;
}
Sprite[] ChooseContent(ResourceType t)
{
return t.info.Sprites[world.SharedRandom.Next(t.info.Sprites.Length)];