Added in code for Tech Levels using prereqs

and fixed up some kinks of the old system
This commit is contained in:
WolfGaming
2014-05-12 05:33:51 +00:00
parent f7c0416b2e
commit 00698cefff
12 changed files with 182 additions and 29 deletions

View File

@@ -123,11 +123,12 @@ namespace OpenRA.Mods.RA
foreach (var a in AllBuildables(Info.Type))
{
var bi = a.Traits.Get<BuildableInfo>();
// Can our race build this by satisfying normal prereqs?
// Can our race build this by satisfying normal prerequisites?
var buildable = bi.Owner.Contains(Race.Race);
tech.Add(a, new ProductionState { Visible = buildable && !bi.Hidden });
// Checks if Prerequisites want to hide the Actor from buildQueue if they are false
tech.Add(a, new ProductionState { Visible = buildable });
if (buildable)
ttc.Add(a.Name, bi, this);
ttc.Add(a.Name, bi.Prerequisites, bi.BuildLimit, this);
}
return tech;
@@ -161,6 +162,18 @@ namespace OpenRA.Mods.RA
ps.Buildable = false;
}
public void PrerequisitesItemHidden(string key)
{
var ps = Produceable[self.World.Map.Rules.Actors[key]];
ps.Visible = false;
}
public void PrerequisitesItemVisable(string key)
{
var ps = Produceable[self.World.Map.Rules.Actors[key]];
ps.Visible = true;
}
public ProductionItem CurrentItem()
{
return Queue.ElementAtOrDefault(0);