wire up bot creation properly in CreateMPPlayers etc
This commit is contained in:
@@ -184,7 +184,12 @@ namespace OpenRA.Traits
|
||||
public interface IWorldLoaded { void WorldLoaded(World w); }
|
||||
public interface ICreatePlayers { void CreatePlayers(World w); }
|
||||
|
||||
public interface IBot { void Activate(Player p); }
|
||||
public interface IBotInfo { string Name { get; } }
|
||||
public interface IBot
|
||||
{
|
||||
void Activate(Player p);
|
||||
IBotInfo Info { get; }
|
||||
}
|
||||
|
||||
public interface IActivity
|
||||
{
|
||||
|
||||
@@ -59,10 +59,11 @@ namespace OpenRA.Mods.RA
|
||||
var player = new Player(w, w.Map.Players[slot.MapPlayer], playerIndex++);
|
||||
w.AddPlayer(player);
|
||||
|
||||
/* todo: only activate the bot option that's selected! */
|
||||
/* activate the bot option that's selected! */
|
||||
if (Game.IsHost)
|
||||
foreach (var bot in player.PlayerActor.TraitsImplementing<IBot>())
|
||||
bot.Activate(player);
|
||||
player.PlayerActor.TraitsImplementing<IBot>()
|
||||
.Single(b => b.Info.Name == slot.Bot)
|
||||
.Activate(player);
|
||||
|
||||
/* a bit of a hack */
|
||||
player.IsBot = true;
|
||||
|
||||
@@ -33,11 +33,6 @@ using XRandom = OpenRA.Thirdparty.Random;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
interface IBotInfo
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
class HackyAIInfo : IBotInfo, ITraitInfo
|
||||
{
|
||||
[FieldLoader.Load]
|
||||
@@ -84,6 +79,7 @@ namespace OpenRA.Mods.RA
|
||||
BaseBuilder[] builders;
|
||||
|
||||
World world { get { return p.PlayerActor.World; } }
|
||||
IBotInfo IBot.Info { get { return this.Info; } }
|
||||
|
||||
readonly HackyAIInfo Info;
|
||||
public HackyAI(HackyAIInfo Info)
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
|
||||
Reference in New Issue
Block a user