Fix InitialActor in Carryall not initialized correctly
This commit is contained in:
@@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
cargo.World.Remove(cargo);
|
cargo.World.Remove(cargo);
|
||||||
carryable.Attached(cargo);
|
carryable.Attached(cargo, self);
|
||||||
carryall.AttachCarryable(self, cargo);
|
carryall.AttachCarryable(self, cargo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
base.Created(self);
|
base.Created(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Attached(Actor self)
|
public virtual void Attached(Actor self, Actor carrier)
|
||||||
{
|
{
|
||||||
if (attached)
|
if (attached)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attached = true;
|
attached = true;
|
||||||
|
Carrier = carrier;
|
||||||
|
|
||||||
if (carriedToken == Actor.InvalidConditionToken)
|
if (carriedToken == Actor.InvalidConditionToken)
|
||||||
carriedToken = self.GrantCondition(Info.CarriedCondition);
|
carriedToken = self.GrantCondition(Info.CarriedCondition);
|
||||||
|
|||||||
@@ -128,14 +128,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.InitialActor))
|
if (!string.IsNullOrEmpty(info.InitialActor))
|
||||||
{
|
{
|
||||||
var unit = self.World.CreateActor(false, info.InitialActor.ToLowerInvariant(), new TypeDictionary
|
var cargo = self.World.CreateActor(false, info.InitialActor.ToLowerInvariant(), new TypeDictionary
|
||||||
{
|
{
|
||||||
new ParentActorInit(self),
|
new ParentActorInit(self),
|
||||||
new OwnerInit(self.Owner)
|
new OwnerInit(self.Owner)
|
||||||
});
|
});
|
||||||
|
|
||||||
unit.Trait<Carryable>().Attached(unit);
|
cargo.Trait<Carryable>().Attached(cargo, self);
|
||||||
AttachCarryable(self, unit);
|
AttachCarryable(self, cargo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user