Remove Infiltratable trait and refactor surrounding code to use target types

This commit is contained in:
ScottNZ
2014-08-01 01:19:05 +12:00
parent 9422285aa2
commit 058185754e
12 changed files with 54 additions and 94 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -13,24 +13,25 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class InfiltrateForSupportPowerInfo : ITraitInfo, Requires<InfiltratableInfo>
class InfiltrateForSupportPowerInfo : ITraitInfo
{
[ActorReference] public readonly string Proxy = null;
public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); }
}
class InfiltrateForSupportPower : IAcceptInfiltrator
{
InfiltrateForSupportPowerInfo Info;
readonly InfiltrateForSupportPowerInfo info;
public InfiltrateForSupportPower(InfiltrateForSupportPowerInfo info)
{
Info = info;
this.info = info;
}
public void OnInfiltrate(Actor self, Actor infiltrator)
{
infiltrator.World.AddFrameEndTask(w => w.CreateActor(Info.Proxy, new TypeDictionary
infiltrator.World.AddFrameEndTask(w => w.CreateActor(info.Proxy, new TypeDictionary
{
new OwnerInit(infiltrator.Owner)
}));