tank production works
This commit is contained in:
@@ -7,7 +7,8 @@ using System.Linq;
|
|||||||
using IrrKlang;
|
using IrrKlang;
|
||||||
using IjwFramework.Collections;
|
using IjwFramework.Collections;
|
||||||
using System;
|
using System;
|
||||||
using IjwFramework.Types;
|
using IjwFramework.Types;
|
||||||
|
using OpenRa.Game.Traits;
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
@@ -180,6 +181,22 @@ namespace OpenRa.Game
|
|||||||
public static readonly Pair<VoicePool, VoicePool> SovietVoices =
|
public static readonly Pair<VoicePool, VoicePool> SovietVoices =
|
||||||
Pair.New(
|
Pair.New(
|
||||||
new VoicePool("ackno", "affirm1", "noprob", "overout", "ritaway", "roger", "ugotit"),
|
new VoicePool("ackno", "affirm1", "noprob", "overout", "ritaway", "roger", "ugotit"),
|
||||||
new VoicePool("await1", "ready", "report1", "yessir1"));
|
new VoicePool("await1", "ready", "report1", "yessir1"));
|
||||||
|
|
||||||
|
public static void BuildUnit(Player player, string name)
|
||||||
|
{
|
||||||
|
var producer = world.Actors
|
||||||
|
.FirstOrDefault(a => a.unitInfo != null && a.unitInfo.Name == "weap" && a.Owner == player);
|
||||||
|
|
||||||
|
if (producer == null)
|
||||||
|
throw new InvalidOperationException("BuildUnit without suitable production structure!");
|
||||||
|
|
||||||
|
var unit = new Actor(name, (1/24f * producer.CenterLocation).ToInt2(), player);
|
||||||
|
unit.Order(unit.Location + new int2(0, 3)).Apply(false);
|
||||||
|
|
||||||
|
world.AddFrameEndTask(_ => world.Add(unit));
|
||||||
|
|
||||||
|
// todo: make the producing building play `build`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,10 +59,15 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Build(SidebarItem item)
|
public void Build(SidebarItem item)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
Game.controller.orderGenerator = new PlaceBuilding(Game.LocalPlayer,
|
{
|
||||||
item.techTreeItem.tag.ToLowerInvariant());
|
if (item.techTreeItem.IsStructure)
|
||||||
|
Game.controller.orderGenerator = new PlaceBuilding(Game.LocalPlayer,
|
||||||
|
item.techTreeItem.tag.ToLowerInvariant());
|
||||||
|
else
|
||||||
|
Game.BuildUnit(Game.LocalPlayer, item.techTreeItem.tag.ToLowerInvariant());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSprites( string category, string group )
|
void LoadSprites( string category, string group )
|
||||||
|
|||||||
Reference in New Issue
Block a user