Disable BaseProvider when building is locked.

This commit is contained in:
Paul Chote
2016-09-03 09:52:55 +01:00
parent a09b32b4f3
commit 2df5918315

View File

@@ -27,12 +27,14 @@ namespace OpenRA.Mods.Common.Traits
public object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
}
public class BaseProvider : ITick, IRenderAboveShroudWhenSelected, ISelectionBar
public class BaseProvider : ITick, INotifyCreated, IRenderAboveShroudWhenSelected, ISelectionBar
{
public readonly BaseProviderInfo Info;
readonly DeveloperMode devMode;
readonly Actor self;
Building building;
int total;
int progress;
bool allyBuildEnabled;
@@ -46,6 +48,11 @@ namespace OpenRA.Mods.Common.Traits
allyBuildEnabled = self.World.WorldActor.Trait<MapBuildRadius>().AllyBuildRadiusEnabled;
}
void INotifyCreated.Created(Actor self)
{
building = self.TraitOrDefault<Building>();
}
void ITick.Tick(Actor self)
{
if (progress > 0)
@@ -59,6 +66,9 @@ namespace OpenRA.Mods.Common.Traits
public bool Ready()
{
if (building != null && building.Locked)
return false;
return devMode.FastBuild || progress == 0;
}