Merge pull request #229 from misternebula/0-7-1-dev

0.7.1 - General fixes
This commit is contained in:
Mister_Nebula 2020-12-20 19:34:42 +00:00 committed by GitHub
commit c9ebc67c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 212 additions and 144 deletions

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using UnityEngine; using UnityEngine;
namespace QSB.Animation namespace QSB.Animation

View File

@ -1,5 +1,5 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.Player; using QSB.Player;
using QSB.Utility; using QSB.Utility;
@ -184,11 +184,11 @@ namespace QSB.Animation
CurrentType = type; CurrentType = type;
if (_unsuitedAnimController == null) if (_unsuitedAnimController == null)
{ {
DebugLog.DebugWrite($"Error - Unsuited controller is null. ({PlayerId})", MessageType.Error); DebugLog.ToConsole($"Error - Unsuited controller is null. ({PlayerId})", MessageType.Error);
} }
if (_suitedAnimController == null) if (_suitedAnimController == null)
{ {
DebugLog.DebugWrite($"Error - Suited controller is null. ({PlayerId})", MessageType.Error); DebugLog.ToConsole($"Error - Suited controller is null. ({PlayerId})", MessageType.Error);
} }
RuntimeAnimatorController controller = default; RuntimeAnimatorController controller = default;
switch (type) switch (type)

View File

@ -21,12 +21,12 @@ namespace QSB.Animation
_to = to; _to = to;
if (_from.runtimeAnimatorController == null) if (_from.runtimeAnimatorController == null)
{ {
DebugLog.DebugWrite($"Warning - \"From\" ({from.name}) controller is null.", MessageType.Warning); DebugLog.ToConsole($"Warning - \"From\" ({from.name}) controller is null.", MessageType.Warning);
_from.runtimeAnimatorController = _to.runtimeAnimatorController; _from.runtimeAnimatorController = _to.runtimeAnimatorController;
} }
else if (_to.runtimeAnimatorController == null) else if (_to.runtimeAnimatorController == null)
{ {
DebugLog.DebugWrite($"Warning - \"To\" ({to.name}) controller is null.", MessageType.Warning); DebugLog.ToConsole($"Warning - \"To\" ({to.name}) controller is null.", MessageType.Warning);
_to.runtimeAnimatorController = _from.runtimeAnimatorController; _to.runtimeAnimatorController = _from.runtimeAnimatorController;
} }
foreach (var param in _from.parameters.Where(p => p.type == AnimatorControllerParameterType.Float)) foreach (var param in _from.parameters.Where(p => p.type == AnimatorControllerParameterType.Float))

View File

@ -1,5 +1,5 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.Player; using QSB.Player;
using QSB.Utility; using QSB.Utility;

View File

@ -32,7 +32,7 @@ namespace QSB.ConversationSync
if (QSBPlayerManager.LocalPlayer.CurrentDialogueID == -1) if (QSBPlayerManager.LocalPlayer.CurrentDialogueID == -1)
{ {
DebugLog.ToConsole($"Warning - Ending conversation with CurrentDialogueId of -1! Called from {__instance.name}", MessageType.Warning); DebugLog.ToConsole($"Warning - Ending conversation with CurrentDialogueId of -1! Called from {__instance.name}", MessageType.Warning);
return false; return true;
} }
ConversationManager.Instance.SendConvState(QSBPlayerManager.LocalPlayer.CurrentDialogueID, false); ConversationManager.Instance.SendConvState(QSBPlayerManager.LocalPlayer.CurrentDialogueID, false);
ConversationManager.Instance.CloseBoxCharacter(QSBPlayerManager.LocalPlayer.CurrentDialogueID); ConversationManager.Instance.CloseBoxCharacter(QSBPlayerManager.LocalPlayer.CurrentDialogueID);

View File

@ -1,5 +1,5 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.Player; using QSB.Player;
using QSB.Utility; using QSB.Utility;

View File

@ -10,6 +10,11 @@ namespace QSB.DeathSync
public static bool PreFinishDeathSequence(DeathType deathType) public static bool PreFinishDeathSequence(DeathType deathType)
{ {
if (RespawnOnDeath.Instance == null)
{
return true;
}
if (RespawnOnDeath.Instance.AllowedDeathTypes.Contains(deathType)) if (RespawnOnDeath.Instance.AllowedDeathTypes.Contains(deathType))
{ {
// Allow real death // Allow real death

View File

@ -1,5 +1,5 @@
using Harmony; using Harmony;
using OWML.ModHelper.Events; using OWML.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection.Emit; using System.Reflection.Emit;
using UnityEngine; using UnityEngine;

View File

@ -1,5 +1,5 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.Utility; using QSB.Utility;
using System.Linq; using System.Linq;
@ -28,21 +28,7 @@ namespace QSB.DeathSync
private ShipCockpitController _cockpitController; private ShipCockpitController _cockpitController;
private PlayerSpacesuit _spaceSuit; private PlayerSpacesuit _spaceSuit;
public void Awake() public void Awake() => Instance = this;
{
Instance = this;
QSBCore.Helper.Events.Subscribe<PlayerResources>(OWML.Common.Events.AfterStart);
QSBCore.Helper.Events.Event += OnEvent;
}
private void OnEvent(MonoBehaviour behaviour, OWML.Common.Events ev)
{
if (behaviour is PlayerResources && ev == OWML.Common.Events.AfterStart)
{
Init();
}
}
public void Init() public void Init()
{ {
@ -71,17 +57,18 @@ namespace QSB.DeathSync
public void ResetShip() public void ResetShip()
{ {
if (_shipSpawnPoint == null)
{
DebugLog.ToConsole("Warning - _shipSpawnPoint is null!", MessageType.Warning);
Init();
}
if (_shipBody == null) if (_shipBody == null)
{ {
return; return;
} }
// Reset ship position. // Reset ship position.
if (_shipSpawnPoint == null)
{
DebugLog.ToConsole("_shipSpawnPoint is null!", MessageType.Warning);
return;
}
_shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity()); _shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity());
_shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation); _shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation);
@ -108,6 +95,12 @@ namespace QSB.DeathSync
public void ResetPlayer() public void ResetPlayer()
{ {
if (_shipSpawnPoint == null)
{
DebugLog.ToConsole("Warning - _playerSpawnPoint is null!", MessageType.Warning);
Init();
}
// Reset player position. // Reset player position.
var playerBody = Locator.GetPlayerBody(); var playerBody = Locator.GetPlayerBody();
playerBody.WarpToPositionRotation(_playerSpawnPoint.transform.position, _playerSpawnPoint.transform.rotation); playerBody.WarpToPositionRotation(_playerSpawnPoint.transform.position, _playerSpawnPoint.transform.rotation);

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.Patches; using QSB.Patches;

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.WorldSync; using QSB.WorldSync;
using UnityEngine; using UnityEngine;

View File

@ -91,7 +91,7 @@ namespace QSB.Instruments
{ {
if (!IsLocalPlayer) if (!IsLocalPlayer)
{ {
DebugLog.DebugWrite("Error - Tried to start instrument on non-local player!", MessageType.Error); DebugLog.ToConsole("Error - Tried to start instrument on non-local player!", MessageType.Error);
return; return;
} }
if (Player.PlayingInstrument || !Locator.GetPlayerController().IsGrounded()) if (Player.PlayingInstrument || !Locator.GetPlayerController().IsGrounded())
@ -115,7 +115,6 @@ namespace QSB.Instruments
public void SwitchToType(AnimationType type) public void SwitchToType(AnimationType type)
{ {
DebugLog.DebugWrite($"switch to type {type} player {PlayerId}");
GlobalMessenger<uint, AnimationType>.FireEvent(EventNames.QSBChangeAnimType, QSBPlayerManager.LocalPlayerId, type); GlobalMessenger<uint, AnimationType>.FireEvent(EventNames.QSBChangeAnimType, QSBPlayerManager.LocalPlayerId, type);
QSBPlayerManager.LocalPlayer.AnimationSync.SetAnimationType(type); QSBPlayerManager.LocalPlayer.AnimationSync.SetAnimationType(type);
CheckInstrumentProps(type); CheckInstrumentProps(type);

View File

@ -58,7 +58,7 @@ namespace QSB.OrbSync.Events
} }
if (fromPlayer == null) if (fromPlayer == null)
{ {
DebugLog.DebugWrite("Error - FromPlayer is null!", MessageType.Error); DebugLog.ToConsole("Error - FromPlayer is null!", MessageType.Error);
} }
var orbSync = QSBWorldSync.OrbSyncList var orbSync = QSBWorldSync.OrbSyncList
.First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]); .First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]);
@ -85,11 +85,16 @@ namespace QSB.OrbSync.Events
{ {
if (QSBWorldSync.OrbSyncList.Count < message.ObjectId) if (QSBWorldSync.OrbSyncList.Count < message.ObjectId)
{ {
DebugLog.DebugWrite( DebugLog.ToConsole(
$"Error - Orb id {message.ObjectId} out of range of orb sync list {QSBWorldSync.OrbSyncList.Count}.", $"Error - Orb id {message.ObjectId} out of range of orb sync list {QSBWorldSync.OrbSyncList.Count}.",
MessageType.Error); MessageType.Error);
return; return;
} }
if (!QSBWorldSync.OrbSyncList.Any(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]))
{
DebugLog.ToConsole($"Error - No NomaiOrbTransformSync has AttachedOrb with objectId {message.ObjectId}!");
return;
}
var orb = QSBWorldSync.OrbSyncList var orb = QSBWorldSync.OrbSyncList
.First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]); .First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]);
orb.enabled = true; orb.enabled = true;

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Events; using QSB.Events;
using QSB.WorldSync; using QSB.WorldSync;

View File

@ -23,7 +23,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.ToHud($"{player.Name} joined!"); DebugLog.ToAll($"{player.Name} joined!", MessageType.Info);
DebugLog.DebugWrite($"{player.Name} joined as id {player.PlayerId}", MessageType.Info); DebugLog.DebugWrite($"{player.Name} joined as id {player.PlayerId}", MessageType.Info);
} }

View File

@ -0,0 +1,70 @@
using UnityEngine;
namespace QSB.Player
{
public class PlayerMapMarker : MonoBehaviour
{
public string PlayerName;
private Transform _playerTransform;
private CanvasMapMarker _canvasMarker;
private bool _canvasMarkerInitialized;
public void Awake()
{
GlobalMessenger.AddListener("EnterMapView", new Callback(OnEnterMapView));
GlobalMessenger.AddListener("ExitMapView", new Callback(OnExitMapView));
}
public void Start()
{
enabled = false;
_playerTransform = Locator.GetPlayerTransform();
}
public void OnDestroy()
{
GlobalMessenger.RemoveListener("EnterMapView", new Callback(OnEnterMapView));
GlobalMessenger.RemoveListener("ExitMapView", new Callback(OnExitMapView));
}
public void InitMarker()
{
var obj = GameObject.FindWithTag("MapCamera");
var markerManager = obj.GetRequiredComponent<MapController>().GetMarkerManager();
_canvasMarker = markerManager.InstantiateNewMarker(true);
var component = GetComponent<OWRigidbody>();
if (component != null)
{
markerManager.RegisterMarker(_canvasMarker, component);
}
else
{
markerManager.RegisterMarker(_canvasMarker, transform);
}
_canvasMarker.SetLabel(PlayerName.ToUpper());
_canvasMarker.SetColor(Color.white);
_canvasMarker.SetVisibility(false);
_canvasMarkerInitialized = true;
}
private void OnEnterMapView() => enabled = true;
private void OnExitMapView() => enabled = false;
public void LateUpdate()
{
if (!_canvasMarkerInitialized)
{
InitMarker();
}
var a = Locator.GetActiveCamera().WorldToScreenPoint(transform.position);
var b = Locator.GetActiveCamera().WorldToScreenPoint(_playerTransform.position);
var vector = a - b;
vector.z = 0f;
var flag = a.z > 0f;
if (_canvasMarker.IsVisible() != flag)
{
_canvasMarker.SetVisibility(flag);
}
}
}
}

View File

@ -65,17 +65,9 @@ namespace QSB.Player
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject => public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject =>
GetSyncObjects<T>().FirstOrDefault(x => x != null && x.AttachedNetId == id); GetSyncObjects<T>().FirstOrDefault(x => x != null && x.AttachedNetId == id);
public static void AddSyncObject(PlayerSyncObject obj) public static void AddSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Add(obj);
{
DebugLog.DebugWrite($"SyncObject Add : type<{obj.GetType().Name}>, netid<{obj.NetId}>");
PlayerSyncObjects.Add(obj);
}
public static void RemoveSyncObject(PlayerSyncObject obj) public static void RemoveSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Remove(obj);
{
DebugLog.DebugWrite($"SyncObject Remove : type<{obj.GetType().Name}>, netid<{obj.NetId}>");
PlayerSyncObjects.Remove(obj);
}
public static bool IsBelongingToLocalPlayer(uint id) public static bool IsBelongingToLocalPlayer(uint id)
{ {

View File

@ -42,37 +42,37 @@
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> <HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference> </Reference>
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\NAudio-Unity.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\NAudio-Unity.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Common, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Logging, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Assets, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Events, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Events.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Input, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Input.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Interaction, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Interaction, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Menus, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Utils, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Utils.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -163,6 +163,7 @@
<Compile Include="OrbSync\QSBOrbSlot.cs" /> <Compile Include="OrbSync\QSBOrbSlot.cs" />
<Compile Include="Patches\QSBPatchManager.cs" /> <Compile Include="Patches\QSBPatchManager.cs" />
<Compile Include="Player\Events\ServerSendPlayerStatesEvent.cs" /> <Compile Include="Player\Events\ServerSendPlayerStatesEvent.cs" />
<Compile Include="Player\PlayerMapMarker.cs" />
<Compile Include="Player\PlayerSyncObject.cs" /> <Compile Include="Player\PlayerSyncObject.cs" />
<Compile Include="QSBInputManager.cs" /> <Compile Include="QSBInputManager.cs" />
<Compile Include="QSBNetworkLobby.cs" /> <Compile Include="QSBNetworkLobby.cs" />

View File

@ -1,6 +1,6 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper; using OWML.ModHelper;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.ConversationSync; using QSB.ConversationSync;
using QSB.ElevatorSync; using QSB.ElevatorSync;
using QSB.GeyserSync; using QSB.GeyserSync;
@ -14,16 +14,27 @@ using QuantumUNET.Components;
using UnityEngine; using UnityEngine;
/* /*
Copyright (C) 2020 Henry Pointer (_nebula / misternebula), Aleksander Waage (AmazingAlek), Ricardo Lopes (Raicuparta) Copyright (C) 2020
Henry Pointer (_nebula / misternebula),
Aleksander Waage (AmazingAlek),
Ricardo Lopes (Raicuparta)
Consult LICENSE file for full license. This program is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
namespace QSB namespace QSB
{ {
public class QSBCore : ModBehaviour public class QSBCore : ModBehaviour
{ {
public static IModBehaviour ModBehaviour { get; private set; }
public static IModHelper Helper { get; private set; } public static IModHelper Helper { get; private set; }
public static string DefaultServerIP { get; private set; } public static string DefaultServerIP { get; private set; }
public static int Port { get; private set; } public static int Port { get; private set; }
@ -40,8 +51,6 @@ namespace QSB
var instance = TextTranslation.Get().GetValue<TextTranslation.TranslationTable>("m_table"); var instance = TextTranslation.Get().GetValue<TextTranslation.TranslationTable>("m_table");
instance.theUITable[(int)UITextType.PleaseUseController] = instance.theUITable[(int)UITextType.PleaseUseController] =
"<color=orange>Quantum Space Buddies</color> is best experienced with friends..."; "<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
ModBehaviour = this;
} }
public void Start() public void Start()
@ -53,7 +62,6 @@ namespace QSB
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments"); InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
QSBPatchManager.Init(); QSBPatchManager.Init();
QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart); QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart);
gameObject.AddComponent<QSBNetworkManager>(); gameObject.AddComponent<QSBNetworkManager>();

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using System; using System;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;

View File

@ -1,5 +1,5 @@
using OWML.Common; using OWML.Common;
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Animation; using QSB.Animation;
using QSB.DeathSync; using QSB.DeathSync;
using QSB.ElevatorSync; using QSB.ElevatorSync;
@ -51,8 +51,6 @@ namespace QSB
playerPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab"); playerPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab");
SetupNetworkId(playerPrefab); SetupNetworkId(playerPrefab);
Destroy(playerPrefab.GetComponent<NetworkTransform>());
Destroy(playerPrefab.GetComponent<NetworkIdentity>());
SetupNetworkTransform(playerPrefab); SetupNetworkTransform(playerPrefab);
playerPrefab.AddComponent<PlayerTransformSync>(); playerPrefab.AddComponent<PlayerTransformSync>();
playerPrefab.AddComponent<AnimationSync>(); playerPrefab.AddComponent<AnimationSync>();
@ -61,32 +59,24 @@ namespace QSB
_shipPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkship.prefab"); _shipPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkship.prefab");
SetupNetworkId(_shipPrefab); SetupNetworkId(_shipPrefab);
Destroy(_shipPrefab.GetComponent<NetworkTransform>());
Destroy(_shipPrefab.GetComponent<NetworkIdentity>());
SetupNetworkTransform(_shipPrefab); SetupNetworkTransform(_shipPrefab);
_shipPrefab.AddComponent<ShipTransformSync>(); _shipPrefab.AddComponent<ShipTransformSync>();
spawnPrefabs.Add(_shipPrefab); spawnPrefabs.Add(_shipPrefab);
_cameraPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkcameraroot.prefab"); _cameraPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkcameraroot.prefab");
SetupNetworkId(_cameraPrefab); SetupNetworkId(_cameraPrefab);
Destroy(_cameraPrefab.GetComponent<NetworkTransform>());
Destroy(_cameraPrefab.GetComponent<NetworkIdentity>());
SetupNetworkTransform(_cameraPrefab); SetupNetworkTransform(_cameraPrefab);
_cameraPrefab.AddComponent<PlayerCameraSync>(); _cameraPrefab.AddComponent<PlayerCameraSync>();
spawnPrefabs.Add(_cameraPrefab); spawnPrefabs.Add(_cameraPrefab);
_probePrefab = _assetBundle.LoadAsset<GameObject>("assets/networkprobe.prefab"); _probePrefab = _assetBundle.LoadAsset<GameObject>("assets/networkprobe.prefab");
SetupNetworkId(_probePrefab); SetupNetworkId(_probePrefab);
Destroy(_probePrefab.GetComponent<NetworkTransform>());
Destroy(_probePrefab.GetComponent<NetworkIdentity>());
SetupNetworkTransform(_probePrefab); SetupNetworkTransform(_probePrefab);
_probePrefab.AddComponent<PlayerProbeSync>(); _probePrefab.AddComponent<PlayerProbeSync>();
spawnPrefabs.Add(_probePrefab); spawnPrefabs.Add(_probePrefab);
OrbPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkorb.prefab"); OrbPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkorb.prefab");
SetupNetworkId(OrbPrefab); SetupNetworkId(OrbPrefab);
Destroy(OrbPrefab.GetComponent<NetworkTransform>());
Destroy(OrbPrefab.GetComponent<NetworkIdentity>());
SetupNetworkTransform(OrbPrefab); SetupNetworkTransform(OrbPrefab);
OrbPrefab.AddComponent<NomaiOrbTransformSync>(); OrbPrefab.AddComponent<NomaiOrbTransformSync>();
spawnPrefabs.Add(OrbPrefab); spawnPrefabs.Add(OrbPrefab);
@ -161,6 +151,14 @@ namespace QSB
QSBNetworkServer.SpawnWithClientAuthority(Instantiate(_probePrefab), connection); QSBNetworkServer.SpawnWithClientAuthority(Instantiate(_probePrefab), connection);
} }
public override void OnStartClient(QSBNetworkClient _)
{
DebugLog.DebugWrite($"Setting defaultServerIP to {networkAddress}");
var config = QSBCore.Helper.Config;
config.SetSettingsValue("defaultServerIP", networkAddress);
QSBCore.Helper.Storage.Save(config, Constants.ModConfigFileName);
}
public override void OnClientConnect(QSBNetworkConnection connection) // Called on the client when connecting to a server public override void OnClientConnect(QSBNetworkConnection connection) // Called on the client when connecting to a server
{ {
DebugLog.DebugWrite("OnClientConnect", MessageType.Info); DebugLog.DebugWrite("OnClientConnect", MessageType.Info);

View File

@ -43,7 +43,9 @@ namespace QSB.SectorSync
public QSBSector GetClosestSector(Transform trans) // trans rights \o/ public QSBSector GetClosestSector(Transform trans) // trans rights \o/
{ {
return QSBWorldSync.GetWorldObjects<QSBSector>() return QSBWorldSync.GetWorldObjects<QSBSector>()
.Where(sector => sector.Sector != null && !_sectorBlacklist.Contains(sector.Type)) .Where(sector => sector.Sector != null
&& !_sectorBlacklist.Contains(sector.Type)
&& sector.Transform.gameObject.activeInHierarchy)
.OrderBy(sector => Vector3.Distance(sector.Position, trans.position)) .OrderBy(sector => Vector3.Distance(sector.Position, trans.position))
.First(); .First();
} }

View File

@ -10,7 +10,7 @@ namespace QSB.SectorSync
private const float CheckInterval = 0.5f; private const float CheckInterval = 0.5f;
private float _checkTimer = CheckInterval; private float _checkTimer = CheckInterval;
private void Update() public void Update()
{ {
if (!QSBSectorManager.Instance.IsReady) if (!QSBSectorManager.Instance.IsReady)
{ {

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QuantumUNET; using QuantumUNET;
namespace QSB.TimeSync namespace QSB.TimeSync

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@ -9,6 +9,8 @@ namespace QSB.TimeSync
{ {
public static TimeSyncUI Instance; public static TimeSyncUI Instance;
public static float TargetTime;
private Canvas _canvas; private Canvas _canvas;
private Text _text; private Text _text;
private float _startTime; private float _startTime;
@ -70,7 +72,7 @@ namespace QSB.TimeSync
{ {
return; return;
} }
var totalSeconds = Mathf.Max(Time.timeSinceLevelLoad - _startTime, 0f); var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f);
var minutes = Mathf.FloorToInt(totalSeconds / 60f); var minutes = Mathf.FloorToInt(totalSeconds / 60f);
var seconds = Mathf.FloorToInt(totalSeconds) % 60; var seconds = Mathf.FloorToInt(totalSeconds) % 60;
var text = ""; var text = "";

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Patches; using QSB.Patches;
namespace QSB.TimeSync namespace QSB.TimeSync

View File

@ -126,10 +126,12 @@ namespace QSB.TimeSync
{ {
if (_state == State.FastForwarding) if (_state == State.FastForwarding)
{ {
TimeSyncUI.TargetTime = _serverTime;
return; return;
} }
_timeScale = MaxFastForwardSpeed; _timeScale = MaxFastForwardSpeed;
_state = State.FastForwarding; _state = State.FastForwarding;
TimeSyncUI.TargetTime = _serverTime;
TimeSyncUI.Start(TimeSyncType.Fastforwarding); TimeSyncUI.Start(TimeSyncType.Fastforwarding);
} }

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using QSB.Player; using QSB.Player;
using QSB.Utility; using QSB.Utility;
using System.Linq; using System.Linq;

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using UnityEngine; using UnityEngine;
namespace QSB.Tools namespace QSB.Tools

View File

@ -62,13 +62,13 @@ namespace QSB.TransformSync
if (HasAuthority) if (HasAuthority)
{ {
transform.position = _orbParent.InverseTransformPoint(OrbTransform.position); transform.position = _orbParent.InverseTransformPoint(OrbTransform.position);
transform.rotation = _orbParent.InverseTransformRotation(OrbTransform.rotation); transform.rotation = OrbTransform.rotation;
return; return;
} }
if (transform.position != Vector3.zero) if (transform.position != Vector3.zero)
{ {
OrbTransform.position = _orbParent.TransformPoint(transform.position); OrbTransform.position = _orbParent.TransformPoint(transform.position);
OrbTransform.rotation = _orbParent.InverseTransformRotation(OrbTransform.rotation); OrbTransform.rotation = transform.rotation;
} }
} }
} }

View File

@ -40,7 +40,9 @@ namespace QSB.TransformSync
PlayerToolsManager.CreateProbe(body, Player); PlayerToolsManager.CreateProbe(body, Player);
QSBCore.Helper.Events.Unity.RunWhen(() => (Player.ProbeLauncher != null), () => SetSocket(Player.ProbeLauncher.ToolGameObject.transform)); QSBCore.Helper.Events.Unity.RunWhen(
() => Player.ProbeLauncher != null,
() => SetSocket(Player.ProbeLauncher.ToolGameObject.transform));
Player.ProbeBody = body.gameObject; Player.ProbeBody = body.gameObject;
return body; return body;

View File

@ -1,7 +1,6 @@
using QSB.Animation; using QSB.Animation;
using QSB.Instruments; using QSB.Instruments;
using QSB.Player; using QSB.Player;
using QSB.Utility;
using UnityEngine; using UnityEngine;
namespace QSB.TransformSync namespace QSB.TransformSync
@ -15,11 +14,7 @@ namespace QSB.TransformSync
AnimControllerPatch.Init(); AnimControllerPatch.Init();
} }
public override void OnStartLocalPlayer() public override void OnStartLocalPlayer() => LocalInstance = this;
{
LocalInstance = this;
DebugLog.DebugWrite("SET LOCAL INSTANCE");
}
protected override void OnDestroy() protected override void OnDestroy()
{ {
@ -53,6 +48,8 @@ namespace QSB.TransformSync
var marker = body.gameObject.AddComponent<PlayerHUDMarker>(); var marker = body.gameObject.AddComponent<PlayerHUDMarker>();
marker.Init(Player); marker.Init(Player);
body.gameObject.AddComponent<PlayerMapMarker>().PlayerName = Player.Name;
Player.Body = body.gameObject; Player.Body = body.gameObject;
return body; return body;

View File

@ -112,6 +112,10 @@ namespace QSB.TransformSync
public void SetReferenceSector(QSBSector sector) public void SetReferenceSector(QSBSector sector)
{ {
if (sector == ReferenceSector)
{
return;
}
_positionSmoothVelocity = Vector3.zero; _positionSmoothVelocity = Vector3.zero;
ReferenceSector = sector; ReferenceSector = sector;
if (!HasAuthority) if (!HasAuthority)

View File

@ -1,4 +1,4 @@
using OWML.ModHelper.Events; using OWML.Utils;
using UnityEngine; using UnityEngine;
namespace QSB.Utility namespace QSB.Utility

View File

@ -1,5 +1,4 @@
using OWML.Common; using OWML.Common;
using OWML.Logging;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -8,16 +7,7 @@ namespace QSB.Utility
public static class DebugLog public static class DebugLog
{ {
public static void ToConsole(string message, MessageType type = MessageType.Message) public static void ToConsole(string message, MessageType type = MessageType.Message)
{ => QSBCore.Helper.Console.WriteLine(message, type, GetCallingType(new StackTrace()));
// make custom method name in owml log.
// i wrote the owml code for this so this is fine?? shut up i dont want to change owml
var console = (ModSocketOutput)QSBCore.Helper.Console;
var method = console.GetType()
.GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
.Last(x => x.Name == "WriteLine");
var callingType = GetCallingType(new StackTrace());
method.Invoke(console, new object[] { type, message, callingType });
}
public static void ToHud(string message) public static void ToHud(string message)
{ {

View File

@ -68,7 +68,7 @@ namespace QSB.WorldSync
{ {
if (!QSBCore.IsServer) if (!QSBCore.IsServer)
{ {
DebugLog.DebugWrite("Warning - Cannot write to condition dict when not server!", MessageType.Warning); DebugLog.ToConsole("Warning - Cannot write to condition dict when not server!", MessageType.Warning);
return; return;
} }
DialogueConditions[name] = state; DialogueConditions[name] = state;
@ -76,18 +76,16 @@ namespace QSB.WorldSync
public static void AddFactReveal(string id, bool saveGame, bool showNotification) public static void AddFactReveal(string id, bool saveGame, bool showNotification)
{ {
DebugLog.DebugWrite($"AddFactReveal {id}");
if (!QSBCore.IsServer) if (!QSBCore.IsServer)
{ {
DebugLog.DebugWrite("Warning - Cannot write to fact list when not server!", MessageType.Warning); DebugLog.ToConsole("Warning - Cannot write to fact list when not server!", MessageType.Warning);
return; return;
} }
if (ShipLogFacts.Any(x => x.Id == id)) if (ShipLogFacts.Any(x => x.Id == id))
{ {
DebugLog.DebugWrite($"Warning - Fact with id {id} already exists in list!", MessageType.Warning); DebugLog.ToConsole($"Warning - Fact with id {id} already exists in list!", MessageType.Warning);
return; return;
} }
DebugLog.DebugWrite($"adding {id} to shiplogs");
ShipLogFacts.Add(new FactReveal ShipLogFacts.Add(new FactReveal
{ {
Id = id, Id = id,

View File

@ -4,6 +4,6 @@
"name": "Quantum Space Buddies", "name": "Quantum Space Buddies",
"description": "Adds online multiplayer to the game.", "description": "Adds online multiplayer to the game.",
"uniqueName": "Raicuparta.QuantumSpaceBuddies", "uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.7.0", "version": "0.7.1",
"owmlVersion": "0.7.3" "owmlVersion": "1.1.1"
} }

View File

@ -2,5 +2,5 @@
<packages> <packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" /> <package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" /> <package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
<package id="OWML" version="0.7.3" targetFramework="net35" /> <package id="OWML" version="1.1.1" targetFramework="net35" />
</packages> </packages>

View File

@ -35,37 +35,37 @@
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath> <HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\NAudio-Unity.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\NAudio-Unity.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Common, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Logging, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Assets, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Events, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Events.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Input, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Input.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Interaction, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Interaction, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Menus, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Utils, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll</HintPath> <HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Utils.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -2,5 +2,5 @@
<packages> <packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" /> <package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" /> <package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
<package id="OWML" version="0.7.3" targetFramework="net35" /> <package id="OWML" version="1.1.1" targetFramework="net35" />
</packages> </packages>