lots of experimental bits

This commit is contained in:
Chris Forbes
2010-02-28 22:43:54 +13:00
parent e7b48c7ea6
commit 45a4fa110e
22 changed files with 166 additions and 14 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA.Traits
{
class WallLoadHookInfo : ITraitInfo
{
public readonly int[] OverlayIndices = { };
public readonly string ActorType = "brik";
public object Create(Actor self) { return new WallLoadHook( self, this ); }
}
class WallLoadHook : ILoadWorldHook
{
WallLoadHookInfo info;
public WallLoadHook(Actor self, WallLoadHookInfo info)
{
this.info = info;
}
public void WorldLoaded(World w)
{
var map = w.Map;
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
if (info.OverlayIndices.Contains(w.Map.MapTiles[x, y].overlay))
w.CreateActor(info.ActorType, new int2(x, y), w.players[0]); // todo: neutral player or null?
}
}
}