mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-10 12:39:53 +00:00
stuff
This commit is contained in:
parent
ab6a356d5a
commit
2ae0751aa7
@ -15,6 +15,7 @@ namespace QSB.ClientServerStateSync
|
||||
public delegate void ChangeStateEvent(ServerState newState);
|
||||
|
||||
private ServerState _currentState;
|
||||
private bool _blockNextCheck;
|
||||
|
||||
private void Awake()
|
||||
=> Instance = this;
|
||||
@ -123,6 +124,12 @@ namespace QSB.ClientServerStateSync
|
||||
return;
|
||||
}
|
||||
|
||||
if (_blockNextCheck)
|
||||
{
|
||||
_blockNextCheck = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentState == ServerState.WaitingForAllPlayersToReady)
|
||||
{
|
||||
if (QSBPlayerManager.PlayerList.All(x => x.State == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
@ -131,6 +138,7 @@ namespace QSB.ClientServerStateSync
|
||||
DebugLog.DebugWrite($"All ready!!");
|
||||
QSBEventManager.FireEvent(EventNames.QSBStartLoop);
|
||||
QSBEventManager.FireEvent(EventNames.QSBServerState, ServerState.InSolarSystem);
|
||||
_blockNextCheck = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +183,9 @@ namespace QSB.Menus
|
||||
case KickReason.GameVersionNotMatching:
|
||||
text = "Server refused connection as Outer Wilds version does not match.";
|
||||
break;
|
||||
case KickReason.GamePlatformNotMatching:
|
||||
text = "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)";
|
||||
break;
|
||||
case KickReason.None:
|
||||
text = "Kicked from server. No reason given.";
|
||||
break;
|
||||
|
@ -4,6 +4,7 @@ using QSB.OrbSync.WorldObjects;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@ -11,6 +12,8 @@ namespace QSB.OrbSync
|
||||
{
|
||||
public class OrbManager : WorldObjectManager
|
||||
{
|
||||
private List<GameObject> _orbs = new List<GameObject>();
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
QSBWorldSync.Init<QSBOrbSlot, NomaiInterfaceSlot>();
|
||||
@ -24,11 +27,13 @@ namespace QSB.OrbSync
|
||||
QSBWorldSync.OldOrbList = Resources.FindObjectsOfTypeAll<NomaiInterfaceOrb>().ToList();
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.ForEach(x => QNetworkServer.Destroy(x.gameObject));
|
||||
_orbs.ForEach(x => QNetworkServer.Destroy(x));
|
||||
_orbs.Clear();
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.Clear();
|
||||
foreach (var orb in QSBWorldSync.OldOrbList)
|
||||
{
|
||||
Instantiate(QSBNetworkManager.Instance.OrbPrefab).SpawnWithServerAuthority();
|
||||
var newOrb = Instantiate(QSBNetworkManager.Instance.OrbPrefab);
|
||||
newOrb.SpawnWithServerAuthority();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@ namespace QSB.Player.Events
|
||||
AboutId = LocalPlayerId,
|
||||
PlayerName = name,
|
||||
QSBVersion = QSBCore.QSBVersion,
|
||||
GameVersion = QSBCore.GameVersion
|
||||
GameVersion = QSBCore.GameVersion,
|
||||
Platform = QSBCore.Platform
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool server, PlayerJoinMessage message)
|
||||
@ -45,10 +46,19 @@ namespace QSB.Player.Events
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.Platform != QSBCore.Platform)
|
||||
{
|
||||
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.GamePlatformNotMatching);
|
||||
}
|
||||
}
|
||||
|
||||
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}", MessageType.Info);
|
||||
DebugLog.DebugWrite($"{player.Name} joined. id:{player.PlayerId}, qsbVersion:{message.QSBVersion}, gameVersion:{message.GameVersion}, platform:{message.Platform}", MessageType.Info);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal(bool server, PlayerJoinMessage message)
|
||||
|
@ -8,6 +8,7 @@ namespace QSB.Player.Events
|
||||
public string PlayerName { get; set; }
|
||||
public string QSBVersion { get; set; }
|
||||
public string GameVersion { get; set; }
|
||||
public GamePlatform Platform { get; set; }
|
||||
|
||||
public override void Deserialize(QNetworkReader reader)
|
||||
{
|
||||
@ -15,6 +16,7 @@ namespace QSB.Player.Events
|
||||
PlayerName = reader.ReadString();
|
||||
QSBVersion = reader.ReadString();
|
||||
GameVersion = reader.ReadString();
|
||||
Platform = (GamePlatform)reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void Serialize(QNetworkWriter writer)
|
||||
@ -23,6 +25,7 @@ namespace QSB.Player.Events
|
||||
writer.Write(PlayerName);
|
||||
writer.Write(QSBVersion);
|
||||
writer.Write(GameVersion);
|
||||
writer.Write((int)Platform);
|
||||
}
|
||||
}
|
||||
}
|
9
QSB/Player/GamePlatform.cs
Normal file
9
QSB/Player/GamePlatform.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace QSB.Player
|
||||
{
|
||||
public enum GamePlatform
|
||||
{
|
||||
None,
|
||||
Steam,
|
||||
Epic
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
{
|
||||
None,
|
||||
QSBVersionNotMatching,
|
||||
GameVersionNotMatching
|
||||
GameVersionNotMatching,
|
||||
GamePlatformNotMatching
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,7 @@
|
||||
<Compile Include="Player\Events\PlayerInformationEvent.cs" />
|
||||
<Compile Include="Player\Events\PlayerInformationMessage.cs" />
|
||||
<Compile Include="Player\Events\RequestStateResyncEvent.cs" />
|
||||
<Compile Include="Player\GamePlatform.cs" />
|
||||
<Compile Include="Player\Patches\PlayerPatches.cs" />
|
||||
<Compile Include="Player\PlayerState.cs" />
|
||||
<Compile Include="PoolSync\CustomNomaiRemoteCameraPlatform.cs" />
|
||||
|
@ -26,6 +26,7 @@ using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using QuantumUNET.Components;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
@ -65,6 +66,9 @@ namespace QSB
|
||||
public static bool IsInMultiplayer => QNetworkManager.singleton.isNetworkActive;
|
||||
public static string QSBVersion => Helper.Manifest.Version;
|
||||
public static string GameVersion => Application.version;
|
||||
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
|
||||
? GamePlatform.Epic
|
||||
: GamePlatform.Steam;
|
||||
public static IMenuAPI MenuApi { get; private set; }
|
||||
|
||||
public void Awake()
|
||||
|
@ -3,7 +3,7 @@
|
||||
"settings": {
|
||||
"defaultServerIP": "localhost",
|
||||
"port": 7777,
|
||||
"debugMode": true,
|
||||
"debugMode": false,
|
||||
"showLinesInDebug": false
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user