Require explicit INotifyCreated

This commit is contained in:
reaperrr
2017-09-27 22:17:40 +02:00
committed by abcdefg30
parent 6f790938d0
commit 5026dfe5d3
8 changed files with 10 additions and 7 deletions

View File

@@ -129,7 +129,10 @@ namespace OpenRA.Traits
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); } public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); } public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); } public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
[RequireExplicitImplementation]
public interface INotifyCreated { void Created(Actor self); } public interface INotifyCreated { void Created(Actor self); }
public interface INotifyAddedToWorld { void AddedToWorld(Actor self); } public interface INotifyAddedToWorld { void AddedToWorld(Actor self); }
public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); } public interface INotifyRemovedFromWorld { void RemovedFromWorld(Actor self); }
public interface INotifyActorDisposing { void Disposing(Actor self); } public interface INotifyActorDisposing { void Disposing(Actor self); }

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
PaletteName = info.IsPlayerPalette ? info.Palette + self.Owner.InternalName : info.Palette; PaletteName = info.IsPlayerPalette ? info.Palette + self.Owner.InternalName : info.Palette;
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
self.World.Add(new RallyPointIndicator(self, this, self.Info.TraitInfos<ExitInfo>().ToArray())); self.World.Add(new RallyPointIndicator(self, this, self.Info.TraitInfos<ExitInfo>().ToArray()));
} }

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
deployState = init.Get<DeployStateInit, DeployState>(); deployState = init.Get<DeployStateInit, DeployState>();
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
conditionManager = self.TraitOrDefault<ConditionManager>(); conditionManager = self.TraitOrDefault<ConditionManager>();
notify = self.TraitsImplementing<INotifyDeployTriggered>().ToArray(); notify = self.TraitsImplementing<INotifyDeployTriggered>().ToArray();

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
move = self.Trait<IMove>(); move = self.Trait<IMove>();
} }

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
finalPosition = init.World.Map.CenterOfCell(TopLeft); finalPosition = init.World.Map.CenterOfCell(TopLeft);
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
var distance = (finalPosition - CenterPosition).Length; var distance = (finalPosition - CenterPosition).Length;
if (dragSpeed > 0 && distance > 0) if (dragSpeed > 0 && distance > 0)

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
conditionManager = self.TraitOrDefault<ConditionManager>(); conditionManager = self.TraitOrDefault<ConditionManager>();

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
if (!self.Owner.PlayerActor.Trait<TechTree>().HasPrerequisites(info.Prerequisites)) if (!self.Owner.PlayerActor.Trait<TechTree>().HasPrerequisites(info.Prerequisites))
return; return;

View File

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits.Render
throw new InvalidOperationException("No queues available for production type '{0}'".F(type)); throw new InvalidOperationException("No queues available for production type '{0}'".F(type));
} }
public void Created(Actor self) void INotifyCreated.Created(Actor self)
{ {
FindQueue(); FindQueue();
} }