mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-04 03:39:55 +00:00
Merge pull request #229 from misternebula/0-7-1-dev
0.7.1 - General fixes
This commit is contained in:
commit
c9ebc67c48
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Animation
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
@ -184,11 +184,11 @@ namespace QSB.Animation
|
||||
CurrentType = type;
|
||||
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)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - Suited controller is null. ({PlayerId})", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Suited controller is null. ({PlayerId})", MessageType.Error);
|
||||
}
|
||||
RuntimeAnimatorController controller = default;
|
||||
switch (type)
|
||||
|
@ -21,12 +21,12 @@ namespace QSB.Animation
|
||||
_to = to;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
foreach (var param in _from.parameters.Where(p => p.type == AnimatorControllerParameterType.Float))
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
|
@ -32,7 +32,7 @@ namespace QSB.ConversationSync
|
||||
if (QSBPlayerManager.LocalPlayer.CurrentDialogueID == -1)
|
||||
{
|
||||
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.CloseBoxCharacter(QSBPlayerManager.LocalPlayer.CurrentDialogueID);
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
|
@ -10,6 +10,11 @@ namespace QSB.DeathSync
|
||||
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
if (RespawnOnDeath.Instance == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RespawnOnDeath.Instance.AllowedDeathTypes.Contains(deathType))
|
||||
{
|
||||
// Allow real death
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Harmony;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using UnityEngine;
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
@ -28,21 +28,7 @@ namespace QSB.DeathSync
|
||||
private ShipCockpitController _cockpitController;
|
||||
private PlayerSpacesuit _spaceSuit;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
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 Awake() => Instance = this;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
@ -71,17 +57,18 @@ namespace QSB.DeathSync
|
||||
|
||||
public void ResetShip()
|
||||
{
|
||||
if (_shipSpawnPoint == null)
|
||||
{
|
||||
DebugLog.ToConsole("Warning - _shipSpawnPoint is null!", MessageType.Warning);
|
||||
Init();
|
||||
}
|
||||
|
||||
if (_shipBody == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset ship position.
|
||||
if (_shipSpawnPoint == null)
|
||||
{
|
||||
DebugLog.ToConsole("_shipSpawnPoint is null!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
_shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity());
|
||||
_shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation);
|
||||
|
||||
@ -108,6 +95,12 @@ namespace QSB.DeathSync
|
||||
|
||||
public void ResetPlayer()
|
||||
{
|
||||
if (_shipSpawnPoint == null)
|
||||
{
|
||||
DebugLog.ToConsole("Warning - _playerSpawnPoint is null!", MessageType.Warning);
|
||||
Init();
|
||||
}
|
||||
|
||||
// Reset player position.
|
||||
var playerBody = Locator.GetPlayerBody();
|
||||
playerBody.WarpToPositionRotation(_playerSpawnPoint.transform.position, _playerSpawnPoint.transform.rotation);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.WorldSync;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace QSB.Instruments
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (Player.PlayingInstrument || !Locator.GetPlayerController().IsGrounded())
|
||||
@ -115,7 +115,6 @@ namespace QSB.Instruments
|
||||
|
||||
public void SwitchToType(AnimationType type)
|
||||
{
|
||||
DebugLog.DebugWrite($"switch to type {type} player {PlayerId}");
|
||||
GlobalMessenger<uint, AnimationType>.FireEvent(EventNames.QSBChangeAnimType, QSBPlayerManager.LocalPlayerId, type);
|
||||
QSBPlayerManager.LocalPlayer.AnimationSync.SetAnimationType(type);
|
||||
CheckInstrumentProps(type);
|
||||
|
@ -58,7 +58,7 @@ namespace QSB.OrbSync.Events
|
||||
}
|
||||
if (fromPlayer == null)
|
||||
{
|
||||
DebugLog.DebugWrite("Error - FromPlayer is null!", MessageType.Error);
|
||||
DebugLog.ToConsole("Error - FromPlayer is null!", MessageType.Error);
|
||||
}
|
||||
var orbSync = QSBWorldSync.OrbSyncList
|
||||
.First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]);
|
||||
@ -85,11 +85,16 @@ namespace QSB.OrbSync.Events
|
||||
{
|
||||
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}.",
|
||||
MessageType.Error);
|
||||
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
|
||||
.First(x => x.AttachedOrb == QSBWorldSync.OldOrbList[message.ObjectId]);
|
||||
orb.enabled = true;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.WorldSync;
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace QSB.Player.Events
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||
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);
|
||||
}
|
||||
|
||||
|
70
QSB/Player/PlayerMapMarker.cs
Normal file
70
QSB/Player/PlayerMapMarker.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -65,17 +65,9 @@ namespace QSB.Player
|
||||
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject =>
|
||||
GetSyncObjects<T>().FirstOrDefault(x => x != null && x.AttachedNetId == id);
|
||||
|
||||
public static void AddSyncObject(PlayerSyncObject obj)
|
||||
{
|
||||
DebugLog.DebugWrite($"SyncObject Add : type<{obj.GetType().Name}>, netid<{obj.NetId}>");
|
||||
PlayerSyncObjects.Add(obj);
|
||||
}
|
||||
public static void AddSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Add(obj);
|
||||
|
||||
public static void RemoveSyncObject(PlayerSyncObject obj)
|
||||
{
|
||||
DebugLog.DebugWrite($"SyncObject Remove : type<{obj.GetType().Name}>, netid<{obj.NetId}>");
|
||||
PlayerSyncObjects.Remove(obj);
|
||||
}
|
||||
public static void RemoveSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Remove(obj);
|
||||
|
||||
public static bool IsBelongingToLocalPlayer(uint id)
|
||||
{
|
||||
|
@ -42,37 +42,37 @@
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<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 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>
|
||||
</Reference>
|
||||
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.dll</HintPath>
|
||||
<Reference Include="OWML.Common, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll</HintPath>
|
||||
<Reference Include="OWML.Logging, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
<Reference Include="OWML.Utils, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@ -163,6 +163,7 @@
|
||||
<Compile Include="OrbSync\QSBOrbSlot.cs" />
|
||||
<Compile Include="Patches\QSBPatchManager.cs" />
|
||||
<Compile Include="Player\Events\ServerSendPlayerStatesEvent.cs" />
|
||||
<Compile Include="Player\PlayerMapMarker.cs" />
|
||||
<Compile Include="Player\PlayerSyncObject.cs" />
|
||||
<Compile Include="QSBInputManager.cs" />
|
||||
<Compile Include="QSBNetworkLobby.cs" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.ConversationSync;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.GeyserSync;
|
||||
@ -14,16 +14,27 @@ using QuantumUNET.Components;
|
||||
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
|
||||
{
|
||||
public class QSBCore : ModBehaviour
|
||||
{
|
||||
public static IModBehaviour ModBehaviour { get; private set; }
|
||||
public static IModHelper Helper { get; private set; }
|
||||
public static string DefaultServerIP { 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");
|
||||
instance.theUITable[(int)UITextType.PleaseUseController] =
|
||||
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
|
||||
|
||||
ModBehaviour = this;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
@ -53,7 +62,6 @@ namespace QSB
|
||||
InstrumentAssetBundle = Helper.Assets.LoadBundle("assets/instruments");
|
||||
|
||||
QSBPatchManager.Init();
|
||||
|
||||
QSBPatchManager.DoPatchType(QSBPatchTypes.OnModStart);
|
||||
|
||||
gameObject.AddComponent<QSBNetworkManager>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
@ -1,5 +1,5 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Animation;
|
||||
using QSB.DeathSync;
|
||||
using QSB.ElevatorSync;
|
||||
@ -51,8 +51,6 @@ namespace QSB
|
||||
|
||||
playerPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab");
|
||||
SetupNetworkId(playerPrefab);
|
||||
Destroy(playerPrefab.GetComponent<NetworkTransform>());
|
||||
Destroy(playerPrefab.GetComponent<NetworkIdentity>());
|
||||
SetupNetworkTransform(playerPrefab);
|
||||
playerPrefab.AddComponent<PlayerTransformSync>();
|
||||
playerPrefab.AddComponent<AnimationSync>();
|
||||
@ -61,32 +59,24 @@ namespace QSB
|
||||
|
||||
_shipPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkship.prefab");
|
||||
SetupNetworkId(_shipPrefab);
|
||||
Destroy(_shipPrefab.GetComponent<NetworkTransform>());
|
||||
Destroy(_shipPrefab.GetComponent<NetworkIdentity>());
|
||||
SetupNetworkTransform(_shipPrefab);
|
||||
_shipPrefab.AddComponent<ShipTransformSync>();
|
||||
spawnPrefabs.Add(_shipPrefab);
|
||||
|
||||
_cameraPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkcameraroot.prefab");
|
||||
SetupNetworkId(_cameraPrefab);
|
||||
Destroy(_cameraPrefab.GetComponent<NetworkTransform>());
|
||||
Destroy(_cameraPrefab.GetComponent<NetworkIdentity>());
|
||||
SetupNetworkTransform(_cameraPrefab);
|
||||
_cameraPrefab.AddComponent<PlayerCameraSync>();
|
||||
spawnPrefabs.Add(_cameraPrefab);
|
||||
|
||||
_probePrefab = _assetBundle.LoadAsset<GameObject>("assets/networkprobe.prefab");
|
||||
SetupNetworkId(_probePrefab);
|
||||
Destroy(_probePrefab.GetComponent<NetworkTransform>());
|
||||
Destroy(_probePrefab.GetComponent<NetworkIdentity>());
|
||||
SetupNetworkTransform(_probePrefab);
|
||||
_probePrefab.AddComponent<PlayerProbeSync>();
|
||||
spawnPrefabs.Add(_probePrefab);
|
||||
|
||||
OrbPrefab = _assetBundle.LoadAsset<GameObject>("assets/networkorb.prefab");
|
||||
SetupNetworkId(OrbPrefab);
|
||||
Destroy(OrbPrefab.GetComponent<NetworkTransform>());
|
||||
Destroy(OrbPrefab.GetComponent<NetworkIdentity>());
|
||||
SetupNetworkTransform(OrbPrefab);
|
||||
OrbPrefab.AddComponent<NomaiOrbTransformSync>();
|
||||
spawnPrefabs.Add(OrbPrefab);
|
||||
@ -161,6 +151,14 @@ namespace QSB
|
||||
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
|
||||
{
|
||||
DebugLog.DebugWrite("OnClientConnect", MessageType.Info);
|
||||
|
@ -43,7 +43,9 @@ namespace QSB.SectorSync
|
||||
public QSBSector GetClosestSector(Transform trans) // trans rights \o/
|
||||
{
|
||||
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))
|
||||
.First();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace QSB.SectorSync
|
||||
private const float CheckInterval = 0.5f;
|
||||
private float _checkTimer = CheckInterval;
|
||||
|
||||
private void Update()
|
||||
public void Update()
|
||||
{
|
||||
if (!QSBSectorManager.Instance.IsReady)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QuantumUNET;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@ -9,6 +9,8 @@ namespace QSB.TimeSync
|
||||
{
|
||||
public static TimeSyncUI Instance;
|
||||
|
||||
public static float TargetTime;
|
||||
|
||||
private Canvas _canvas;
|
||||
private Text _text;
|
||||
private float _startTime;
|
||||
@ -70,7 +72,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
var totalSeconds = Mathf.Max(Time.timeSinceLevelLoad - _startTime, 0f);
|
||||
var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f);
|
||||
var minutes = Mathf.FloorToInt(totalSeconds / 60f);
|
||||
var seconds = Mathf.FloorToInt(totalSeconds) % 60;
|
||||
var text = "";
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
|
@ -126,10 +126,12 @@ namespace QSB.TimeSync
|
||||
{
|
||||
if (_state == State.FastForwarding)
|
||||
{
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
return;
|
||||
}
|
||||
_timeScale = MaxFastForwardSpeed;
|
||||
_state = State.FastForwarding;
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
TimeSyncUI.Start(TimeSyncType.Fastforwarding);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Tools
|
||||
|
@ -62,13 +62,13 @@ namespace QSB.TransformSync
|
||||
if (HasAuthority)
|
||||
{
|
||||
transform.position = _orbParent.InverseTransformPoint(OrbTransform.position);
|
||||
transform.rotation = _orbParent.InverseTransformRotation(OrbTransform.rotation);
|
||||
transform.rotation = OrbTransform.rotation;
|
||||
return;
|
||||
}
|
||||
if (transform.position != Vector3.zero)
|
||||
{
|
||||
OrbTransform.position = _orbParent.TransformPoint(transform.position);
|
||||
OrbTransform.rotation = _orbParent.InverseTransformRotation(OrbTransform.rotation);
|
||||
OrbTransform.rotation = transform.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,9 @@ namespace QSB.TransformSync
|
||||
|
||||
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;
|
||||
|
||||
return body;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using QSB.Animation;
|
||||
using QSB.Instruments;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TransformSync
|
||||
@ -15,11 +14,7 @@ namespace QSB.TransformSync
|
||||
AnimControllerPatch.Init();
|
||||
}
|
||||
|
||||
public override void OnStartLocalPlayer()
|
||||
{
|
||||
LocalInstance = this;
|
||||
DebugLog.DebugWrite("SET LOCAL INSTANCE");
|
||||
}
|
||||
public override void OnStartLocalPlayer() => LocalInstance = this;
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
@ -53,6 +48,8 @@ namespace QSB.TransformSync
|
||||
var marker = body.gameObject.AddComponent<PlayerHUDMarker>();
|
||||
marker.Init(Player);
|
||||
|
||||
body.gameObject.AddComponent<PlayerMapMarker>().PlayerName = Player.Name;
|
||||
|
||||
Player.Body = body.gameObject;
|
||||
|
||||
return body;
|
||||
|
@ -112,6 +112,10 @@ namespace QSB.TransformSync
|
||||
|
||||
public void SetReferenceSector(QSBSector sector)
|
||||
{
|
||||
if (sector == ReferenceSector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_positionSmoothVelocity = Vector3.zero;
|
||||
ReferenceSector = sector;
|
||||
if (!HasAuthority)
|
||||
|
@ -1,4 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using OWML.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Utility
|
||||
|
@ -1,5 +1,4 @@
|
||||
using OWML.Common;
|
||||
using OWML.Logging;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
@ -8,16 +7,7 @@ namespace QSB.Utility
|
||||
public static class DebugLog
|
||||
{
|
||||
public static void ToConsole(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
// 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 });
|
||||
}
|
||||
=> QSBCore.Helper.Console.WriteLine(message, type, GetCallingType(new StackTrace()));
|
||||
|
||||
public static void ToHud(string message)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace QSB.WorldSync
|
||||
{
|
||||
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;
|
||||
}
|
||||
DialogueConditions[name] = state;
|
||||
@ -76,18 +76,16 @@ namespace QSB.WorldSync
|
||||
|
||||
public static void AddFactReveal(string id, bool saveGame, bool showNotification)
|
||||
{
|
||||
DebugLog.DebugWrite($"AddFactReveal {id}");
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
DebugLog.DebugWrite($"adding {id} to shiplogs");
|
||||
ShipLogFacts.Add(new FactReveal
|
||||
{
|
||||
Id = id,
|
||||
|
@ -4,6 +4,6 @@
|
||||
"name": "Quantum Space Buddies",
|
||||
"description": "Adds online multiplayer to the game.",
|
||||
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
|
||||
"version": "0.7.0",
|
||||
"owmlVersion": "0.7.3"
|
||||
"version": "0.7.1",
|
||||
"owmlVersion": "1.1.1"
|
||||
}
|
@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.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>
|
@ -35,37 +35,37 @@
|
||||
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<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 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>
|
||||
</Reference>
|
||||
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.dll</HintPath>
|
||||
<Reference Include="OWML.Common, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll</HintPath>
|
||||
<Reference Include="OWML.Logging, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
<Reference Include="OWML.Utils, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.1\lib\net35\OWML.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.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>
|
Loading…
x
Reference in New Issue
Block a user