Disable BaseProvider when building is locked.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user