mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 18:40:03 +00:00
add dlc install check
This commit is contained in:
parent
61e43cec21
commit
4a7cc859fb
@ -156,7 +156,7 @@ namespace QSB.Menus
|
|||||||
{
|
{
|
||||||
CreateCommonPopups();
|
CreateCommonPopups();
|
||||||
|
|
||||||
HostButton = MenuApi.PauseMenu_MakeSimpleButton("MULTIPLAYER (HOST)");
|
HostButton = MenuApi.PauseMenu_MakeSimpleButton("OPEN TO MULTIPLAYER");
|
||||||
HostButton.onClick.AddListener(Host);
|
HostButton.onClick.AddListener(Host);
|
||||||
|
|
||||||
DisconnectButton = MenuApi.PauseMenu_MakeSimpleButton("DISCONNECT");
|
DisconnectButton = MenuApi.PauseMenu_MakeSimpleButton("DISCONNECT");
|
||||||
@ -180,7 +180,7 @@ namespace QSB.Menus
|
|||||||
{
|
{
|
||||||
CreateCommonPopups();
|
CreateCommonPopups();
|
||||||
|
|
||||||
ClientButton = MenuApi.TitleScreen_MakeMenuOpenButton("MULTIPLAYER (CONNECT)", _ClientButtonIndex, PopupMenu);
|
ClientButton = MenuApi.TitleScreen_MakeMenuOpenButton("CONNECT TO MULTIPLAYER", _ClientButtonIndex, PopupMenu);
|
||||||
|
|
||||||
DisconnectButton = MenuApi.TitleScreen_MakeSimpleButton("DISCONNECT", _DisconnectIndex);
|
DisconnectButton = MenuApi.TitleScreen_MakeSimpleButton("DISCONNECT", _DisconnectIndex);
|
||||||
DisconnectButton.onClick.AddListener(Disconnect);
|
DisconnectButton.onClick.AddListener(Disconnect);
|
||||||
@ -302,6 +302,7 @@ namespace QSB.Menus
|
|||||||
KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.",
|
KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.",
|
||||||
KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.",
|
KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.",
|
||||||
KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)",
|
KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)",
|
||||||
|
KickReason.DLCNotMatching => "Server refused connection as DLC installation state does not match.",
|
||||||
KickReason.None => "Kicked from server. No reason given.",
|
KickReason.None => "Kicked from server. No reason given.",
|
||||||
_ => $"Kicked from server. KickReason:{reason}",
|
_ => $"Kicked from server. KickReason:{reason}",
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,8 @@ namespace QSB.Player.Events
|
|||||||
PlayerName = name,
|
PlayerName = name,
|
||||||
QSBVersion = QSBCore.QSBVersion,
|
QSBVersion = QSBCore.QSBVersion,
|
||||||
GameVersion = QSBCore.GameVersion,
|
GameVersion = QSBCore.GameVersion,
|
||||||
Platform = QSBCore.Platform
|
Platform = QSBCore.Platform,
|
||||||
|
DlcInstalled = QSBCore.DLCInstalled
|
||||||
};
|
};
|
||||||
|
|
||||||
public override void OnReceiveRemote(bool server, PlayerJoinMessage message)
|
public override void OnReceiveRemote(bool server, PlayerJoinMessage message)
|
||||||
@ -51,6 +52,15 @@ namespace QSB.Player.Events
|
|||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - Client {message.PlayerName} connecting with wrong game platform. (Client:{message.Platform}, Server:{QSBCore.Platform})", MessageType.Error);
|
DebugLog.ToConsole($"Error - Client {message.PlayerName} connecting with wrong game platform. (Client:{message.Platform}, Server:{QSBCore.Platform})", MessageType.Error);
|
||||||
|
QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.DLCNotMatching);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.DlcInstalled != QSBCore.DLCInstalled)
|
||||||
|
{
|
||||||
|
if (server)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Client {message.PlayerName} connecting with wrong DLC installation state. (Client:{message.DlcInstalled}, Server:{QSBCore.DLCInstalled})", MessageType.Error);
|
||||||
QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.GamePlatformNotMatching);
|
QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.GamePlatformNotMatching);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +68,7 @@ namespace QSB.Player.Events
|
|||||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||||
player.Name = message.PlayerName;
|
player.Name = message.PlayerName;
|
||||||
DebugLog.ToAll($"{player.Name} joined!", MessageType.Info);
|
DebugLog.ToAll($"{player.Name} joined!", MessageType.Info);
|
||||||
DebugLog.DebugWrite($"{player.Name} joined. id:{player.PlayerId}, qsbVersion:{message.QSBVersion}, gameVersion:{message.GameVersion}, platform:{message.Platform}", MessageType.Info);
|
DebugLog.DebugWrite($"{player.Name} joined. id:{player.PlayerId}, qsbVersion:{message.QSBVersion}, gameVersion:{message.GameVersion}, platform:{message.Platform}. dlcInstalled:{message.DlcInstalled}", MessageType.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnReceiveLocal(bool server, PlayerJoinMessage message)
|
public override void OnReceiveLocal(bool server, PlayerJoinMessage message)
|
||||||
|
@ -9,6 +9,7 @@ namespace QSB.Player.Events
|
|||||||
public string QSBVersion { get; set; }
|
public string QSBVersion { get; set; }
|
||||||
public string GameVersion { get; set; }
|
public string GameVersion { get; set; }
|
||||||
public GamePlatform Platform { get; set; }
|
public GamePlatform Platform { get; set; }
|
||||||
|
public bool DlcInstalled { get; set; }
|
||||||
|
|
||||||
public override void Deserialize(QNetworkReader reader)
|
public override void Deserialize(QNetworkReader reader)
|
||||||
{
|
{
|
||||||
@ -17,6 +18,7 @@ namespace QSB.Player.Events
|
|||||||
QSBVersion = reader.ReadString();
|
QSBVersion = reader.ReadString();
|
||||||
GameVersion = reader.ReadString();
|
GameVersion = reader.ReadString();
|
||||||
Platform = (GamePlatform)reader.ReadInt32();
|
Platform = (GamePlatform)reader.ReadInt32();
|
||||||
|
DlcInstalled = reader.ReadBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(QNetworkWriter writer)
|
public override void Serialize(QNetworkWriter writer)
|
||||||
@ -26,6 +28,7 @@ namespace QSB.Player.Events
|
|||||||
writer.Write(QSBVersion);
|
writer.Write(QSBVersion);
|
||||||
writer.Write(GameVersion);
|
writer.Write(GameVersion);
|
||||||
writer.Write((int)Platform);
|
writer.Write((int)Platform);
|
||||||
|
writer.Write(DlcInstalled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,6 +5,7 @@
|
|||||||
None,
|
None,
|
||||||
QSBVersionNotMatching,
|
QSBVersionNotMatching,
|
||||||
GameVersionNotMatching,
|
GameVersionNotMatching,
|
||||||
GamePlatformNotMatching
|
GamePlatformNotMatching,
|
||||||
|
DLCNotMatching
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ namespace QSB
|
|||||||
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
|
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
|
||||||
? GamePlatform.Epic
|
? GamePlatform.Epic
|
||||||
: GamePlatform.Steam;
|
: GamePlatform.Steam;
|
||||||
|
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||||
public static IMenuAPI MenuApi { get; private set; }
|
public static IMenuAPI MenuApi { get; private set; }
|
||||||
|
|
||||||
private static DebugSettings DebugSettings { get; set; } = new DebugSettings();
|
private static DebugSettings DebugSettings { get; set; } = new DebugSettings();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user