resources moved off player onto a synced trait
This commit is contained in:
@@ -47,7 +47,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
while( p.Value.Count > 0 && !Rules.TechTree.BuildableItems( self.Owner, p.Key ).Contains( p.Value[ 0 ].Item ) )
|
||||
{
|
||||
self.Owner.GiveCash(p.Value[0].TotalCost - p.Value[0].RemainingCost); // refund what's been paid so far.
|
||||
self.Owner.PlayerActor.traits.Get<PlayerResources>().GiveCash(p.Value[0].TotalCost - p.Value[0].RemainingCost); // refund what's been paid so far.
|
||||
FinishProduction(p.Key);
|
||||
}
|
||||
if( p.Value.Count > 0 )
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.Traits
|
||||
else if( lastIndex == 0 )
|
||||
{
|
||||
var item = queue[0];
|
||||
self.Owner.GiveCash(item.TotalCost - item.RemainingCost); // refund what's been paid so far.
|
||||
self.Owner.PlayerActor.traits.Get<PlayerResources>().GiveCash(item.TotalCost - item.RemainingCost); // refund what's been paid so far.
|
||||
FinishProduction(category);
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace OpenRA.Traits
|
||||
|
||||
if (Paused) return;
|
||||
|
||||
if (player.GetPowerState() != PowerState.Normal)
|
||||
if (player.PlayerActor.traits.Get<PlayerResources>().GetPowerState() != PowerState.Normal)
|
||||
{
|
||||
if (--slowdown <= 0)
|
||||
slowdown = player.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().LowPowerSlowdown;
|
||||
@@ -241,7 +241,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
var costThisFrame = RemainingCost / RemainingTime;
|
||||
if (costThisFrame != 0 && !player.TakeCash(costThisFrame)) return;
|
||||
if (costThisFrame != 0 && !player.PlayerActor.traits.Get<PlayerResources>().TakeCash(costThisFrame)) return;
|
||||
RemainingCost -= costThisFrame;
|
||||
RemainingTime -= 1;
|
||||
if (RemainingTime > 0) return;
|
||||
|
||||
Reference in New Issue
Block a user