From 72374279f07b539e530842e922872a49d7fd5cee Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 20 Oct 2016 19:47:45 +0200 Subject: [PATCH] Move interfaces that have no ties to the engine to mod code --- OpenRA.Game/Traits/TraitsInterfaces.cs | 30 ------------------- OpenRA.Mods.Common/TraitsInterfaces.cs | 30 +++++++++++++++++++ .../Infiltration/InfiltrateForDecoration.cs | 1 + .../Infiltration/InfiltrateForExploration.cs | 1 + .../Infiltration/InfiltrateForSupportPower.cs | 1 + 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 66feb9aa24..ec83ce99b6 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -131,20 +131,11 @@ namespace OpenRA.Traits public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); } public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); } public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); } - public interface INotifyRepair { void Repairing(Actor self, Actor target); } public interface INotifyKilled { void Killed(Actor self, AttackInfo e); } public interface INotifyActorDisposing { void Disposing(Actor self); } public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); } - public interface INotifyBuildComplete { void BuildingComplete(Actor self); } - public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); } - public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); } - public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced); } - public interface INotifyDelivery { void IncomingDelivery(Actor self); void Delivered(Actor self); } public interface INotifyOwnerChanged { void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner); } public interface INotifyEffectiveOwnerChanged { void OnEffectiveOwnerChanged(Actor self, Player oldEffectiveOwner, Player newEffectiveOwner); } - public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); } - public interface INotifyInfiltrated { void Infiltrated(Actor self, Actor infiltrator); } - public interface INotifyDiscovered { void OnDiscovered(Actor self, Player discoverer, bool playNotification); } public interface ISeedableResource { void Seed(Actor self); } @@ -161,15 +152,7 @@ namespace OpenRA.Traits bool HasVoice(Actor self, string voice); } - public interface IDemolishableInfo : ITraitInfoInterface { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } - public interface IDemolishable - { - void Demolish(Actor self, Actor saboteur); - bool IsValidTarget(Actor self, Actor saboteur); - } - public interface IStoreResources { int Capacity { get; } } - public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); } public interface IEffectiveOwner { @@ -312,19 +295,6 @@ namespace OpenRA.Traits public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); } - [RequireExplicitImplementation] - public interface ICrushable - { - bool CrushableBy(Actor self, Actor crusher, HashSet crushClasses); - } - - [RequireExplicitImplementation] - public interface INotifyCrushed - { - void OnCrush(Actor self, Actor crusher, HashSet crushClasses); - void WarnCrush(Actor self, Actor crusher, HashSet crushClasses); - } - public interface ITraitInfoInterface { } public interface ITraitInfo : ITraitInfoInterface { object Create(ActorInitializer init); } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index f41b29452d..906830150c 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -43,6 +43,26 @@ namespace OpenRA.Mods.Common.Traits void Sold(Actor self); } + public interface IDemolishableInfo : ITraitInfoInterface { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } + public interface IDemolishable + { + void Demolish(Actor self, Actor saboteur); + bool IsValidTarget(Actor self, Actor saboteur); + } + + [RequireExplicitImplementation] + public interface ICrushable + { + bool CrushableBy(Actor self, Actor crusher, HashSet crushClasses); + } + + [RequireExplicitImplementation] + public interface INotifyCrushed + { + void OnCrush(Actor self, Actor crusher, HashSet crushClasses); + void WarnCrush(Actor self, Actor crusher, HashSet crushClasses); + } + [RequireExplicitImplementation] public interface INotifyAttack { @@ -50,10 +70,20 @@ namespace OpenRA.Mods.Common.Traits void PreparingAttack(Actor self, Target target, Armament a, Barrel barrel); } + public interface INotifyBuildComplete { void BuildingComplete(Actor self); } + public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); } + public interface INotifyRepair { void Repairing(Actor self, Actor target); } public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); } public interface INotifyCharging { void Charging(Actor self, Target target); } public interface INotifyChat { bool OnChat(string from, string message); } + public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); } + public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced); } + 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); } public interface INotifyParachuteLanded { void OnLanded(Actor ignore); } + public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); } + public interface INotifyInfiltrated { void Infiltrated(Actor self, Actor infiltrator); } + public interface INotifyDiscovered { void OnDiscovered(Actor self, Player discoverer, bool playNotification); } public interface IRenderActorPreviewInfo : ITraitInfo { IEnumerable RenderPreview(ActorPreviewInitializer init); } public interface ICruiseAltitudeInfo : ITraitInfo { WDist GetCruiseAltitude(); } diff --git a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForDecoration.cs b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForDecoration.cs index ab7c6e7b9d..4a3bab997e 100644 --- a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForDecoration.cs +++ b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForDecoration.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Linq; +using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits.Render; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForExploration.cs b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForExploration.cs index ff52e9c157..85dfd86ef3 100644 --- a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForExploration.cs +++ b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForExploration.cs @@ -9,6 +9,7 @@ */ #endregion +using OpenRA.Mods.Common.Traits; using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits diff --git a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForSupportPower.cs b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForSupportPower.cs index 943bdbe722..2513a86d16 100644 --- a/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.RA/Traits/Infiltration/InfiltrateForSupportPower.cs @@ -9,6 +9,7 @@ */ #endregion +using OpenRA.Mods.Common.Traits; using OpenRA.Primitives; using OpenRA.Traits;