Merge pull request #7421 from huwpascoe/bugfix-carryall

BugFix: harvester-carryall remote death
This commit is contained in:
Oliver Brakmann
2015-02-05 17:04:40 +01:00

View File

@@ -33,6 +33,7 @@ namespace OpenRA.Mods.D2k.Traits
// The actor we are currently carrying. // The actor we are currently carrying.
[Sync] Actor carrying; [Sync] Actor carrying;
bool isCarrying;
// TODO: Use ActorPreviews so that this can support actors with multiple sprites // TODO: Use ActorPreviews so that this can support actors with multiple sprites
Animation anim; Animation anim;
@@ -138,8 +139,8 @@ namespace OpenRA.Mods.D2k.Traits
{ {
if (carrying != null) if (carrying != null)
{ {
carrying.Kill(e.Attacker); if (isCarrying && carrying.IsInWorld && !carrying.IsDead)
carrying = null; carrying.Kill(e.Attacker);
} }
UnreserveCarryable(); UnreserveCarryable();
@@ -148,6 +149,8 @@ namespace OpenRA.Mods.D2k.Traits
// Called when carryable is inside. // Called when carryable is inside.
public void AttachCarryable(Actor carryable) public void AttachCarryable(Actor carryable)
{ {
isCarrying = true;
// Create a new animation for our carryable unit // Create a new animation for our carryable unit
anim = new Animation(self.World, RenderSprites.GetImage(carryable.Info), RenderSprites.MakeFacingFunc(self)); anim = new Animation(self.World, RenderSprites.GetImage(carryable.Info), RenderSprites.MakeFacingFunc(self));
anim.PlayRepeating("idle"); anim.PlayRepeating("idle");
@@ -157,6 +160,7 @@ namespace OpenRA.Mods.D2k.Traits
// Called when released // Called when released
public void CarryableReleased() public void CarryableReleased()
{ {
isCarrying = false;
anim = null; anim = null;
} }