Make ProductionParadrop and ProductionAirdrop refund undelivered actors

This commit is contained in:
abcdefg30
2020-09-08 20:21:18 +02:00
committed by reaperrr
parent 0dac4520ad
commit cc8908d7eb
2 changed files with 12 additions and 0 deletions

View File

@@ -87,7 +87,10 @@ namespace OpenRA.Mods.Common.Traits
owner.World.AddFrameEndTask(w => owner.World.AddFrameEndTask(w =>
{ {
if (!self.IsInWorld || self.IsDead) if (!self.IsInWorld || self.IsDead)
{
owner.PlayerActor.Trait<PlayerResources>().GiveCash(refundableValue);
return; return;
}
var actor = w.CreateActor(info.ActorType, new TypeDictionary var actor = w.CreateActor(info.ActorType, new TypeDictionary
{ {
@@ -101,7 +104,10 @@ namespace OpenRA.Mods.Common.Traits
actor.QueueActivity(new CallFunc(() => actor.QueueActivity(new CallFunc(() =>
{ {
if (!self.IsInWorld || self.IsDead) if (!self.IsInWorld || self.IsDead)
{
owner.PlayerActor.Trait<PlayerResources>().GiveCash(refundableValue);
return; return;
}
foreach (var cargo in self.TraitsImplementing<INotifyDelivery>()) foreach (var cargo in self.TraitsImplementing<INotifyDelivery>())
cargo.Delivered(self); cargo.Delivered(self);

View File

@@ -69,7 +69,10 @@ namespace OpenRA.Mods.Common.Traits
owner.World.AddFrameEndTask(w => owner.World.AddFrameEndTask(w =>
{ {
if (!self.IsInWorld || self.IsDead) if (!self.IsInWorld || self.IsDead)
{
owner.PlayerActor.Trait<PlayerResources>().GiveCash(refundableValue);
return; return;
}
var altitude = self.World.Map.Rules.Actors[actorType].TraitInfo<AircraftInfo>().CruiseAltitude; var altitude = self.World.Map.Rules.Actors[actorType].TraitInfo<AircraftInfo>().CruiseAltitude;
var actor = w.CreateActor(actorType, new TypeDictionary var actor = w.CreateActor(actorType, new TypeDictionary
@@ -83,7 +86,10 @@ namespace OpenRA.Mods.Common.Traits
actor.QueueActivity(new CallFunc(() => actor.QueueActivity(new CallFunc(() =>
{ {
if (!self.IsInWorld || self.IsDead) if (!self.IsInWorld || self.IsDead)
{
owner.PlayerActor.Trait<PlayerResources>().GiveCash(refundableValue);
return; return;
}
foreach (var cargo in self.TraitsImplementing<INotifyDelivery>()) foreach (var cargo in self.TraitsImplementing<INotifyDelivery>())
cargo.Delivered(self); cargo.Delivered(self);