Move SpawnActorOnDeath to OpenRA.Mods.Common & fix spawned death actor teleportation
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -30,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new Turreted(init, this); }
|
||||
}
|
||||
|
||||
public class Turreted : ITick, ISync, INotifyCreated
|
||||
public class Turreted : ITick, ISync, INotifyCreated, IDeathActorInitModifier
|
||||
{
|
||||
readonly TurretedInfo info;
|
||||
AttackTurreted attack;
|
||||
@@ -135,6 +136,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var facing = Util.QuantizeFacing(local.Yaw.Angle / 4, QuantizedFacings) * (256 / QuantizedFacings);
|
||||
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
|
||||
}
|
||||
|
||||
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
|
||||
{
|
||||
var facings = init.GetOrDefault<TurretFacingsInit>();
|
||||
if (facings == null)
|
||||
{
|
||||
facings = new TurretFacingsInit();
|
||||
init.Add(facings);
|
||||
}
|
||||
|
||||
facings.Value(self.World).Add(Name, facing.Facing);
|
||||
}
|
||||
}
|
||||
|
||||
public class TurretFacingInit : IActorInit<int>
|
||||
|
||||
Reference in New Issue
Block a user