Merge pull request #5801 from Mailaender/building-influence-crash
Fixed a crash when trying to capture husks that have been destroyed.
This commit is contained in:
@@ -217,6 +217,9 @@ namespace OpenRA
|
||||
{
|
||||
World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (this.Destroyed)
|
||||
return;
|
||||
|
||||
var oldOwner = Owner;
|
||||
|
||||
// momentarily remove from world so the ownership queries don't get confused
|
||||
|
||||
@@ -39,6 +39,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (actor.IsDead())
|
||||
return;
|
||||
|
||||
var lowEnoughHealth = health.HP <= capturableInfo.CaptureThreshold * health.MaxHP;
|
||||
if (!capturesInfo.Sabotage || lowEnoughHealth || actor.Owner.NonCombatant)
|
||||
{
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (target.Actor.IsDead())
|
||||
return;
|
||||
|
||||
var oldOwner = target.Actor.Owner;
|
||||
|
||||
target.Actor.ChangeOwner(self.Owner);
|
||||
|
||||
@@ -12,6 +12,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
|
||||
public class BuildingInfluenceInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new BuildingInfluence(init.world); }
|
||||
@@ -28,7 +29,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
|
||||
influence = new CellLayer<Actor>(map);
|
||||
|
||||
world.ActorAdded += a =>
|
||||
world.ActorAdded += a =>
|
||||
{
|
||||
var b = a.TraitOrDefault<Building>();
|
||||
if (b == null)
|
||||
|
||||
Reference in New Issue
Block a user