Make the editor use an EchoConnection instead of a local server

This commit is contained in:
abcdefg30
2021-09-05 20:52:14 +02:00
committed by Matthias Mailänder
parent e0e219793f
commit 0b75991fbc
2 changed files with 16 additions and 19 deletions

View File

@@ -103,6 +103,20 @@ namespace OpenRA
static void JoinLocal()
{
JoinInner(new OrderManager(new EchoConnection()));
// Add a spectator client for the local player
// On the shellmap this player is controlling the map via scripted orders
OrderManager.LobbyInfo.Clients.Add(new Session.Client
{
Index = OrderManager.Connection.LocalClientId,
Name = Settings.Player.Name,
PreferredColor = Settings.Player.Color,
Color = Settings.Player.Color,
Faction = "Random",
SpawnPoint = 0,
Team = 0,
State = Session.ClientState.Ready
});
}
// More accurate replacement for Environment.TickCount
@@ -484,27 +498,13 @@ namespace OpenRA
public static void LoadEditor(string mapUid)
{
JoinLocal();
StartGame(mapUid, WorldType.Editor);
}
public static void LoadShellMap()
{
var shellmap = ChooseShellmap();
// Add a spectator client for the local player,
// who is controlling the map via scripted orders
OrderManager.LobbyInfo.Clients.Add(new Session.Client
{
Index = OrderManager.Connection.LocalClientId,
Name = Settings.Player.Name,
PreferredColor = Settings.Player.Color,
Color = Settings.Player.Color,
Faction = "Random",
SpawnPoint = 0,
Team = 0,
State = Session.ClientState.Ready
});
using (new PerfTimer("StartGame"))
{
StartGame(shellmap, WorldType.Shellmap);

View File

@@ -343,10 +343,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void LoadMapIntoEditor(string uid)
{
ConnectionLogic.Connect(Game.CreateLocalServer(uid),
"",
() => { Game.LoadEditor(uid); },
() => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); });
Game.LoadEditor(uid);
DiscordService.UpdateStatus(DiscordState.InMapEditor);