Move INotifyDamageStateChanged to mod code and require explicit implementation
This commit is contained in:
@@ -130,7 +130,6 @@ namespace OpenRA.Traits
|
|||||||
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 INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
|
||||||
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
||||||
public interface INotifyActorDisposing { void Disposing(Actor self); }
|
public interface INotifyActorDisposing { void Disposing(Actor self); }
|
||||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DamageStateChanged(Actor self, AttackInfo e)
|
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
Do((b, d) => b.UpdateState());
|
Do((b, d) => b.UpdateState());
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DamageStateChanged(Actor self, AttackInfo e)
|
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (!self.IsInWorld)
|
if (!self.IsInWorld)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
return RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), sequence);
|
return RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void DamageStateChanged(Actor self, AttackInfo e)
|
protected virtual void DamageStateChanged(Actor self)
|
||||||
{
|
{
|
||||||
if (DefaultAnimation.CurrentSequence != null)
|
if (DefaultAnimation.CurrentSequence != null)
|
||||||
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
||||||
@@ -128,6 +128,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
DefaultAnimation.ReplaceAnim(sequence);
|
DefaultAnimation.ReplaceAnim(sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
DamageStateChanged(self);
|
||||||
|
}
|
||||||
|
|
||||||
void INotifyBuildComplete.BuildingComplete(Actor self) { buildComplete = true; }
|
void INotifyBuildComplete.BuildingComplete(Actor self) { buildComplete = true; }
|
||||||
void INotifySold.Selling(Actor self) { buildComplete = false; }
|
void INotifySold.Selling(Actor self) { buildComplete = false; }
|
||||||
void INotifySold.Sold(Actor self) { }
|
void INotifySold.Sold(Actor self) { }
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DamageStateChanged(Actor self, AttackInfo e)
|
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
var rand = Game.CosmeticRandom;
|
var rand = Game.CosmeticRandom;
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||||
|
|
||||||
|
[RequireExplicitImplementation]
|
||||||
|
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
||||||
|
|
||||||
public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); }
|
public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); }
|
||||||
public interface INotifyRepair { void Repairing(Actor self, Actor target); }
|
public interface INotifyRepair { void Repairing(Actor self, Actor target); }
|
||||||
public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); }
|
public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); }
|
||||||
|
|||||||
Reference in New Issue
Block a user