mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 06:35:45 +00:00
Merge branch 'dev' into fix-default-sector
This commit is contained in:
commit
f09711a4de
@ -41,7 +41,7 @@ namespace QSB
|
||||
|
||||
public void UpdateStateObjects()
|
||||
{
|
||||
if (!QSB.WokenUp)
|
||||
if (OWInput.GetInputMode() == InputMode.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
16
QSB/QSB.cs
16
QSB/QSB.cs
@ -1,7 +1,6 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.Events;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
@ -14,7 +13,6 @@ namespace QSB
|
||||
public static IModHelper Helper;
|
||||
public static string DefaultServerIP;
|
||||
public static bool DebugMode;
|
||||
public static bool WokenUp;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -32,20 +30,6 @@ namespace QSB
|
||||
gameObject.AddComponent<UnityHelper>();
|
||||
gameObject.AddComponent<ElevatorManager>();
|
||||
gameObject.AddComponent<GeyserManager>();
|
||||
|
||||
GlobalMessenger.AddListener(EventNames.RestartTimeLoop, OnLoopStart);
|
||||
GlobalMessenger.AddListener(EventNames.WakeUp, OnWakeUp);
|
||||
}
|
||||
|
||||
private void OnWakeUp()
|
||||
{
|
||||
WokenUp = true;
|
||||
GlobalMessenger.FireEvent(EventNames.QSBPlayerStatesRequest);
|
||||
}
|
||||
|
||||
private void OnLoopStart()
|
||||
{
|
||||
WokenUp = false;
|
||||
}
|
||||
|
||||
public override void Configure(IModConfig config)
|
||||
|
@ -97,6 +97,10 @@
|
||||
<Reference Include="UnityEngine.Networking">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.Networking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
@ -129,6 +133,7 @@
|
||||
<Compile Include="ElevatorSync\ElevatorPatches.cs" />
|
||||
<Compile Include="Events\EventNames.cs" />
|
||||
<Compile Include="DeathSync\PlayerDeathEvent.cs" />
|
||||
<Compile Include="TimeSync\WakeUpPatches.cs" />
|
||||
<Compile Include="Tools\PlayerFlashlightEvent.cs" />
|
||||
<Compile Include="Events\PlayerJoinEvent.cs" />
|
||||
<Compile Include="Events\PlayerLeaveEvent.cs" />
|
||||
@ -175,7 +180,7 @@
|
||||
<Compile Include="TransformSync\PlayerHUDMarker.cs" />
|
||||
<Compile Include="Tools\PlayerToolsManager.cs" />
|
||||
<Compile Include="Utility\Patches.cs" />
|
||||
<Compile Include="Utility\QSBExtensions.cs" />
|
||||
<Compile Include="Tools\ToolExtensions.cs" />
|
||||
<Compile Include="Utility\QuaternionHelper.cs" />
|
||||
<Compile Include="TimeSync\PreserveTimeScale.cs" />
|
||||
<Compile Include="TransformSync\ShipTransformSync.cs" />
|
||||
|
@ -127,6 +127,7 @@ namespace QSB
|
||||
{
|
||||
gameObject.AddComponent<Events.PlayerState>();
|
||||
GeyserManager.Instance.EmptyUpdate();
|
||||
WakeUpPatches.AddPatches();
|
||||
}
|
||||
|
||||
_canEditName = false;
|
||||
|
21
QSB/TimeSync/WakeUpPatches.cs
Normal file
21
QSB/TimeSync/WakeUpPatches.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using OWML.ModHelper.Events;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
{
|
||||
public static class WakeUpPatches
|
||||
{
|
||||
public static void AddPatches()
|
||||
{
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(OnStartOfTimeLoopPrefix));
|
||||
}
|
||||
|
||||
public static bool OnStartOfTimeLoopPrefix(ref PlayerCameraEffectController __instance)
|
||||
{
|
||||
if (__instance.gameObject.CompareTag("MainCamera") && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||
{
|
||||
__instance.Invoke("WakeUp");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
@ -21,6 +21,7 @@ namespace QSB.TimeSync
|
||||
private float _serverTime;
|
||||
private float _timeScale;
|
||||
private bool _isInputEnabled = true;
|
||||
private bool _isFirstFastForward = true;
|
||||
private int _localLoopCount;
|
||||
private int _serverLoopCount;
|
||||
|
||||
@ -132,6 +133,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
_timeScale = MaxFastForwardSpeed;
|
||||
_state = State.FastForwarding;
|
||||
FindObjectOfType<SleepTimerUI>().Invoke("OnStartFastForward");
|
||||
}
|
||||
|
||||
private void StartPausing()
|
||||
@ -142,6 +144,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
_timeScale = 0f;
|
||||
_state = State.Pausing;
|
||||
SpinnerUI.Show();
|
||||
}
|
||||
|
||||
private void ResetTimeScale()
|
||||
@ -153,6 +156,11 @@ namespace QSB.TimeSync
|
||||
{
|
||||
EnableInput();
|
||||
}
|
||||
_isFirstFastForward = false;
|
||||
Physics.SyncTransforms();
|
||||
SpinnerUI.Hide();
|
||||
FindObjectOfType<SleepTimerUI>().Invoke("OnEndFastForward");
|
||||
GlobalMessenger.FireEvent(EventNames.QSBPlayerStatesRequest);
|
||||
}
|
||||
|
||||
private void DisableInput()
|
||||
@ -207,6 +215,14 @@ namespace QSB.TimeSync
|
||||
{
|
||||
var diff = _serverTime - Time.timeSinceLevelLoad;
|
||||
Time.timeScale = Mathf.Lerp(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff);
|
||||
|
||||
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem && _isFirstFastForward)
|
||||
{
|
||||
var spawnPoint = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform;
|
||||
Locator.GetPlayerTransform().position = spawnPoint.position;
|
||||
Locator.GetPlayerTransform().rotation = spawnPoint.rotation;
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
17
QSB/Tools/ToolExtensions.cs
Normal file
17
QSB/Tools/ToolExtensions.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public static class ToolExtensions
|
||||
{
|
||||
public static void ChangeEquipState(this PlayerTool tool, bool equipState)
|
||||
{
|
||||
if (equipState)
|
||||
{
|
||||
tool.EquipTool();
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.UnequipTool();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
public static class QSBExtensions
|
||||
{
|
||||
public static void ChangeEquipState(this PlayerTool tool, bool equipState)
|
||||
{
|
||||
if (equipState)
|
||||
{
|
||||
tool.EquipTool();
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.UnequipTool();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetHierarchy(this GameObject go)
|
||||
{
|
||||
var name = go.name;
|
||||
while (go.transform.parent != null)
|
||||
{
|
||||
go = go.transform.parent.gameObject;
|
||||
name = go.name + "/" + name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user