mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-24 00:39:52 +00:00
cleanup + showing clock when fast forwarding
This commit is contained in:
parent
d822b23f74
commit
871cb1d437
@ -1,7 +1,6 @@
|
|||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using OWML.ModHelper;
|
using OWML.ModHelper;
|
||||||
using QSB.ElevatorSync;
|
using QSB.ElevatorSync;
|
||||||
using QSB.Events;
|
|
||||||
using QSB.GeyserSync;
|
using QSB.GeyserSync;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -180,7 +180,7 @@
|
|||||||
<Compile Include="TransformSync\PlayerHUDMarker.cs" />
|
<Compile Include="TransformSync\PlayerHUDMarker.cs" />
|
||||||
<Compile Include="Tools\PlayerToolsManager.cs" />
|
<Compile Include="Tools\PlayerToolsManager.cs" />
|
||||||
<Compile Include="Utility\Patches.cs" />
|
<Compile Include="Utility\Patches.cs" />
|
||||||
<Compile Include="Utility\QSBExtensions.cs" />
|
<Compile Include="Tools\ToolExtensions.cs" />
|
||||||
<Compile Include="Utility\QuaternionHelper.cs" />
|
<Compile Include="Utility\QuaternionHelper.cs" />
|
||||||
<Compile Include="TimeSync\PreserveTimeScale.cs" />
|
<Compile Include="TimeSync\PreserveTimeScale.cs" />
|
||||||
<Compile Include="TransformSync\ShipTransformSync.cs" />
|
<Compile Include="TransformSync\ShipTransformSync.cs" />
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using QSB.Utility;
|
using OWML.ModHelper.Events;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace QSB.TimeSync
|
namespace QSB.TimeSync
|
||||||
{
|
{
|
||||||
@ -10,14 +6,14 @@ namespace QSB.TimeSync
|
|||||||
{
|
{
|
||||||
public static void AddPatches()
|
public static void AddPatches()
|
||||||
{
|
{
|
||||||
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(WakeUpPatches.OnStartOfTimeLoopPrefix));
|
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(OnStartOfTimeLoopPrefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool OnStartOfTimeLoopPrefix(ref PlayerCameraEffectController __instance)
|
public static bool OnStartOfTimeLoopPrefix(ref PlayerCameraEffectController __instance)
|
||||||
{
|
{
|
||||||
if (__instance.gameObject.CompareTag("MainCamera") && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
if (__instance.gameObject.CompareTag("MainCamera") && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||||
{
|
{
|
||||||
__instance.Call("WakeUp");
|
__instance.Invoke("WakeUp");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using QSB.Events;
|
using OWML.ModHelper.Events;
|
||||||
using QSB.Messaging;
|
using QSB.Events;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ namespace QSB.TimeSync
|
|||||||
}
|
}
|
||||||
_timeScale = MaxFastForwardSpeed;
|
_timeScale = MaxFastForwardSpeed;
|
||||||
_state = State.FastForwarding;
|
_state = State.FastForwarding;
|
||||||
SpinnerUI.Show();
|
FindObjectOfType<SleepTimerUI>().Invoke("OnStartFastForward");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartPausing()
|
private void StartPausing()
|
||||||
@ -159,6 +159,7 @@ namespace QSB.TimeSync
|
|||||||
_isFirstFastForward = false;
|
_isFirstFastForward = false;
|
||||||
Physics.SyncTransforms();
|
Physics.SyncTransforms();
|
||||||
SpinnerUI.Hide();
|
SpinnerUI.Hide();
|
||||||
|
FindObjectOfType<SleepTimerUI>().Invoke("OnEndFastForward");
|
||||||
GlobalMessenger.FireEvent(EventNames.QSBPlayerStatesRequest);
|
GlobalMessenger.FireEvent(EventNames.QSBPlayerStatesRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,8 +218,9 @@ namespace QSB.TimeSync
|
|||||||
|
|
||||||
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem && _isFirstFastForward)
|
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem && _isFirstFastForward)
|
||||||
{
|
{
|
||||||
Locator.GetPlayerTransform().position = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform.position;
|
var spawnPoint = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform;
|
||||||
Locator.GetPlayerTransform().rotation = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform.rotation;
|
Locator.GetPlayerTransform().position = spawnPoint.position;
|
||||||
|
Locator.GetPlayerTransform().rotation = spawnPoint.rotation;
|
||||||
Physics.SyncTransforms();
|
Physics.SyncTransforms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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,40 +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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static object Call(this object obj, string methodName, params object[] args)
|
|
||||||
{
|
|
||||||
var method = obj.GetType().GetMethod(methodName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.Invoke(obj, args);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user