Player has Country now, not Race
This commit is contained in:
@@ -108,7 +108,7 @@ namespace OpenRA.Server
|
|||||||
Index = newConn.PlayerIndex,
|
Index = newConn.PlayerIndex,
|
||||||
PaletteIndex = ChooseFreePalette(),
|
PaletteIndex = ChooseFreePalette(),
|
||||||
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
||||||
Race = "allies", /* hack */
|
Country = "allies", /* hack */
|
||||||
State = Session.ClientState.NotReady
|
State = Session.ClientState.NotReady
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ namespace OpenRA.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetClient(conn).Race = s;
|
GetClient(conn).Country = s;
|
||||||
SyncLobbyInfo();
|
SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRa.FileFormats
|
|||||||
{
|
{
|
||||||
public int Index;
|
public int Index;
|
||||||
public int PaletteIndex;
|
public int PaletteIndex;
|
||||||
public string Race;
|
public string Country;
|
||||||
public int SpawnPoint;
|
public int SpawnPoint;
|
||||||
public string Name;
|
public string Name;
|
||||||
public ClientState State;
|
public ClientState State;
|
||||||
|
|||||||
@@ -153,10 +153,10 @@ namespace OpenRa
|
|||||||
{
|
{
|
||||||
DrawDownloadBar();
|
DrawDownloadBar();
|
||||||
|
|
||||||
chromeCollection = "chrome-" + world.LocalPlayer.Race;
|
chromeCollection = "chrome-" + world.LocalPlayer.Country.Race;
|
||||||
radarCollection = "radar-" + world.LocalPlayer.Race;
|
radarCollection = "radar-" + world.LocalPlayer.Country.Race;
|
||||||
paletteCollection = "palette-" + world.LocalPlayer.Race;
|
paletteCollection = "palette-" + world.LocalPlayer.Country.Race;
|
||||||
digitCollection = "digits-" + world.LocalPlayer.Race;
|
digitCollection = "digits-" + world.LocalPlayer.Country.Race;
|
||||||
|
|
||||||
buttons.Clear();
|
buttons.Clear();
|
||||||
|
|
||||||
@@ -362,9 +362,13 @@ namespace OpenRa
|
|||||||
|
|
||||||
void CycleRace(bool left)
|
void CycleRace(bool left)
|
||||||
{
|
{
|
||||||
// hack
|
var countries = Game.world.GetCountries();
|
||||||
var newRace = Game.world.LocalPlayer.Race == "allies" ? "soviet" : "allies";
|
var nextCountry = countries.Concat(countries)
|
||||||
Game.IssueOrder(Order.Chat("/race " + newRace));
|
.SkipWhile(c => c != Game.world.LocalPlayer.Country)
|
||||||
|
.Skip(1)
|
||||||
|
.First();
|
||||||
|
|
||||||
|
Game.IssueOrder(Order.Chat("/race " + nextCountry));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CycleReady(bool left)
|
void CycleReady(bool left)
|
||||||
@@ -467,7 +471,7 @@ namespace OpenRa
|
|||||||
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
||||||
Player.PlayerColors[client.PaletteIndex].c);
|
Player.PlayerColors[client.PaletteIndex].c);
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
renderer.DrawText(client.Race, new int2(r.Left + 220, y), Color.White);
|
renderer.DrawText(client.Country, new int2(r.Left + 220, y), Color.White);
|
||||||
renderer.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
renderer.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
||||||
renderer.DrawText((client.SpawnPoint == 0)? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
renderer.DrawText((client.SpawnPoint == 0)? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
||||||
y += 30;
|
y += 30;
|
||||||
@@ -569,7 +573,7 @@ namespace OpenRa
|
|||||||
string[] tabKeys = { "normal", "ready", "selected" };
|
string[] tabKeys = { "normal", "ready", "selected" };
|
||||||
var producing = queue.CurrentItem(groupName);
|
var producing = queue.CurrentItem(groupName);
|
||||||
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;
|
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;
|
||||||
var race = world.LocalPlayer.Race;
|
var race = world.LocalPlayer.Country.Race;
|
||||||
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer,"tabs-"+tabKeys[index], race+"-"+q.Key), new float2(x, y), "chrome");
|
rgbaRenderer.DrawSprite(ChromeProvider.GetImage(renderer,"tabs-"+tabKeys[index], race+"-"+q.Key), new float2(x, y), "chrome");
|
||||||
|
|
||||||
buttons.Add(Pair.New(new RectangleF(x, y, tabWidth, tabHeight),
|
buttons.Add(Pair.New(new RectangleF(x, y, tabWidth, tabHeight),
|
||||||
@@ -850,7 +854,7 @@ namespace OpenRa
|
|||||||
|
|
||||||
var allBuildables = Rules.TechTree.AllBuildables(world.LocalPlayer, queueName)
|
var allBuildables = Rules.TechTree.AllBuildables(world.LocalPlayer, queueName)
|
||||||
.Where(a => a.Traits.Contains<BuildableInfo>())
|
.Where(a => a.Traits.Contains<BuildableInfo>())
|
||||||
.Where(a => a.Traits.Get<BuildableInfo>().Owner.Contains(world.LocalPlayer.Race))
|
.Where(a => a.Traits.Get<BuildableInfo>().Owner.Contains(world.LocalPlayer.Country.Race))
|
||||||
.OrderBy(a => a.Traits.Get<BuildableInfo>().TechLevel);
|
.OrderBy(a => a.Traits.Get<BuildableInfo>().TechLevel);
|
||||||
|
|
||||||
var queue = world.LocalPlayer.PlayerActor.traits.Get<Traits.ProductionQueue>();
|
var queue = world.LocalPlayer.PlayerActor.traits.Get<Traits.ProductionQueue>();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRa.GameRules
|
|||||||
var bi = info.Traits.GetOrDefault<BuildableInfo>();
|
var bi = info.Traits.GetOrDefault<BuildableInfo>();
|
||||||
if( bi == null ) return false;
|
if( bi == null ) return false;
|
||||||
|
|
||||||
if( !bi.Owner.Contains( player.Race ) )
|
if( !bi.Owner.Contains( player.Country.Race ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach( var p in bi.Prerequisites )
|
foreach( var p in bi.Prerequisites )
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace OpenRa
|
|||||||
public int Kills;
|
public int Kills;
|
||||||
public string PlayerName;
|
public string PlayerName;
|
||||||
public string InternalName;
|
public string InternalName;
|
||||||
public string Race;
|
public CountryInfo Country;
|
||||||
public readonly int Index;
|
public readonly int Index;
|
||||||
public int Cash = 10000;
|
public int Cash = 10000;
|
||||||
public int Ore = 0;
|
public int Ore = 0;
|
||||||
@@ -62,7 +62,8 @@ namespace OpenRa
|
|||||||
|
|
||||||
this.PaletteIndex = client != null ? client.PaletteIndex : index;
|
this.PaletteIndex = client != null ? client.PaletteIndex : index;
|
||||||
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
|
this.PlayerName = client != null ? client.Name : "Player {0}".F(index+1);
|
||||||
this.Race = client != null ? client.Race : "allies";
|
this.Country = world.GetCountries().FirstOrDefault( c => client != null && client.Country == c.Name )
|
||||||
|
?? world.GetCountries().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePower()
|
void UpdatePower()
|
||||||
@@ -177,10 +178,10 @@ namespace OpenRa
|
|||||||
PlayerName = client.Name;
|
PlayerName = client.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Race != client.Race)
|
if (Country.Name != client.Country)
|
||||||
{
|
{
|
||||||
Game.chat.AddLine(this, "is now playing {0}".F(client.Race));
|
Game.chat.AddLine(this, "is now playing {0}".F(client.Country));
|
||||||
Race = client.Race;
|
Country = PlayerActor.World.GetCountries().First(c => c.Name == client.Country);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PaletteIndex != client.PaletteIndex)
|
if (PaletteIndex != client.PaletteIndex)
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ namespace OpenRa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var variants = (voicedUnit.Owner.Race == "allies")
|
// todo: fix this
|
||||||
|
var variants = (voicedUnit.Owner.Country.Race == "allies")
|
||||||
? vi.AlliedVariants : vi.SovietVariants;
|
? vi.AlliedVariants : vi.SovietVariants;
|
||||||
|
|
||||||
var variant = variants[voicedUnit.ActorID % variants.Length];
|
var variant = variants[voicedUnit.ActorID % variants.Length];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRa.Traits
|
|||||||
var buildings = Rules.TechTree.GatherBuildings(self.Owner);
|
var buildings = Rules.TechTree.GatherBuildings(self.Owner);
|
||||||
var effectivePrereq = Info.Prerequisites
|
var effectivePrereq = Info.Prerequisites
|
||||||
.Select(a => a.ToLowerInvariant())
|
.Select(a => a.ToLowerInvariant())
|
||||||
.Where(a => Rules.Info[a].Traits.Get<BuildableInfo>().Owner.Contains(self.Owner.Race));
|
.Where(a => Rules.Info[a].Traits.Get<BuildableInfo>().Owner.Contains(self.Owner.Country.Race));
|
||||||
|
|
||||||
if (Info.GivenAuto)
|
if (Info.GivenAuto)
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ namespace OpenRa.Traits
|
|||||||
var buildings = Rules.TechTree.GatherBuildings(Owner);
|
var buildings = Rules.TechTree.GatherBuildings(Owner);
|
||||||
var effectivePrereq = Info.Prerequisites
|
var effectivePrereq = Info.Prerequisites
|
||||||
.Select(a => a.ToLowerInvariant())
|
.Select(a => a.ToLowerInvariant())
|
||||||
.Where(a => Rules.Info[a].Traits.Get<BuildableInfo>().Owner.Contains(Owner.Race));
|
.Where(a => Rules.Info[a].Traits.Get<BuildableInfo>().Owner.Contains(Owner.Country.Race));
|
||||||
|
|
||||||
if (Info.Prerequisites.Count() == 0)
|
if (Info.Prerequisites.Count() == 0)
|
||||||
return Owner.GetPowerState() == PowerState.Normal;
|
return Owner.GetPowerState() == PowerState.Normal;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace OpenRa.Traits
|
namespace OpenRa.Traits
|
||||||
{
|
{
|
||||||
class CountryInfo : ITraitInfo
|
public class CountryInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly string Name = null;
|
public readonly string Name = null;
|
||||||
public readonly string Race = null;
|
public readonly string Race = null;
|
||||||
|
|||||||
@@ -186,5 +186,10 @@ namespace OpenRa
|
|||||||
!isX ? Game.SharedRandom.Next(w.Map.YOffset, w.Map.YOffset + w.Map.Height)
|
!isX ? Game.SharedRandom.Next(w.Map.YOffset, w.Map.YOffset + w.Map.Height)
|
||||||
: (edge ? w.Map.YOffset : w.Map.YOffset + w.Map.Height));
|
: (edge ? w.Map.YOffset : w.Map.YOffset + w.Map.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<CountryInfo> GetCountries(this World w)
|
||||||
|
{
|
||||||
|
return w.WorldActor.Info.Traits.WithInterface<CountryInfo>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user