mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
add dlc install check
This commit is contained in:
parent
61e43cec21
commit
4a7cc859fb
@ -156,7 +156,7 @@ namespace QSB.Menus
|
||||
{
|
||||
CreateCommonPopups();
|
||||
|
||||
HostButton = MenuApi.PauseMenu_MakeSimpleButton("MULTIPLAYER (HOST)");
|
||||
HostButton = MenuApi.PauseMenu_MakeSimpleButton("OPEN TO MULTIPLAYER");
|
||||
HostButton.onClick.AddListener(Host);
|
||||
|
||||
DisconnectButton = MenuApi.PauseMenu_MakeSimpleButton("DISCONNECT");
|
||||
@ -180,7 +180,7 @@ namespace QSB.Menus
|
||||
{
|
||||
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.onClick.AddListener(Disconnect);
|
||||
@ -302,6 +302,7 @@ namespace QSB.Menus
|
||||
KickReason.QSBVersionNotMatching => "Server refused connection as QSB 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.DLCNotMatching => "Server refused connection as DLC installation state does not match.",
|
||||
KickReason.None => "Kicked from server. No reason given.",
|
||||
_ => $"Kicked from server. KickReason:{reason}",
|
||||
};
|
||||
|
@ -19,7 +19,8 @@ namespace QSB.Player.Events
|
||||
PlayerName = name,
|
||||
QSBVersion = QSBCore.QSBVersion,
|
||||
GameVersion = QSBCore.GameVersion,
|
||||
Platform = QSBCore.Platform
|
||||
Platform = QSBCore.Platform,
|
||||
DlcInstalled = QSBCore.DLCInstalled
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool server, PlayerJoinMessage message)
|
||||
@ -51,6 +52,15 @@ namespace QSB.Player.Events
|
||||
if (server)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -58,7 +68,7 @@ namespace QSB.Player.Events
|
||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||
player.Name = message.PlayerName;
|
||||
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)
|
||||
|
@ -9,6 +9,7 @@ namespace QSB.Player.Events
|
||||
public string QSBVersion { get; set; }
|
||||
public string GameVersion { get; set; }
|
||||
public GamePlatform Platform { get; set; }
|
||||
public bool DlcInstalled { get; set; }
|
||||
|
||||
public override void Deserialize(QNetworkReader reader)
|
||||
{
|
||||
@ -17,6 +18,7 @@ namespace QSB.Player.Events
|
||||
QSBVersion = reader.ReadString();
|
||||
GameVersion = reader.ReadString();
|
||||
Platform = (GamePlatform)reader.ReadInt32();
|
||||
DlcInstalled = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void Serialize(QNetworkWriter writer)
|
||||
@ -26,6 +28,7 @@ namespace QSB.Player.Events
|
||||
writer.Write(QSBVersion);
|
||||
writer.Write(GameVersion);
|
||||
writer.Write((int)Platform);
|
||||
writer.Write(DlcInstalled);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
None,
|
||||
QSBVersionNotMatching,
|
||||
GameVersionNotMatching,
|
||||
GamePlatformNotMatching
|
||||
GamePlatformNotMatching,
|
||||
DLCNotMatching
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ namespace QSB
|
||||
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
|
||||
? GamePlatform.Epic
|
||||
: GamePlatform.Steam;
|
||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||
public static IMenuAPI MenuApi { get; private set; }
|
||||
|
||||
private static DebugSettings DebugSettings { get; set; } = new DebugSettings();
|
||||
|
Loading…
x
Reference in New Issue
Block a user