Disable Gps when tech center is disabled.
This commit is contained in:
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
public override object Create(ActorInitializer init) { return new GpsPower(init.Self, this); }
|
||||
}
|
||||
|
||||
class GpsPower : SupportPower, INotifyKilled, INotifySold, INotifyOwnerChanged
|
||||
class GpsPower : SupportPower, INotifyKilled, INotifySold, INotifyOwnerChanged, ITick
|
||||
{
|
||||
readonly GpsPowerInfo info;
|
||||
GpsWatcher owner;
|
||||
@@ -83,5 +83,21 @@ namespace OpenRA.Mods.RA.Traits
|
||||
owner = newOwner.PlayerActor.Trait<GpsWatcher>();
|
||||
owner.GpsAdd(self);
|
||||
}
|
||||
|
||||
bool wasDisabled;
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (!wasDisabled && self.IsDisabled())
|
||||
{
|
||||
wasDisabled = true;
|
||||
RemoveGps(self);
|
||||
}
|
||||
else if (wasDisabled && !self.IsDisabled())
|
||||
{
|
||||
wasDisabled = false;
|
||||
owner.GpsAdd(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user