diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index 99dc45a675..b5105db9c2 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -295,7 +295,6 @@
-
diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs
index fbb1bd4d06..de9e9accca 100644
--- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs
+++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs
@@ -315,6 +315,107 @@ namespace OpenRA.Mods.RA.Server
server.SyncLobbyInfo();
return true;
}},
+ { "name",
+ s =>
+ {
+ Log.Write("server", "Player@{0} is now known as {1}", conn.socket.RemoteEndPoint, s);
+ client.Name = s;
+ server.SyncLobbyInfo();
+ return true;
+ }},
+ { "race",
+ s =>
+ {
+ var parts = s.Split(' ');
+ var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
+
+ // Only the host can change other client's info
+ if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
+ return true;
+
+ // Map has disabled race changes
+ if (server.lobbyInfo.Slots[targetClient.Slot].LockRace)
+ return true;
+
+ targetClient.Country = parts[1];
+ server.SyncLobbyInfo();
+ return true;
+ }},
+ { "team",
+ s =>
+ {
+ var parts = s.Split(' ');
+ var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
+
+ // Only the host can change other client's info
+ if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
+ return true;
+
+ // Map has disabled team changes
+ if (server.lobbyInfo.Slots[targetClient.Slot].LockTeam)
+ return true;
+
+ int team;
+ if (!int.TryParse(parts[1], out team)) { Log.Write("server", "Invalid team: {0}", s ); return false; }
+
+ targetClient.Team = team;
+ server.SyncLobbyInfo();
+ return true;
+ }},
+ { "spawn",
+ s =>
+ {
+ var parts = s.Split(' ');
+ var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
+
+ // Only the host can change other client's info
+ if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
+ return true;
+
+ // Spectators don't need a spawnpoint
+ if (targetClient.Slot == null)
+ return true;
+
+ // Map has disabled spawn changes
+ if (server.lobbyInfo.Slots[targetClient.Slot].LockSpawn)
+ return true;
+
+ int spawnPoint;
+ if (!int.TryParse(parts[1], out spawnPoint) || spawnPoint < 0 || spawnPoint > server.Map.SpawnPoints.Count())
+ {
+ Log.Write("server", "Invalid spawn point: {0}", parts[1]);
+ return true;
+ }
+
+ if (server.lobbyInfo.Clients.Where( cc => cc != client ).Any( cc => (cc.SpawnPoint == spawnPoint) && (cc.SpawnPoint != 0) ))
+ {
+ server.SendChatTo( conn, "You can't be at the same spawn point as another player" );
+ return true;
+ }
+
+ targetClient.SpawnPoint = spawnPoint;
+ server.SyncLobbyInfo();
+ return true;
+ }},
+ { "color",
+ s =>
+ {
+ var parts = s.Split(' ');
+ var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
+
+ // Only the host can change other client's info
+ if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
+ return true;
+
+ // Map has disabled color changes
+ if (targetClient.Slot != null && server.lobbyInfo.Slots[targetClient.Slot].LockColor)
+ 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]);
+ server.SyncLobbyInfo();
+ return true;
+ }}
};
var cmdName = cmd.Split(' ').First();
@@ -343,7 +444,7 @@ namespace OpenRA.Mods.RA.Server
};
}
- public static void LoadMap(S server)
+ static void LoadMap(S server)
{
server.Map = new Map(server.ModData.AvailableMaps[server.lobbyInfo.GlobalSettings.Map].Path);
server.lobbyInfo.Slots = server.Map.Players
diff --git a/OpenRA.Mods.RA/ServerTraits/PlayerCommands.cs b/OpenRA.Mods.RA/ServerTraits/PlayerCommands.cs
deleted file mode 100644
index 5efd56eee5..0000000000
--- a/OpenRA.Mods.RA/ServerTraits/PlayerCommands.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-#region Copyright & License Information
-/*
- * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
- * This file is part of OpenRA, which is free software. It is made
- * available to you under the terms of the GNU General Public License
- * as published by the Free Software Foundation. For more information,
- * see COPYING.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using OpenRA.Network;
-using OpenRA.Server;
-using S = OpenRA.Server.Server;
-using OpenRA.FileFormats;
-
-namespace OpenRA.Mods.RA.Server
-{
- public class PlayerCommands : ServerTrait, IInterpretCommand
- {
- public bool InterpretCommand( S server, Connection conn, Session.Client client, string cmd)
- {
- if (!LobbyCommands.ValidateCommand(server, conn, client, cmd))
- return false;
-
- var dict = new Dictionary>
- {
- { "name",
- s =>
- {
- Log.Write("server", "Player@{0} is now known as {1}", conn.socket.RemoteEndPoint, s);
- client.Name = s;
- server.SyncLobbyInfo();
- return true;
- }},
- { "race",
- s =>
- {
- var parts = s.Split(' ');
- var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
-
- // Only the host can change other client's info
- if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
- return true;
-
- // Map has disabled race changes
- if (server.lobbyInfo.Slots[targetClient.Slot].LockRace)
- return true;
-
- targetClient.Country = parts[1];
- server.SyncLobbyInfo();
- return true;
- }},
- { "team",
- s =>
- {
- var parts = s.Split(' ');
- var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
-
- // Only the host can change other client's info
- if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
- return true;
-
- // Map has disabled team changes
- if (server.lobbyInfo.Slots[targetClient.Slot].LockTeam)
- return true;
-
- int team;
- if (!int.TryParse(parts[1], out team)) { Log.Write("server", "Invalid team: {0}", s ); return false; }
-
- targetClient.Team = team;
- server.SyncLobbyInfo();
- return true;
- }},
- { "spawn",
- s =>
- {
- var parts = s.Split(' ');
- var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
-
- // Only the host can change other client's info
- if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
- return true;
-
- // Spectators don't need a spawnpoint
- if (targetClient.Slot == null)
- return true;
-
- // Map has disabled spawn changes
- if (server.lobbyInfo.Slots[targetClient.Slot].LockSpawn)
- return true;
-
- int spawnPoint;
- if (!int.TryParse(parts[1], out spawnPoint) || spawnPoint < 0 || spawnPoint > server.Map.SpawnPoints.Count())
- {
- Log.Write("server", "Invalid spawn point: {0}", parts[1]);
- return true;
- }
-
- if (server.lobbyInfo.Clients.Where( cc => cc != client ).Any( cc => (cc.SpawnPoint == spawnPoint) && (cc.SpawnPoint != 0) ))
- {
- server.SendChatTo( conn, "You can't be at the same spawn point as another player" );
- return true;
- }
-
- targetClient.SpawnPoint = spawnPoint;
- server.SyncLobbyInfo();
- return true;
- }},
- { "color",
- s =>
- {
- var parts = s.Split(' ');
- var targetClient = server.lobbyInfo.ClientWithIndex(int.Parse(parts[0]));
-
- // Only the host can change other client's info
- if (targetClient.Index != client.Index && conn.PlayerIndex != 0)
- return true;
-
- // Map has disabled color changes
- if (targetClient.Slot != null && server.lobbyInfo.Slots[targetClient.Slot].LockColor)
- 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]);
- server.SyncLobbyInfo();
- return true;
- }}
- };
-
- var cmdName = cmd.Split(' ').First();
- var cmdValue = string.Join(" ", cmd.Split(' ').Skip(1).ToArray());
-
- Func a;
- if (!dict.TryGetValue(cmdName, out a))
- return false;
-
- return a(cmdValue);
- }
- }
-}
diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml
index 1dd3a9e772..fdd5953f9d 100644
--- a/mods/cnc/mod.yaml
+++ b/mods/cnc/mod.yaml
@@ -106,7 +106,6 @@ LoadScreen: CncLoadScreen
PackageURL: http://open-ra.org/get-dependency.php?file=cnc-packages
ServerTraits:
- PlayerCommands
LobbyCommands
MasterServerPinger
diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml
index e95f6d326f..dffbf2a53e 100644
--- a/mods/ra/mod.yaml
+++ b/mods/ra/mod.yaml
@@ -89,7 +89,6 @@ LoadScreen: RALoadScreen
PackageURL: http://open-ra.org/get-dependency.php?file=ra-packages
ServerTraits:
- PlayerCommands
LobbyCommands
MasterServerPinger