Fix crashes related to transports
Fixes two specific causes of transport related crashes, one prevents infantry from continuing to take damage by Tiberium if loaded into the transport over Tiberium, and one fixes the edge case where an infantry dies in the same tick cycle as it was loaded into the transport.
This commit is contained in:
@@ -32,6 +32,9 @@ namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
if (--poisonTicks > 0) return;
|
||||
|
||||
// Prevents harming infantry in cargo.
|
||||
if (!self.IsInWorld) return;
|
||||
|
||||
var rl = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
var r = rl.GetResource(self.Location);
|
||||
if (r == null) return;
|
||||
|
||||
@@ -41,8 +41,14 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (!cells.Contains(self.Location))
|
||||
return NextActivity;
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if(self.IsDead() || transport.IsDead() || !cargo.CanLoad(transport, self))
|
||||
return;
|
||||
|
||||
cargo.Load(transport, self);
|
||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||
w.Remove(self);
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user