unhacking Player and World actors
This commit is contained in:
@@ -120,7 +120,7 @@ namespace OpenRa.Game
|
||||
u => u.Key,
|
||||
u => SpriteSheetBuilder.LoadAllSprites(u.Value.Image)[0]);
|
||||
|
||||
var groups = Rules.NewUnitInfo.Values.Select( x => x.Category ).Distinct().ToList();
|
||||
var groups = Rules.NewUnitInfo.Values.Select( x => x.Category ).Distinct().Where( g => g != null ).ToList();
|
||||
|
||||
tabImageNames = groups.Select(
|
||||
(g, i) => Pair.New(g,
|
||||
|
||||
@@ -70,16 +70,13 @@ namespace OpenRa.Game
|
||||
var race = players.ContainsKey(i) ? players[i].Race : Race.Allies;
|
||||
var name = players.ContainsKey(i) ? players[i].PlayerName : "Player {0}".F(i+1);
|
||||
|
||||
var a = new Actor(null, new int2(int.MaxValue, int.MaxValue), null);
|
||||
var a = new Actor("Player", new int2(int.MaxValue, int.MaxValue), null);
|
||||
players[i] = new Player(a, i, (PaletteType) i, name, race, "Multi{0}".F(i));
|
||||
a.Owner = players[i];
|
||||
a.traits.Add(new Traits.ProductionQueue(a));
|
||||
Game.world.Add(a);
|
||||
}
|
||||
|
||||
var worldActor = new Actor(null, new int2(int.MaxValue, int.MaxValue), null);
|
||||
worldActor.traits.Add(new WaterPaletteRotation(worldActor));
|
||||
worldActor.traits.Add(new ChronoshiftPaletteEffect(worldActor));
|
||||
var worldActor = new Actor("World", new int2(int.MaxValue, int.MaxValue), null);
|
||||
Game.world.Add(worldActor);
|
||||
|
||||
Rules.Map.InitOreDensity();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.Game.Traits;
|
||||
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
@@ -97,7 +98,8 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public void GoToStartLocation()
|
||||
{
|
||||
Center(Game.world.Actors.Where(a => a.Info != null && a.Owner == Game.LocalPlayer));
|
||||
Center(Game.world.Actors.Where(a => a.Info != null
|
||||
&& a.traits.Contains<Selectable>() && a.Owner == Game.LocalPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,13 @@ using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
// this is NOT bound through rules (it belongs on the world actor!)
|
||||
// so no *Info required
|
||||
class ChronoshiftPaletteEffectInfo : StatelessTraitInfo<ChronoshiftPaletteEffect> { }
|
||||
|
||||
class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
||||
{
|
||||
const int chronoEffectLength = 20;
|
||||
int remainingFrames;
|
||||
|
||||
public ChronoshiftPaletteEffect(Actor self) { }
|
||||
|
||||
public void DoChronoshift()
|
||||
{
|
||||
remainingFrames = chronoEffectLength;
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
// this is NOT bound through rules (it belongs on the world actor!)
|
||||
// so no *Info required
|
||||
class WaterPaletteRotationInfo : StatelessTraitInfo<WaterPaletteRotation> { }
|
||||
|
||||
class WaterPaletteRotation : ITick, IPaletteModifier
|
||||
{
|
||||
public WaterPaletteRotation(Actor self) { }
|
||||
|
||||
float t = 0;
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
|
||||
@@ -42,3 +42,9 @@
|
||||
Priority: 3
|
||||
Building:
|
||||
|
||||
Player:
|
||||
ProductionQueue:
|
||||
|
||||
World:
|
||||
WaterPaletteRotation:
|
||||
ChronoshiftPaletteEffect:
|
||||
Reference in New Issue
Block a user