From feeae74455a1ec731d522c7a86cb5272ebab01e8 Mon Sep 17 00:00:00 2001 From: Mustafa Alperen Seki Date: Sat, 17 Nov 2018 14:16:44 +0300 Subject: [PATCH] Add INotifyResourceDumped Interface --- OpenRA.Mods.Common/Traits/Buildings/Refinery.cs | 8 ++++++++ OpenRA.Mods.Common/TraitsInterfaces.cs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs index 57991cb696..e29e1d8b04 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs @@ -113,6 +113,14 @@ namespace OpenRA.Mods.Common.Traits else amount = playerResources.ChangeCash(amount); + foreach (var notify in self.World.ActorsWithTrait()) + { + if (notify.Actor.Owner != self.Owner) + continue; + + notify.Trait.OnResourceAccepted(notify.Actor, self, amount); + } + if (info.ShowTicks) currentDisplayValue += amount; } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 7cc533b3af..cd37d14dc7 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -141,6 +141,9 @@ namespace OpenRA.Mods.Common.Traits public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init); } public interface INotifyDelivery { void IncomingDelivery(Actor self); void Delivered(Actor self); } public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); } + + [RequireExplicitImplementation] + public interface INotifyResourceAccepted { void OnResourceAccepted(Actor self, Actor refinery, int amount); } public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self, Actor ignore); } [RequireExplicitImplementation]