cargo: support for actors being removed from the world, but not dying
This commit is contained in:
@@ -36,6 +36,7 @@ namespace OpenRa.Game
|
|||||||
Location = location;
|
Location = location;
|
||||||
CenterLocation = Traits.Util.CenterOfCell(Location);
|
CenterLocation = Traits.Util.CenterOfCell(Location);
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
|
IsInWorld = true;
|
||||||
|
|
||||||
if (Info == null) return;
|
if (Info == null) return;
|
||||||
|
|
||||||
@@ -123,6 +124,7 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool IsDead { get { return Health <= 0; } }
|
public bool IsDead { get { return Health <= 0; } }
|
||||||
|
public bool IsInWorld { get; set; }
|
||||||
|
|
||||||
public DamageState GetDamageState()
|
public DamageState GetDamageState()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRa.Game.Orders
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
selection.RemoveAll(a => a.IsDead);
|
selection.RemoveAll(a => !a.IsInWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Render()
|
public void Render()
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ namespace OpenRa.Game
|
|||||||
List<Action<World>> frameEndActions = new List<Action<World>>();
|
List<Action<World>> frameEndActions = new List<Action<World>>();
|
||||||
|
|
||||||
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
|
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
|
||||||
public void Remove(Actor a) { actors.Remove(a); ActorRemoved(a); }
|
public void Remove(Actor a)
|
||||||
|
{
|
||||||
|
a.IsInWorld = false; actors.Remove(a); ActorRemoved(a);
|
||||||
|
}
|
||||||
|
|
||||||
public void Add(IEffect b) { effects.Add(b); }
|
public void Add(IEffect b) { effects.Add(b); }
|
||||||
public void Remove(IEffect b) { effects.Remove(b); }
|
public void Remove(IEffect b) { effects.Remove(b); }
|
||||||
|
|||||||
Reference in New Issue
Block a user