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 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;
|
public readonly BaseProviderInfo Info;
|
||||||
readonly DeveloperMode devMode;
|
readonly DeveloperMode devMode;
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
|
|
||||||
|
Building building;
|
||||||
|
|
||||||
int total;
|
int total;
|
||||||
int progress;
|
int progress;
|
||||||
bool allyBuildEnabled;
|
bool allyBuildEnabled;
|
||||||
@@ -46,6 +48,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
allyBuildEnabled = self.World.WorldActor.Trait<MapBuildRadius>().AllyBuildRadiusEnabled;
|
allyBuildEnabled = self.World.WorldActor.Trait<MapBuildRadius>().AllyBuildRadiusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void INotifyCreated.Created(Actor self)
|
||||||
|
{
|
||||||
|
building = self.TraitOrDefault<Building>();
|
||||||
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (progress > 0)
|
if (progress > 0)
|
||||||
@@ -59,6 +66,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public bool Ready()
|
public bool Ready()
|
||||||
{
|
{
|
||||||
|
if (building != null && building.Locked)
|
||||||
|
return false;
|
||||||
|
|
||||||
return devMode.FastBuild || progress == 0;
|
return devMode.FastBuild || progress == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user