diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 84d13746e4..a2d3955668 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -221,7 +221,7 @@ namespace OpenRA throw new InvalidOperationException("Desync in DispatchMouseInput"); } - internal static bool IsHost + public static bool IsHost { get { return orderManager.Connection.LocalClientId == 0; } } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 82bd858455..60ba683244 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -238,6 +238,7 @@ + diff --git a/OpenRA.Mods.RA/World/HackyAI.cs b/OpenRA.Mods.RA/World/HackyAI.cs new file mode 100644 index 0000000000..65d2aa1f7d --- /dev/null +++ b/OpenRA.Mods.RA/World/HackyAI.cs @@ -0,0 +1,42 @@ +using System.Linq; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + class HackyAIInfo : TraitInfo { } + + /* a pile of hacks, which control the local player on the host. */ + + class HackyAI : IGameStarted, ITick + { + bool enabled; + int ticks; + Player p; + + public void GameStarted(World w) + { + enabled = Game.IsHost; + p = Game.world.LocalPlayer; + } + + public void Tick(Actor self) + { + if (!enabled) + return; + + ticks++; + + if (ticks == 10) + { + /* find our mcv and deploy it */ + var mcv = self.World.Queries.OwnedBy[p] + .FirstOrDefault(a => a.Info == Rules.Info["mcv"]); + + if (mcv != null) + Game.IssueOrder(new Order("DeployTransform", mcv)); + else + Game.Debug("AI: Can't find the MCV."); + } + } + } +} diff --git a/mods/ra/system.yaml b/mods/ra/system.yaml index e719d01869..046fc48eb6 100644 --- a/mods/ra/system.yaml +++ b/mods/ra/system.yaml @@ -180,6 +180,7 @@ World: SpatialBins: BinSize: 4 Shroud: + HackyAI: MINP: Mine: