Make BaseProvider PausableConditional
This commit is contained in:
committed by
reaperrr
parent
12054506e1
commit
c976bb1d7b
@@ -18,18 +18,17 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Limits the zone where buildings can be constructed to a radius around this actor.")]
|
||||
public class BaseProviderInfo : ITraitInfo
|
||||
public class BaseProviderInfo : PausableConditionalTraitInfo
|
||||
{
|
||||
public readonly WDist Range = WDist.FromCells(10);
|
||||
public readonly int Cooldown = 0;
|
||||
public readonly int InitialDelay = 0;
|
||||
|
||||
public object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
|
||||
public override object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
|
||||
}
|
||||
|
||||
public class BaseProvider : ITick, INotifyCreated, IRenderAboveShroudWhenSelected, ISelectionBar
|
||||
public class BaseProvider : PausableConditionalTrait<BaseProviderInfo>, ITick, INotifyCreated, IRenderAboveShroudWhenSelected, ISelectionBar
|
||||
{
|
||||
public readonly BaseProviderInfo Info;
|
||||
readonly DeveloperMode devMode;
|
||||
readonly Actor self;
|
||||
readonly bool allyBuildEnabled;
|
||||
@@ -41,8 +40,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int progress;
|
||||
|
||||
public BaseProvider(Actor self, BaseProviderInfo info)
|
||||
: base(info)
|
||||
{
|
||||
Info = info;
|
||||
this.self = self;
|
||||
devMode = self.Owner.PlayerActor.Trait<DeveloperMode>();
|
||||
progress = total = info.InitialDelay;
|
||||
@@ -69,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public bool Ready()
|
||||
{
|
||||
if (building != null && building.Locked)
|
||||
if (IsTraitDisabled || IsTraitPaused || (building != null && building.Locked))
|
||||
return false;
|
||||
|
||||
return devMode.FastBuild || progress == 0;
|
||||
@@ -82,6 +81,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IEnumerable<IRenderable> RangeCircleRenderables(WorldRenderer wr)
|
||||
{
|
||||
if (IsTraitDisabled)
|
||||
yield break;
|
||||
|
||||
// Visible to player and allies
|
||||
if (!ValidRenderPlayer())
|
||||
yield break;
|
||||
@@ -103,6 +105,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
float ISelectionBar.GetValue()
|
||||
{
|
||||
if (IsTraitDisabled)
|
||||
return 0f;
|
||||
|
||||
// Visible to player and allies
|
||||
if (!ValidRenderPlayer())
|
||||
return 0f;
|
||||
|
||||
Reference in New Issue
Block a user