mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-27 12:35:28 +00:00
change how inputs are disabled
This commit is contained in:
parent
b336452264
commit
713e38b7e8
18
QSB/Inputs/Patches/InputPatches.cs
Normal file
18
QSB/Inputs/Patches/InputPatches.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.Inputs.Patches
|
||||
{
|
||||
class InputPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
=> QSBCore.HarmonyHelper.AddPrefix<OWInput>("Update", typeof(InputPatches), nameof(OWInput_Update));
|
||||
|
||||
public override void DoUnpatches()
|
||||
=> QSBCore.HarmonyHelper.Unpatch<OWInput>("Update");
|
||||
|
||||
public static bool OWInput_Update()
|
||||
=> QSBInputManager.Instance.InputsEnabled;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB
|
||||
namespace QSB.Inputs
|
||||
{
|
||||
public class QSBInputManager : MonoBehaviour
|
||||
{
|
||||
@ -47,5 +48,18 @@ namespace QSB
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static QSBInputManager Instance { get; private set; }
|
||||
|
||||
public void Start()
|
||||
=> Instance = this;
|
||||
|
||||
public bool InputsEnabled { get; private set; } = true;
|
||||
|
||||
public void SetInputsEnabled(bool enabled)
|
||||
{
|
||||
DebugLog.DebugWrite($"INPUTS ENABLED? : {enabled}");
|
||||
InputsEnabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ using QSB.DeathSync.Patches;
|
||||
using QSB.ElevatorSync.Patches;
|
||||
using QSB.FrequencySync.Patches;
|
||||
using QSB.GeyserSync.Patches;
|
||||
using QSB.Inputs.Patches;
|
||||
using QSB.ItemSync.Patches;
|
||||
using QSB.LogSync.Patches;
|
||||
using QSB.OrbSync.Patches;
|
||||
@ -57,7 +58,8 @@ namespace QSB.Patches
|
||||
new PlayerPatches(),
|
||||
new PlayerAnimationPatches(),
|
||||
new CharacterAnimationPatches(),
|
||||
new ShipPatches()
|
||||
new ShipPatches(),
|
||||
new InputPatches()
|
||||
};
|
||||
|
||||
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
|
||||
|
@ -155,6 +155,7 @@
|
||||
<Compile Include="FrequencySync\Events\IdentifySignalEvent.cs" />
|
||||
<Compile Include="FrequencySync\Patches\FrequencyPatches.cs" />
|
||||
<Compile Include="GeyserSync\Patches\GeyserPatches.cs" />
|
||||
<Compile Include="Inputs\Patches\InputPatches.cs" />
|
||||
<Compile Include="Instruments\QSBCamera\CameraController.cs" />
|
||||
<Compile Include="Instruments\QSBCamera\CameraManager.cs" />
|
||||
<Compile Include="Instruments\QSBCamera\CameraMode.cs" />
|
||||
@ -207,7 +208,7 @@
|
||||
<Compile Include="Player\PlayerSyncObject.cs" />
|
||||
<Compile Include="PoolSync\Patches\PoolPatches.cs" />
|
||||
<Compile Include="PoolSync\PoolManager.cs" />
|
||||
<Compile Include="QSBInputManager.cs" />
|
||||
<Compile Include="Inputs\QSBInputManager.cs" />
|
||||
<Compile Include="QSBNetworkLobby.cs" />
|
||||
<Compile Include="Patches\QSBPatch.cs" />
|
||||
<Compile Include="Patches\QSBPatchTypes.cs" />
|
||||
|
@ -7,6 +7,7 @@ using QSB.CampfireSync;
|
||||
using QSB.ConversationSync;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.Inputs;
|
||||
using QSB.ItemSync;
|
||||
using QSB.OrbSync;
|
||||
using QSB.Patches;
|
||||
|
@ -2,6 +2,7 @@
|
||||
using OWML.Utils;
|
||||
using QSB.DeathSync;
|
||||
using QSB.Events;
|
||||
using QSB.Inputs;
|
||||
using QSB.TimeSync.Events;
|
||||
using QSB.Utility;
|
||||
using QuantumUNET;
|
||||
@ -166,7 +167,10 @@ namespace QSB.TimeSync
|
||||
{
|
||||
Locator.GetActiveCamera().enabled = false;
|
||||
}
|
||||
OWInput.ChangeInputMode(InputMode.None);
|
||||
|
||||
//OWInput.ChangeInputMode(InputMode.None);
|
||||
QSBInputManager.Instance.SetInputsEnabled(false);
|
||||
|
||||
_state = State.FastForwarding;
|
||||
OWTime.SetMaxDeltaTime(0.033333335f);
|
||||
OWTime.SetFixedTimestep(0.033333335f);
|
||||
@ -182,7 +186,10 @@ namespace QSB.TimeSync
|
||||
}
|
||||
DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info);
|
||||
Locator.GetActiveCamera().enabled = false;
|
||||
OWInput.ChangeInputMode(InputMode.None);
|
||||
|
||||
//OWInput.ChangeInputMode(InputMode.None);
|
||||
QSBInputManager.Instance.SetInputsEnabled(false);
|
||||
|
||||
OWTime.SetTimeScale(0f);
|
||||
_state = State.Pausing;
|
||||
SpinnerUI.Show();
|
||||
@ -205,15 +212,11 @@ namespace QSB.TimeSync
|
||||
QSBEventManager.FireEvent(EventNames.QSBPlayerStatesRequest);
|
||||
RespawnOnDeath.Instance.Init();
|
||||
|
||||
if (OWInput.GetInputMode() == InputMode.None)
|
||||
{
|
||||
OWInput.RestorePreviousInputs();
|
||||
}
|
||||
QSBInputManager.Instance.SetInputsEnabled(true);
|
||||
|
||||
if (!_hasWokenUp)
|
||||
{
|
||||
WakeUp();
|
||||
OWInput.ChangeInputMode(InputMode.Character);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +307,7 @@ namespace QSB.TimeSync
|
||||
if (mappedTimescale > 100f)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - CheckTimeDifference() returned over 100 - should have switched into fast-forward!", MessageType.Warning);
|
||||
mappedTimescale = 100f;
|
||||
mappedTimescale = 0f;
|
||||
}
|
||||
if (mappedTimescale < 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user