Add a Lua API method to randomize a collection

This commit is contained in:
Oliver Brakmann
2016-05-15 16:38:41 +02:00
parent 735975057d
commit 09d1dacd95

View File

@@ -93,6 +93,12 @@ namespace OpenRA.Mods.Common.Scripting
return collection.Random(Context.World.SharedRandom).CopyReference();
}
[Desc("Returns the collection in a random order.")]
public LuaValue[] Shuffle(LuaValue[] collection)
{
return collection.Shuffle(Context.World.SharedRandom).ToArray();
}
[Desc("Expands the given footprint one step along the coordinate axes, and (if requested) diagonals.")]
public CPos[] ExpandFootprint(CPos[] footprint, bool allowDiagonal)
{