Convert all CreateActor calls to use TypeDictionary

This commit is contained in:
alzeih
2010-08-02 01:28:07 +12:00
parent 4ea66ea309
commit 578d42614b
20 changed files with 131 additions and 63 deletions

View File

@@ -13,6 +13,7 @@ using System.Linq;
using System.Collections.Generic;
using OpenRA.Traits;
using OpenRA.Mods.RA.Render;
using OpenRA.FileFormats;
namespace OpenRA.Mods.RA.Activities
{
@@ -51,17 +52,18 @@ namespace OpenRA.Mods.RA.Activities
self.World.Remove(self);
foreach (var s in sounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
var a = w.CreateActor(actor, self.Location + offset, self.Owner);
var a = w.CreateActor( actor, new TypeDictionary
{
new LocationInit( self.Location + offset ),
new OwnerInit( self.Owner ),
new FacingInit( facing ),
});
var oldHealth = self.traits.GetOrDefault<Health>();
var newHealth = a.traits.GetOrDefault<Health>();
if (oldHealth != null && newHealth != null)
newHealth.HPFraction = oldHealth.HPFraction;
var ifacing = a.traits.GetOrDefault<IFacing>();
if (ifacing != null)
ifacing.Facing = facing;
if (selected)
w.Selection.Add(w, a);
});