|
8 | 8 | */ |
9 | 9 | #endregion |
10 | 10 |
|
11 | | -using System.Collections.Generic; |
12 | 11 | using OpenRA.Mods.Common; |
13 | 12 | using OpenRA.Mods.Common.Traits; |
14 | 13 | using OpenRA.Primitives; |
@@ -47,21 +46,16 @@ class InfiltrateToCreateProxyActorInfo : TraitInfo |
47 | 46 | [Desc("If true, spawn at the location of the infiltrated actor.")] |
48 | 47 | public readonly bool UseCenterPosition = false; |
49 | 48 |
|
50 | | - [Desc("If true, the spawned actor is destroyed if the parent actor dies, is sold, or is captured.")] |
51 | | - public readonly bool LinkedToParent = false; |
52 | | - |
53 | 49 | public override object Create(ActorInitializer init) { return new InfiltrateToCreateProxyActor(this); } |
54 | 50 | } |
55 | 51 |
|
56 | | - class InfiltrateToCreateProxyActor : INotifyInfiltrated, INotifyRemovedFromWorld |
| 52 | + class InfiltrateToCreateProxyActor : INotifyInfiltrated |
57 | 53 | { |
58 | 54 | readonly InfiltrateToCreateProxyActorInfo info; |
59 | | - List<Actor> spawnedActors; |
60 | 55 |
|
61 | 56 | public InfiltrateToCreateProxyActor(InfiltrateToCreateProxyActorInfo info) |
62 | 57 | { |
63 | 58 | this.info = info; |
64 | | - spawnedActors = new List<Actor>(); |
65 | 59 | } |
66 | 60 |
|
67 | 61 | void INotifyInfiltrated.Infiltrated(Actor self, Actor infiltrator, BitSet<TargetableType> types) |
@@ -95,16 +89,7 @@ void INotifyInfiltrated.Infiltrated(Actor self, Actor infiltrator, BitSet<Target |
95 | 89 | else if (info.UseLocation) |
96 | 90 | td.Add(new LocationInit(self.Location)); |
97 | 91 |
|
98 | | - infiltrator.World.AddFrameEndTask(w => spawnedActors.Add(w.CreateActor(info.Proxy, td))); |
99 | | - } |
100 | | - |
101 | | - void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) |
102 | | - { |
103 | | - foreach (var a in spawnedActors) |
104 | | - { |
105 | | - if (!a.IsDead) |
106 | | - a.Dispose(); |
107 | | - } |
| 92 | + infiltrator.World.AddFrameEndTask(w => w.CreateActor(info.Proxy, td)); |
108 | 93 | } |
109 | 94 | } |
110 | 95 | } |
0 commit comments