Added : Some missing changes to make WorldGameOver work (ie missing RejoinLobby etc)
Warning: Please add the following manually (if you cant find it): in Game.cs find 'case ConnectionState.Connected:' add if (ConnectedToLobby != null) ConnectedToLobby(); Tried my best to add it in the patch but it failed :(
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
@@ -153,6 +154,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static event Action LobbyInfoChanged = () => { };
|
internal static event Action LobbyInfoChanged = () => { };
|
||||||
|
internal static event Action ConnectedToLobby = () => { };
|
||||||
|
|
||||||
internal static void SyncLobbyInfo()
|
internal static void SyncLobbyInfo()
|
||||||
{
|
{
|
||||||
@@ -174,7 +176,6 @@ namespace OpenRA
|
|||||||
Widget.SelectedWidget = null;
|
Widget.SelectedWidget = null;
|
||||||
|
|
||||||
orderManager.LocalFrameNumber = 0;
|
orderManager.LocalFrameNumber = 0;
|
||||||
|
|
||||||
orderManager.StartGame();
|
orderManager.StartGame();
|
||||||
worldRenderer.RefreshPalette();
|
worldRenderer.RefreshPalette();
|
||||||
AfterGameStart( orderManager.world );
|
AfterGameStart( orderManager.world );
|
||||||
@@ -343,5 +344,39 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
return modData.ObjectCreator.CreateObject<T>( name );
|
return modData.ObjectCreator.CreateObject<T>( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RejoinLobby(World world)
|
||||||
|
{
|
||||||
|
if (Game.IsHost && Game.Settings.Server.Extension != null)
|
||||||
|
Game.Settings.Server.Extension.OnRejoinLobby(world);
|
||||||
|
|
||||||
|
var map = orderManager.LobbyInfo.GlobalSettings.Map;
|
||||||
|
var host = orderManager.Host;
|
||||||
|
var port = orderManager.Port;
|
||||||
|
var isHost = Game.IsHost;
|
||||||
|
|
||||||
|
Disconnect();
|
||||||
|
ConnectedToLobby += () =>
|
||||||
|
{
|
||||||
|
if (world.LocalPlayer != null)
|
||||||
|
{
|
||||||
|
/* Try to get back the old slot */
|
||||||
|
Game.orderManager.IssueOrder(Order.Command("race " + world.LocalPlayer.Country.Race));
|
||||||
|
Game.orderManager.IssueOrder(Order.Command("slot " + world.LobbyInfo.ClientWithIndex(world.LocalPlayer.ClientIndex).Slot));
|
||||||
|
}else /* a spectator */
|
||||||
|
{
|
||||||
|
Game.orderManager.IssueOrder(Order.Command("spectator"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnectedToLobby = null;
|
||||||
|
};
|
||||||
|
if (isHost)
|
||||||
|
{
|
||||||
|
Server.Server.ServerMain(Game.modData, Settings, map);
|
||||||
|
JoinServer(IPAddress.Loopback.ToString(), Settings.Server.ListenPort);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
JoinServer(host, port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,6 +276,7 @@
|
|||||||
<Compile Include="World\SmudgeLayer.cs" />
|
<Compile Include="World\SmudgeLayer.cs" />
|
||||||
<Compile Include="Scripting\Media.cs" />
|
<Compile Include="Scripting\Media.cs" />
|
||||||
<Compile Include="OpenWidgetAtGameStart.cs" />
|
<Compile Include="OpenWidgetAtGameStart.cs" />
|
||||||
|
<Compile Include="World\WorldGameOver.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
Reference in New Issue
Block a user