Revert client colours to their preferred colours after the map is changed to a map which doesn't lock colours.
This commit is contained in:
@@ -42,7 +42,9 @@ namespace OpenRA.Network
|
||||
public class Client
|
||||
{
|
||||
public int Index;
|
||||
public ColorRamp ColorRamp;
|
||||
public ColorRamp PreferredColorRamp; // Color that the client normally uses from settings.yaml.
|
||||
public ColorRamp ColorRamp; // Actual color that the client is using.
|
||||
// Usually the same as PreferredColorRamp but can be different on maps with locked colors.
|
||||
public string Country;
|
||||
public int SpawnPoint;
|
||||
public string Name;
|
||||
|
||||
@@ -119,6 +119,7 @@ namespace OpenRA.Network
|
||||
var info = new Session.Client()
|
||||
{
|
||||
Name = Game.Settings.Player.Name,
|
||||
PreferredColorRamp = Game.Settings.Player.ColorRamp,
|
||||
ColorRamp = Game.Settings.Player.ColorRamp,
|
||||
Country = "random",
|
||||
SpawnPoint = 0,
|
||||
|
||||
@@ -374,6 +374,8 @@ namespace OpenRA.Server
|
||||
return;
|
||||
if (pr.LockColor)
|
||||
c.ColorRamp = pr.ColorRamp;
|
||||
else
|
||||
c.ColorRamp = c.PreferredColorRamp;
|
||||
if (pr.LockRace)
|
||||
c.Country = pr.Race;
|
||||
if (pr.LockSpawn)
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
var hue = (byte)server.Random.Next(255);
|
||||
var sat = (byte)server.Random.Next(255);
|
||||
var lum = (byte)server.Random.Next(51,255);
|
||||
bot.ColorRamp = new ColorRamp(hue, sat, lum, 10);
|
||||
bot.ColorRamp = bot.PreferredColorRamp = new ColorRamp(hue, sat, lum, 10);
|
||||
|
||||
server.lobbyInfo.Clients.Add(bot);
|
||||
}
|
||||
@@ -472,7 +472,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
return true;
|
||||
|
||||
var ci = parts[1].Split(',').Select(cc => int.Parse(cc)).ToArray();
|
||||
targetClient.ColorRamp = new ColorRamp((byte)ci[0], (byte)ci[1], (byte)ci[2], (byte)ci[3]);
|
||||
targetClient.ColorRamp = targetClient.PreferredColorRamp = new ColorRamp((byte)ci[0], (byte)ci[1], (byte)ci[2], (byte)ci[3]);
|
||||
server.SyncLobbyInfo();
|
||||
return true;
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user