finished TraitDictionary. Refactored permanent actor-removal.

This commit is contained in:
Bob
2010-08-15 01:14:06 +12:00
committed by Chris Forbes
parent c0d0636e08
commit 5561ac458b
14 changed files with 102 additions and 71 deletions

View File

@@ -34,8 +34,8 @@ namespace OpenRA.Mods.RA.Activities
foreach (var t in target.TraitsImplementing<INotifyCapture>())
t.OnCapture(target, self, oldOwner, self.Owner);
w.Remove(self);
self.Destroy();
});
return NextActivity;
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Activities
foreach (var t in target.TraitsImplementing<IAcceptSpy>())
t.OnInfiltrate(target, self);
self.World.AddFrameEndTask(w => w.Remove(self));
self.Destroy();
return NextActivity;
}

View File

@@ -27,8 +27,8 @@ namespace OpenRA.Mods.RA.Activities
if (health.DamageState == DamageState.Undamaged)
return NextActivity;
target.InflictDamage(self, -health.MaxHP, null);
self.World.AddFrameEndTask(w => w.Remove(self));
target.InflictDamage(self, -health.MaxHP, null);
self.Destroy();
return NextActivity;
}

View File

@@ -48,11 +48,11 @@ namespace OpenRA.Mods.RA.Activities
self.World.AddFrameEndTask(w =>
{
var selected = w.Selection.Contains(self);
self.World.Remove(self);
self.Destroy();
foreach (var s in sounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
var init = new TypeDictionary
{
new LocationInit( self.Location + offset ),

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA
var totalShares = shares.Sum(a => a.Second);
var n = self.World.SharedRandom.Next(totalShares);
self.World.AddFrameEndTask(w => w.Remove(self));
self.Destroy();
foreach (var s in shares)
if (n < s.Second)
{
@@ -75,9 +75,9 @@ namespace OpenRA.Mods.RA
public void Tick(Actor self)
{
if (++ticks >= self.Info.Traits.Get<CrateInfo>().Lifetime * 25)
self.World.AddFrameEndTask(w => w.Remove(self));
if( ++ticks >= self.Info.Traits.Get<CrateInfo>().Lifetime * 25 )
self.Destroy();
}
public int2 TopLeft { get { return Location; } }

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
self.Kill(self);
detonatedBy.Owner.Kills++;
self.Owner.Deaths++;
w.Remove(self);
self.Destroy();
} );
}
}

View File

@@ -26,8 +26,8 @@ namespace OpenRA.Mods.RA
public ReplaceWithActor(Actor self, ReplaceWithActorInfo info)
{
self.World.AddFrameEndTask(w =>
{
w.Remove(self);
{
self.Destroy();
w.CreateActor(info.Actor, new TypeDictionary
{
new LocationInit( self.Location ),

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA
a.QueueActivity(new Fly(order.TargetLocation));
if (flare != null)
a.QueueActivity(new CallFunc(() => Owner.World.AddFrameEndTask(_w => _w.Remove(flare))));
a.QueueActivity(new CallFunc(() => flare.Destroy()));
a.QueueActivity(new FlyOffMap { Interruptible = false });
a.QueueActivity(new RemoveSelf());