hook in an ai stub. all it does for now is deploy the mcv.
This commit is contained in:
@@ -221,7 +221,7 @@ namespace OpenRA
|
|||||||
throw new InvalidOperationException("Desync in DispatchMouseInput");
|
throw new InvalidOperationException("Desync in DispatchMouseInput");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsHost
|
public static bool IsHost
|
||||||
{
|
{
|
||||||
get { return orderManager.Connection.LocalClientId == 0; }
|
get { return orderManager.Connection.LocalClientId == 0; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
<Compile Include="CreateMapPlayers.cs" />
|
<Compile Include="CreateMapPlayers.cs" />
|
||||||
<Compile Include="CreateMPPlayers.cs" />
|
<Compile Include="CreateMPPlayers.cs" />
|
||||||
<Compile Include="LocalPlayerFromMap.cs" />
|
<Compile Include="LocalPlayerFromMap.cs" />
|
||||||
|
<Compile Include="World\HackyAI.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
42
OpenRA.Mods.RA/World/HackyAI.cs
Normal file
42
OpenRA.Mods.RA/World/HackyAI.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class HackyAIInfo : TraitInfo<HackyAI> { }
|
||||||
|
|
||||||
|
/* 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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -180,6 +180,7 @@ World:
|
|||||||
SpatialBins:
|
SpatialBins:
|
||||||
BinSize: 4
|
BinSize: 4
|
||||||
Shroud:
|
Shroud:
|
||||||
|
HackyAI:
|
||||||
|
|
||||||
MINP:
|
MINP:
|
||||||
Mine:
|
Mine:
|
||||||
|
|||||||
Reference in New Issue
Block a user