Fixes order lines not being shown after reselect once their lifetime has expired.
Adds INotifyBecomingIdle.
This commit is contained in:
@@ -19,6 +19,7 @@ NEW:
|
|||||||
Added Ctrl+T shortcut for selection of all units matching the types of the currently selected ones across the screen and map.
|
Added Ctrl+T shortcut for selection of all units matching the types of the currently selected ones across the screen and map.
|
||||||
Added a toggle spectators to multiplayer.
|
Added a toggle spectators to multiplayer.
|
||||||
Removed the ability of commandos to plant C4 on walls.
|
Removed the ability of commandos to plant C4 on walls.
|
||||||
|
Order lines are now shown on unit selection.
|
||||||
Dune 2000:
|
Dune 2000:
|
||||||
Added the Atreides grenadier from the 1.06 patch.
|
Added the Atreides grenadier from the 1.06 patch.
|
||||||
Added randomized tiles for Sand and Rock terrain.
|
Added randomized tiles for Sand and Rock terrain.
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
|
var wasIdle = IsIdle;
|
||||||
currentActivity = Traits.Util.RunActivity(this, currentActivity);
|
currentActivity = Traits.Util.RunActivity(this, currentActivity);
|
||||||
|
if (!wasIdle && IsIdle)
|
||||||
|
foreach (var n in TraitsImplementing<INotifyBecomingIdle>())
|
||||||
|
n.OnBecomingIdle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIdle
|
public bool IsIdle
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace OpenRA
|
|||||||
public void Add(World w, Actor a)
|
public void Add(World w, Actor a)
|
||||||
{
|
{
|
||||||
actors.Add(a);
|
actors.Add(a);
|
||||||
|
foreach (var sel in a.TraitsImplementing<INotifySelected>())
|
||||||
|
sel.Selected(a);
|
||||||
foreach (var ns in w.WorldActor.TraitsImplementing<INotifySelection>())
|
foreach (var ns in w.WorldActor.TraitsImplementing<INotifySelection>())
|
||||||
ns.SelectionChanged();
|
ns.SelectionChanged();
|
||||||
}
|
}
|
||||||
@@ -47,6 +49,9 @@ namespace OpenRA
|
|||||||
if (voicedUnit != null)
|
if (voicedUnit != null)
|
||||||
Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race);
|
Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race);
|
||||||
|
|
||||||
|
foreach (var a in newSelection)
|
||||||
|
foreach (var sel in a.TraitsImplementing<INotifySelected>())
|
||||||
|
sel.Selected(a);
|
||||||
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
||||||
ns.SelectionChanged();
|
ns.SelectionChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Traits
|
|||||||
public virtual object Create(ActorInitializer init) { return new DrawLineToTarget(init.self, this); }
|
public virtual object Create(ActorInitializer init) { return new DrawLineToTarget(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DrawLineToTarget : IPostRenderSelection
|
public class DrawLineToTarget : IPostRenderSelection, INotifySelected, INotifyBecomingIdle
|
||||||
{
|
{
|
||||||
Actor self;
|
Actor self;
|
||||||
DrawLineToTargetInfo Info;
|
DrawLineToTargetInfo Info;
|
||||||
@@ -49,6 +49,12 @@ namespace OpenRA.Traits
|
|||||||
lifetime = Info.Ticks;
|
lifetime = Info.Ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Selected(Actor a)
|
||||||
|
{
|
||||||
|
// Reset the order line timeout.
|
||||||
|
lifetime = Info.Ticks;
|
||||||
|
}
|
||||||
|
|
||||||
public void RenderAfterWorld(WorldRenderer wr)
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var force = Game.GetModifierKeys().HasModifier(Modifiers.Alt);
|
var force = Game.GetModifierKeys().HasModifier(Modifiers.Alt);
|
||||||
@@ -70,6 +76,12 @@ namespace OpenRA.Traits
|
|||||||
wr.DrawTargetMarker(c, to);
|
wr.DrawTargetMarker(c, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnBecomingIdle(Actor a)
|
||||||
|
{
|
||||||
|
if (a.IsIdle)
|
||||||
|
targets = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LineTargetExts
|
public static class LineTargetExts
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ namespace OpenRA.Traits
|
|||||||
public interface Requires<T> where T : class { }
|
public interface Requires<T> where T : class { }
|
||||||
public interface UsesInit<T> where T : IActorInit { }
|
public interface UsesInit<T> where T : IActorInit { }
|
||||||
|
|
||||||
|
public interface INotifySelected { void Selected(Actor self); }
|
||||||
public interface INotifySelection { void SelectionChanged(); }
|
public interface INotifySelection { void SelectionChanged(); }
|
||||||
public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); }
|
public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); }
|
||||||
public interface ICreatePlayers { void CreatePlayers(World w); }
|
public interface ICreatePlayers { void CreatePlayers(World w); }
|
||||||
@@ -196,6 +197,7 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
||||||
|
public interface INotifyBecomingIdle { void OnBecomingIdle(Actor self); }
|
||||||
public interface INotifyIdle { void TickIdle(Actor self); }
|
public interface INotifyIdle { void TickIdle(Actor self); }
|
||||||
|
|
||||||
public interface IBlocksBullets { }
|
public interface IBlocksBullets { }
|
||||||
|
|||||||
Reference in New Issue
Block a user