mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 15:35:22 +00:00
Merge pull request #323 from misternebula/0.12.0-finalizations
0.12.0 finalizations
This commit is contained in:
commit
65b4cc2677
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
ManifestFileVersion: 0
|
||||
CRC: 3009665417
|
||||
CRC: 3095198160
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: dbc913ca95e649d2e00d188ff573830e
|
||||
Hash: aeeeeba83ed0a32973e863d3787067c0
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: b2ece8ae09df261ff59d764d08696641
|
||||
|
@ -30,7 +30,7 @@ namespace QSB.ClientServerStateSync.Events
|
||||
{
|
||||
if (message.AboutId == uint.MaxValue)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - ID is uint.MaxValue!", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - ID is uint.MaxValue!", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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,13 +124,21 @@ namespace QSB.ClientServerStateSync
|
||||
return;
|
||||
}
|
||||
|
||||
if (_blockNextCheck)
|
||||
{
|
||||
_blockNextCheck = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentState == ServerState.WaitingForAllPlayersToReady)
|
||||
{
|
||||
if (QSBPlayerManager.PlayerList.All(x => x.State == ClientState.WaitingForOthersToReadyInSolarSystem))
|
||||
if (QSBPlayerManager.PlayerList.All(x => x.State == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
|| QSBPlayerManager.PlayerList.All(x => x.State == ClientState.AliveInSolarSystem))
|
||||
{
|
||||
DebugLog.DebugWrite($"All ready!!");
|
||||
QSBEventManager.FireEvent(EventNames.QSBStartLoop);
|
||||
QSBEventManager.FireEvent(EventNames.QSBServerState, ServerState.InSolarSystem);
|
||||
_blockNextCheck = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace QSB.DeathSync
|
||||
|
||||
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
|
||||
{
|
||||
QSBPlayerManager.ShowAllPlayers();
|
||||
QSBPlayerManager.PlayerList.ForEach(x => x.IsDead = false);
|
||||
_playersPendingRespawn.Clear();
|
||||
}
|
||||
|
@ -86,5 +86,6 @@
|
||||
public static string QSBStartLoop = "QSBStartLoop";
|
||||
public static string QSBServerState = "QSBServerState";
|
||||
public static string QSBClientState = "QSBClientState";
|
||||
public static string QSBDebugEvent = "QSBDebugEvent";
|
||||
}
|
||||
}
|
@ -2,6 +2,11 @@
|
||||
{
|
||||
public enum EventType
|
||||
{
|
||||
/*
|
||||
* MISC.
|
||||
*/
|
||||
DebugEvent,
|
||||
|
||||
/*
|
||||
* SERVER EVENTS
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@ using QSB.Tools.Events;
|
||||
using QSB.Tools.ProbeLauncherTool.Events;
|
||||
using QSB.TranslationSync.Events;
|
||||
using QSB.Utility;
|
||||
using QSB.Utility.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace QSB.Events
|
||||
@ -67,6 +68,7 @@ namespace QSB.Events
|
||||
new StartLoopEvent(),
|
||||
new ServerStateEvent(),
|
||||
new ClientStateEvent(),
|
||||
new DebugEvent(),
|
||||
// World Objects
|
||||
new ElevatorEvent(),
|
||||
new GeyserEvent(),
|
||||
|
@ -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>();
|
||||
@ -21,14 +24,17 @@ namespace QSB.OrbSync
|
||||
private void BuildOrbs()
|
||||
{
|
||||
QSBWorldSync.OldOrbList.Clear();
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.Clear();
|
||||
QSBWorldSync.OldOrbList = Resources.FindObjectsOfTypeAll<NomaiInterfaceOrb>().ToList();
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.ForEach(x => QNetworkServer.Destroy(x.gameObject));
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.Clear();
|
||||
_orbs.ForEach(x => QNetworkServer.Destroy(x));
|
||||
_orbs.Clear();
|
||||
foreach (var orb in QSBWorldSync.OldOrbList)
|
||||
{
|
||||
Instantiate(QSBNetworkManager.Instance.OrbPrefab).SpawnWithServerAuthority();
|
||||
var newOrb = Instantiate(QSBNetworkManager.Instance.OrbPrefab);
|
||||
newOrb.SpawnWithServerAuthority();
|
||||
_orbs.Add(newOrb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Syncs.Unsectored.Transforms;
|
||||
using OWML.Common;
|
||||
using QSB.Syncs.Unsectored.Transforms;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System.Collections.Generic;
|
||||
@ -22,12 +23,25 @@ namespace QSB.OrbSync.TransformSync
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
if (!OrbTransformSyncs.Contains(this))
|
||||
{
|
||||
OrbTransformSyncs.Add(this);
|
||||
}
|
||||
|
||||
base.Init();
|
||||
|
||||
if (AttachedObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to init orb with null AttachedObject.", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var originalParent = AttachedObject.GetAttachedOWRigidbody().GetOrigParent();
|
||||
if (originalParent == Locator.GetRootTransform())
|
||||
{
|
||||
DebugLog.DebugWrite($"{_logName} with AttachedObject {AttachedObject.name} had it's original parent as SolarSystemRoot - Destroying...");
|
||||
Destroy(this);
|
||||
DebugLog.DebugWrite($"{_logName} with AttachedObject {AttachedObject.name} had it's original parent as SolarSystemRoot - Disabling...");
|
||||
enabled = false;
|
||||
OrbTransformSyncs[_index] = null;
|
||||
}
|
||||
|
||||
SetReferenceTransform(originalParent);
|
||||
@ -37,19 +51,19 @@ namespace QSB.OrbSync.TransformSync
|
||||
{
|
||||
if (_index == -1)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Index cannot be found.", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Index cannot be found. OrbTransformSyncs count : {OrbTransformSyncs.Count}", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList == null || QSBWorldSync.OldOrbList.Count <= _index)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList is null or does not contain index {_index}.", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - OldOrbList is null or does not contain index {_index}.", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList[_index] == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList index {_index} is null.", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - OldOrbList index {_index} is null.", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace QSB.Patches
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error while patching {patch.GetType().Name} :\r\n{ex}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error while patching {patch.GetType().Name} :\r\n{ex}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace QSB.Player
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.DebugWrite($"Warning - _canvasMarker for {_player.PlayerId} is null!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - _canvasMarker for {_player.PlayerId} is null!", OWML.Common.MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Animation.Player;
|
||||
using OWML.Common;
|
||||
using QSB.Animation.Player;
|
||||
using QSB.Animation.Player.Thrusters;
|
||||
using QSB.CampfireSync.WorldObjects;
|
||||
using QSB.ClientServerStateSync;
|
||||
@ -23,9 +24,49 @@ namespace QSB.Player
|
||||
public PlayerTransformSync TransformSync { get; set; }
|
||||
|
||||
// Body Objects
|
||||
public OWCamera Camera { get; set; }
|
||||
public OWCamera Camera
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_camera == null && PlayerStates.IsReady)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {PlayerId}.Camera is null!", MessageType.Warning);
|
||||
}
|
||||
return _camera;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Camera to null.", MessageType.Warning);
|
||||
}
|
||||
_camera = value;
|
||||
}
|
||||
}
|
||||
private OWCamera _camera;
|
||||
|
||||
public GameObject CameraBody { get; set; }
|
||||
public GameObject Body { get; set; }
|
||||
public GameObject Body
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_body == null && PlayerStates.IsReady)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning);
|
||||
}
|
||||
return _body;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Body to null.", MessageType.Warning);
|
||||
}
|
||||
_body = value;
|
||||
}
|
||||
}
|
||||
private GameObject _body;
|
||||
|
||||
public GameObject RoastingStick { get; set; }
|
||||
public bool Visible { get; set; } = true;
|
||||
|
||||
@ -79,7 +120,7 @@ namespace QSB.Player
|
||||
{
|
||||
if (QSBPlayerManager.LocalPlayer != this)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalProbeLauncher in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalProbeLauncher in PlayerInfo for non local player!", MessageType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -93,7 +134,7 @@ namespace QSB.Player
|
||||
{
|
||||
if (QSBPlayerManager.LocalPlayer != this)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalFlashlight in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalFlashlight in PlayerInfo for non local player!", MessageType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -107,7 +148,7 @@ namespace QSB.Player
|
||||
{
|
||||
if (QSBPlayerManager.LocalPlayer != this)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalSignalscope in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalSignalscope in PlayerInfo for non local player!", MessageType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -121,7 +162,7 @@ namespace QSB.Player
|
||||
{
|
||||
if (QSBPlayerManager.LocalPlayer != this)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalTranslator in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalTranslator in PlayerInfo for non local player!", MessageType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,8 @@ namespace QSB.Player
|
||||
return cameraList;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"Error - LocalPlayer.Camera is null.", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - LocalPlayer.Camera is null.", MessageType.Error);
|
||||
LocalPlayer.Camera = Locator.GetPlayerCamera();
|
||||
}
|
||||
|
||||
return cameraList;
|
||||
@ -158,6 +159,12 @@ namespace QSB.Player
|
||||
|
||||
public static PlayerInfo GetClosestPlayerToWorldPoint(List<PlayerInfo> playerList, Vector3 worldPoint)
|
||||
{
|
||||
if (playerList == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Cannot get closest player from null player list.", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (playerList.Count == 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Cannot get closest player from empty player list.", MessageType.Error);
|
||||
|
@ -111,7 +111,7 @@ namespace QSB.ProbeSync
|
||||
break;
|
||||
case ProbeEvent.Invalid:
|
||||
default:
|
||||
DebugLog.DebugWrite($"Warning - Unknown/Invalid probe event.", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Unknown/Invalid probe event.", OWML.Common.MessageType.Warning);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -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" />
|
||||
@ -275,6 +276,8 @@
|
||||
<Compile Include="Utility\CustomCallbacks.cs" />
|
||||
<Compile Include="Utility\DebugBoxManager.cs" />
|
||||
<Compile Include="Utility\DebugGUI.cs" />
|
||||
<Compile Include="Utility\Events\DebugEvent.cs" />
|
||||
<Compile Include="Utility\Events\DebugEventEnum.cs" />
|
||||
<Compile Include="Utility\ZOverride.cs" />
|
||||
<Compile Include="Utility\Extensions.cs" />
|
||||
<Compile Include="Utility\GlobalMessenger4Args.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()
|
||||
@ -127,6 +131,10 @@ namespace QSB
|
||||
if (type == QSBPatchTypes.OnClientConnect)
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
if (Locator.GetSceneMenuManager() != null && Locator.GetSceneMenuManager().pauseMenu.IsOpen())
|
||||
{
|
||||
Locator.GetSceneMenuManager().pauseMenu._pauseMenu.EnableMenu(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,19 @@ namespace QSB
|
||||
|
||||
private string GetPlayerName()
|
||||
{
|
||||
var profileManager = StandaloneProfileManager.SharedInstance;
|
||||
profileManager.Initialize();
|
||||
var profile = profileManager.GetValue<StandaloneProfileManager.ProfileData>("_currentProfile");
|
||||
var profileName = profile.profileName;
|
||||
return profileName;
|
||||
try
|
||||
{
|
||||
var profileManager = StandaloneProfileManager.SharedInstance;
|
||||
profileManager.Initialize();
|
||||
var profile = profileManager._currentProfile;
|
||||
var profileName = profile.profileName;
|
||||
return profileName;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Exception when getting player name : {ex}", MessageType.Error);
|
||||
return "Player";
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupNetworkId(GameObject go, int assetId)
|
||||
@ -234,6 +242,11 @@ namespace QSB
|
||||
|
||||
foreach (var item in NomaiOrbTransformSync.OrbTransformSyncs)
|
||||
{
|
||||
if (item is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var identity = item.GetComponent<QNetworkIdentity>();
|
||||
if (identity.ClientAuthorityOwner == connection)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ namespace QSB.QuantumSync.Patches
|
||||
var owner = allMultiStates.FirstOrDefault(x => x.QuantumStates.Contains(stateObject));
|
||||
if (owner == default)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - Could not find QSBMultiStateQuantumObject for state {__instance.name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Could not find QSBMultiStateQuantumObject for state {__instance.name}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,29 +64,32 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
shape.OnShapeDeactivated += (Shape s)
|
||||
=> QSBCore.UnityEvents.FireOnNextUpdate(() => OnDisable(s));
|
||||
|
||||
if (shape is BoxShape boxShape)
|
||||
if (QSBCore.DebugMode)
|
||||
{
|
||||
var newCube = UnityEngine.Object.Instantiate(cube);
|
||||
newCube.transform.parent = shape.transform;
|
||||
newCube.transform.localPosition = Vector3.zero;
|
||||
newCube.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newCube.transform.localScale = boxShape.size;
|
||||
}
|
||||
else if (shape is SphereShape sphereShape)
|
||||
{
|
||||
var newSphere = UnityEngine.Object.Instantiate(sphere);
|
||||
newSphere.transform.parent = shape.transform;
|
||||
newSphere.transform.localPosition = Vector3.zero;
|
||||
newSphere.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newSphere.transform.localScale = Vector3.one * (sphereShape.radius * 2);
|
||||
}
|
||||
else if (shape is CapsuleShape capsuleShape)
|
||||
{
|
||||
var newCapsule = Object.Instantiate(capsule);
|
||||
newCapsule.transform.parent = shape.transform;
|
||||
newCapsule.transform.localPosition = Vector3.zero;
|
||||
newCapsule.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newCapsule.transform.localScale = new Vector3(capsuleShape.radius * 2, capsuleShape.height, capsuleShape.radius * 2);
|
||||
if (shape is BoxShape boxShape)
|
||||
{
|
||||
var newCube = UnityEngine.Object.Instantiate(cube);
|
||||
newCube.transform.parent = shape.transform;
|
||||
newCube.transform.localPosition = Vector3.zero;
|
||||
newCube.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newCube.transform.localScale = boxShape.size;
|
||||
}
|
||||
else if (shape is SphereShape sphereShape)
|
||||
{
|
||||
var newSphere = UnityEngine.Object.Instantiate(sphere);
|
||||
newSphere.transform.parent = shape.transform;
|
||||
newSphere.transform.localPosition = Vector3.zero;
|
||||
newSphere.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newSphere.transform.localScale = Vector3.one * (sphereShape.radius * 2);
|
||||
}
|
||||
else if (shape is CapsuleShape capsuleShape)
|
||||
{
|
||||
var newCapsule = Object.Instantiate(capsule);
|
||||
newCapsule.transform.parent = shape.transform;
|
||||
newCapsule.transform.localPosition = Vector3.zero;
|
||||
newCapsule.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
newCapsule.transform.localScale = new Vector3(capsuleShape.radius * 2, capsuleShape.height, capsuleShape.radius * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,18 @@ namespace QSB.SectorSync
|
||||
return null;
|
||||
}
|
||||
|
||||
var numSectorsCurrentlyIn = SectorList.Count(x => x.ShouldSyncTo(_targetType));
|
||||
bool ShouldSyncTo(QSBSector sector, TargetType type)
|
||||
{
|
||||
if (sector == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Tried to check if we should sync to null sector!", MessageType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
return sector.ShouldSyncTo(type);
|
||||
}
|
||||
|
||||
var numSectorsCurrentlyIn = SectorList.Count(x => ShouldSyncTo(x, _targetType));
|
||||
|
||||
var listToCheck = numSectorsCurrentlyIn == 0
|
||||
? QSBWorldSync.GetWorldObjects<QSBSector>().Where(x => !x.IsFakeSector && x.Type != Sector.Name.Unnamed)
|
||||
|
@ -2,6 +2,7 @@
|
||||
using OWML.Utils;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@ -10,7 +11,19 @@ namespace QSB.SectorSync.WorldObjects
|
||||
public class QSBSector : WorldObject<Sector>
|
||||
{
|
||||
public Sector.Name Type => AttachedObject.GetName();
|
||||
public Transform Transform => AttachedObject.transform;
|
||||
public Transform Transform
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AttachedObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Tried to get Transform from QSBSector {ObjectId} with null AttachedObject!\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return AttachedObject.transform;
|
||||
}
|
||||
}
|
||||
public Vector3 Position => Transform.position;
|
||||
public bool IsFakeSector => AttachedObject.GetType() == typeof(FakeSector);
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace QSB.Syncs
|
||||
{
|
||||
if (_referenceTransform == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name} \r\n{Environment.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ namespace QSB.Syncs
|
||||
{
|
||||
if (_referenceTransform == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name} \r\n{Environment.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ namespace QSB.Syncs
|
||||
{
|
||||
if (_referenceTransform == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name} \r\n{Environment.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ namespace QSB.Syncs
|
||||
{
|
||||
if (_referenceTransform == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name} \r\n{Environment.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return Quaternion.identity;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,12 @@ namespace QSB.Syncs.Sectored
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
|
||||
{
|
||||
base.OnSceneLoaded(oldScene, newScene, isInUniverse);
|
||||
SetReferenceSector(null);
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@ -67,6 +73,12 @@ namespace QSB.Syncs.Sectored
|
||||
{
|
||||
if (_sectorIdWaitingSlot == int.MinValue)
|
||||
{
|
||||
if (ReferenceSector != null && ReferenceSector.Transform != ReferenceTransform)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {_logName} : ReferenceSector.Transform was different to ReferenceTransform. Correcting...", OWML.Common.MessageType.Warning);
|
||||
SetReferenceTransform(ReferenceSector.Transform);
|
||||
}
|
||||
|
||||
base.Update();
|
||||
return;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace QSB.Syncs
|
||||
public Component AttachedObject { get; set; }
|
||||
public Transform ReferenceTransform { get; set; }
|
||||
|
||||
protected string _logName => $"{PlayerId}.{GetType().Name}";
|
||||
protected string _logName => $"{PlayerId}.{NetId.Value}:{GetType().Name}";
|
||||
protected virtual float DistanceLeeway { get; } = 5f;
|
||||
private float _previousDistance;
|
||||
protected const float SmoothTime = 0.1f;
|
||||
@ -223,6 +223,14 @@ namespace QSB.Syncs
|
||||
return;
|
||||
}
|
||||
|
||||
if (ShouldReparentAttachedObject
|
||||
&& !HasAuthority
|
||||
&& AttachedObject.transform.parent != ReferenceTransform)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning : {_logName} : AttachedObject's parent is different to ReferenceTransform. Correcting...", MessageType.Warning);
|
||||
ReparentAttachedObject(ReferenceTransform);
|
||||
}
|
||||
|
||||
UpdateTransform();
|
||||
|
||||
base.Update();
|
||||
|
@ -255,6 +255,16 @@ namespace QSB.TimeSync
|
||||
}
|
||||
}
|
||||
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
{
|
||||
if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.WaitingForAllPlayersToBeReady)
|
||||
{
|
||||
//?
|
||||
DebugLog.ToConsole($"Warning - Server waiting for players to die, but players waiting for ready signal! Assume players correct.", MessageType.Warning);
|
||||
QSBEventManager.FireEvent(EventNames.QSBServerState, ServerState.WaitingForAllPlayersToReady);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentState != State.Loaded)
|
||||
{
|
||||
return;
|
||||
@ -293,7 +303,7 @@ namespace QSB.TimeSync
|
||||
|
||||
if (CurrentState != State.Loaded && CurrentState != State.NotLoaded && CurrentReason == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Warning - CurrentReason is null.", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - CurrentReason is null.", MessageType.Warning);
|
||||
}
|
||||
|
||||
// Checks to pause/fastforward
|
||||
|
@ -1,6 +1,9 @@
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.ShipSync;
|
||||
using QSB.Utility.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
@ -29,34 +32,32 @@ namespace QSB.Utility
|
||||
|
||||
public void Update()
|
||||
{
|
||||
return;
|
||||
|
||||
if (!QSBCore.DebugMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad5))
|
||||
{
|
||||
Locator.GetDeathManager().KillPlayer(DeathType.Supernova);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad4))
|
||||
if (Keyboard.current[Key.Numpad4].wasPressedThisFrame)
|
||||
{
|
||||
DamageShipElectricalSystem();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad7))
|
||||
if (Keyboard.current[Key.Numpad5].wasPressedThisFrame)
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBDebugEvent, DebugEventEnum.TriggerSupernova);
|
||||
}
|
||||
|
||||
if (Keyboard.current[Key.Numpad7].wasPressedThisFrame)
|
||||
{
|
||||
GoToVessel();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad8))
|
||||
if (Keyboard.current[Key.Numpad8].wasPressedThisFrame)
|
||||
{
|
||||
InsertWarpCore();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad9))
|
||||
if (Keyboard.current[Key.Numpad9].wasPressedThisFrame)
|
||||
{
|
||||
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using QSB.ClientServerStateSync;
|
||||
using OWML.Utils;
|
||||
using QSB.ClientServerStateSync;
|
||||
using QSB.OrbSync.TransformSync;
|
||||
using QSB.Player;
|
||||
using QSB.ProbeSync.TransformSync;
|
||||
using QSB.Syncs;
|
||||
@ -63,6 +65,8 @@ namespace QSB.Utility
|
||||
}
|
||||
|
||||
var offset2 = 10f;
|
||||
GUI.Label(new Rect(420, offset2, 200f, 20f), $"OrbList count : {NomaiOrbTransformSync.OrbTransformSyncs.Count}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 200f, 20f), $"Player data :", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
foreach (var player in QSBPlayerManager.PlayerList)
|
||||
@ -73,16 +77,30 @@ namespace QSB.Utility
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $"Dead : {player.IsDead}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $"Visible : {player.Visible}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
|
||||
if (player.PlayerStates.IsReady && QSBCore.WorldObjectsReady)
|
||||
{
|
||||
var networkTransform = player.TransformSync;
|
||||
var sector = networkTransform.ReferenceSector;
|
||||
var referenceSector = networkTransform.ReferenceSector;
|
||||
var referenceTransform = networkTransform.ReferenceTransform;
|
||||
var parent = networkTransform.AttachedObject?.transform.parent;
|
||||
var intermediary = networkTransform.GetValue<IntermediaryTransform>("_intermediaryTransform");
|
||||
var interTransform = intermediary.GetReferenceTransform();
|
||||
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - L.Pos : {networkTransform.transform.localPosition}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Sector : {(sector == null ? "NULL" : sector.Name)}", guiStyle);
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Ref. Sector : {(referenceSector == null ? "NULL" : referenceSector.Name)}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Ref. Transform : {(referenceTransform == null ? "NULL" : referenceTransform.name)}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Inter. Ref. Transform : {(interTransform == null ? "NULL" : interTransform.name)}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Parent : {(parent == null ? "NULL" : parent.name)}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
|
||||
/*
|
||||
var probeSync = SyncBase.GetPlayers<PlayerProbeSync>(player);
|
||||
if (probeSync != default)
|
||||
{
|
||||
@ -90,6 +108,7 @@ namespace QSB.Utility
|
||||
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Probe Sector : {(probeSector == null ? "NULL" : probeSector.Name)}", guiStyle);
|
||||
offset2 += _debugLineSpacing;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
QSB/Utility/Events/DebugEvent.cs
Normal file
36
QSB/Utility/Events/DebugEvent.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Utility.Events
|
||||
{
|
||||
public class DebugEvent : QSBEvent<EnumMessage<DebugEventEnum>>
|
||||
{
|
||||
public override EventType Type => EventType.DebugEvent;
|
||||
|
||||
public override void SetupListener() => GlobalMessenger<DebugEventEnum>.AddListener(EventNames.QSBDebugEvent, Handler);
|
||||
public override void CloseListener() => GlobalMessenger<DebugEventEnum>.RemoveListener(EventNames.QSBDebugEvent, Handler);
|
||||
|
||||
private void Handler(DebugEventEnum type) => SendEvent(CreateMessage(type));
|
||||
|
||||
private EnumMessage<DebugEventEnum> CreateMessage(DebugEventEnum type) => new EnumMessage<DebugEventEnum>
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
EnumValue = type
|
||||
};
|
||||
|
||||
public override void OnReceiveLocal(bool isHost, EnumMessage<DebugEventEnum> message)
|
||||
{
|
||||
OnReceiveRemote(isHost, message);
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, EnumMessage<DebugEventEnum> message)
|
||||
{
|
||||
switch (message.EnumValue)
|
||||
{
|
||||
case DebugEventEnum.TriggerSupernova:
|
||||
TimeLoop.SetSecondsRemaining(0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
QSB/Utility/Events/DebugEventEnum.cs
Normal file
7
QSB/Utility/Events/DebugEventEnum.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace QSB.Utility.Events
|
||||
{
|
||||
public enum DebugEventEnum
|
||||
{
|
||||
TriggerSupernova
|
||||
}
|
||||
}
|
@ -90,17 +90,29 @@ namespace QSB.WorldSync
|
||||
|
||||
public static void RemoveWorldObjects<TWorldObject>()
|
||||
{
|
||||
if (WorldObjects == null || WorldObjects.Count == 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to remove WorldObjects of type {typeof(TWorldObject).Name}, but there are no WorldObjects!");
|
||||
}
|
||||
|
||||
var itemsToRemove = WorldObjects.Where(x => x is TWorldObject);
|
||||
|
||||
foreach (var item in itemsToRemove)
|
||||
{
|
||||
WorldObjectsToUnityObjects.Remove(item.ReturnObject());
|
||||
if (item is null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to remove a null WorldObject of type {typeof(TWorldObject).Name}.", MessageType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
WorldObjectsToUnityObjects.Remove(item.ReturnObject());
|
||||
item.OnRemoval();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Exception in OnRemoval() for {item.GetType()}. Message : {e.InnerException.Message}, Stack trace : {e.InnerException.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Exception in OnRemoval() for {item.GetType()}. Message : {e.Message}, Stack trace : {e.StackTrace}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"settings": {
|
||||
"defaultServerIP": "localhost",
|
||||
"port": 7777,
|
||||
"debugMode": true,
|
||||
"debugMode": false,
|
||||
"showLinesInDebug": false
|
||||
}
|
||||
}
|
@ -9,6 +9,6 @@
|
||||
},
|
||||
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
|
||||
"version": "0.12.0-pr4",
|
||||
"owmlVersion": "2.0.0",
|
||||
"owmlVersion": "2.1.0",
|
||||
"dependencies": [ "_nebula.MenuFramework" ]
|
||||
}
|
@ -73,5 +73,5 @@ Material:
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0.51526886, b: 0, a: 0.09803922}
|
||||
- _Color: {r: 1, g: 0.51526886, b: 0, a: 0.05882353}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
|
Loading…
x
Reference in New Issue
Block a user