Remove broken powered-techtree hack.
This commit is contained in:
@@ -46,13 +46,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
|
|
||||||
public void Add(string key, List<string> prerequisites, ITechTreeElement tte)
|
public void Add(string key, List<string> prerequisites, ITechTreeElement tte)
|
||||||
{
|
{
|
||||||
Add(key, prerequisites, false, tte);
|
watchers.Add(new Watcher( key, prerequisites, tte ));
|
||||||
}
|
|
||||||
|
|
||||||
// set requiresPowered = true to discard buildings that have an IDisabled active (eg manually powered down)
|
|
||||||
public void Add(string key, List<string> prerequisites, bool requiresPowered, ITechTreeElement tte)
|
|
||||||
{
|
|
||||||
watchers.Add(new Watcher( key, prerequisites, requiresPowered, tte ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(string key)
|
public void Remove(string key)
|
||||||
@@ -86,21 +80,19 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
bool hasPrerequisites;
|
bool hasPrerequisites;
|
||||||
bool requiresPowered;
|
bool requiresPowered;
|
||||||
|
|
||||||
public Watcher(string key, List<string> prerequisites, bool requiresPowered, ITechTreeElement watcher)
|
public Watcher(string key, List<string> prerequisites, ITechTreeElement watcher)
|
||||||
{
|
{
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.prerequisites = prerequisites;
|
this.prerequisites = prerequisites;
|
||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
this.hasPrerequisites = false;
|
this.hasPrerequisites = false;
|
||||||
this.requiresPowered = requiresPowered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(Cache<string, List<Actor>> buildings)
|
public void Update(Cache<string, List<Actor>> buildings)
|
||||||
{
|
{
|
||||||
var nowHasPrerequisites = true;
|
var nowHasPrerequisites = true;
|
||||||
foreach (var p in prerequisites)
|
foreach (var p in prerequisites)
|
||||||
if (!buildings.Keys.Contains(p) ||
|
if (!buildings.Keys.Contains(p))
|
||||||
(requiresPowered && buildings[p].All(b => b.TraitsImplementing<IDisable>().Any(d => d.Disabled))))
|
|
||||||
{
|
{
|
||||||
nowHasPrerequisites = false;
|
nowHasPrerequisites = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user