Fix carryalls telling carryables to unreserve when they are reserved for a different carryall;
Reserve carryable in FreeActorWithDelivery
This commit is contained in:
@@ -64,7 +64,9 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
if (clientInitialActivity != null)
|
||||
cargo.QueueActivity(Game.CreateObject<Activity>(clientInitialActivity));
|
||||
|
||||
cargo.Trait<Carryable>().Destination = location;
|
||||
var carryable = cargo.Trait<Carryable>();
|
||||
carryable.Destination = location;
|
||||
carryable.Reserve(carrier);
|
||||
|
||||
carrier.Trait<Carryall>().AttachCarryable(cargo);
|
||||
|
||||
|
||||
@@ -116,6 +116,9 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
public bool Reserve(Actor carrier)
|
||||
{
|
||||
if (Reserved)
|
||||
return false;
|
||||
|
||||
if ((self.Location - Destination).Length < info.MinDistance)
|
||||
{
|
||||
MovementCancelled(self);
|
||||
|
||||
@@ -122,6 +122,9 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
// Reserve the carryable so its ours exclusively
|
||||
public bool ReserveCarryable(Actor carryable)
|
||||
{
|
||||
if (Carrying != null)
|
||||
return false;
|
||||
|
||||
if (carryable.Trait<Carryable>().Reserve(self))
|
||||
{
|
||||
Carrying = carryable;
|
||||
@@ -144,6 +147,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
Carrying = null;
|
||||
}
|
||||
|
||||
// INotifyKilled
|
||||
@@ -177,6 +181,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
// Called when released
|
||||
public void CarryableReleased()
|
||||
{
|
||||
IsBusy = false;
|
||||
IsCarrying = false;
|
||||
anim = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user