add enumeration of bots
This commit is contained in:
@@ -33,8 +33,18 @@ using XRandom = OpenRA.Thirdparty.Random;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class HackyAIInfo : ITraitInfo
|
||||
interface IBotInfo
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
class HackyAIInfo : IBotInfo, ITraitInfo
|
||||
{
|
||||
[FieldLoader.Load]
|
||||
public readonly string Name;
|
||||
|
||||
string IBotInfo.Name { get { return this.Name; } }
|
||||
|
||||
[FieldLoader.LoadUsing("LoadUnits")]
|
||||
public readonly Dictionary<string, float> UnitsToBuild = null;
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
{
|
||||
var parts = s.Split(' ');
|
||||
|
||||
if (parts.Length != 2)
|
||||
if (parts.Length < 2)
|
||||
{
|
||||
server.SendChatTo( conn, "Malformed slot_bot command" );
|
||||
return true;
|
||||
@@ -181,7 +181,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
return true;
|
||||
}
|
||||
|
||||
slotData.Bot = parts[1];
|
||||
slotData.Bot = string.Join(" ", parts.Skip(1).ToArray() );
|
||||
|
||||
server.SyncLobbyInfo();
|
||||
return true;
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
|
||||
if (showBotOptions)
|
||||
{
|
||||
var bots = new string[] { "HackyAI" };
|
||||
var bots = Rules.Info["player"].Traits.WithInterface<IBotInfo>().Select(t => t.Name);
|
||||
bots.Do(bot =>
|
||||
dropDownOptions.Add(new Pair<string, Action>("Bot: {0}".F(bot),
|
||||
() => orderManager.IssueOrder(Order.Command("slot_bot {0} {1}".F(slot.Index, bot))))));
|
||||
|
||||
@@ -32,7 +32,8 @@ Player:
|
||||
InitialCash: 5000
|
||||
ActorGroupProxy:
|
||||
DeveloperMode:
|
||||
HackyAI:
|
||||
HackyAI@Default:
|
||||
Name:Easy AI
|
||||
BuildingFractions:
|
||||
proc: 20%
|
||||
barr: 5%
|
||||
|
||||
Reference in New Issue
Block a user