mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 09:39:56 +00:00
add back in debug actions, add trigger supernova action (properly)
This commit is contained in:
parent
0ef03086ae
commit
353de9c90f
@ -86,5 +86,6 @@
|
||||
public static string QSBStartLoop = "QSBStartLoop";
|
||||
public static string QSBServerState = "QSBServerState";
|
||||
public static string QSBClientState = "QSBClientState";
|
||||
public static string QSBDebugEvent = "QSBDebugEvent";
|
||||
}
|
||||
}
|
@ -2,6 +2,11 @@
|
||||
{
|
||||
public enum EventType
|
||||
{
|
||||
/*
|
||||
* MISC.
|
||||
*/
|
||||
DebugEvent,
|
||||
|
||||
/*
|
||||
* SERVER EVENTS
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@ using QSB.Tools.Events;
|
||||
using QSB.Tools.ProbeLauncherTool.Events;
|
||||
using QSB.TranslationSync.Events;
|
||||
using QSB.Utility;
|
||||
using QSB.Utility.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace QSB.Events
|
||||
@ -67,6 +68,7 @@ namespace QSB.Events
|
||||
new StartLoopEvent(),
|
||||
new ServerStateEvent(),
|
||||
new ClientStateEvent(),
|
||||
new DebugEvent(),
|
||||
// World Objects
|
||||
new ElevatorEvent(),
|
||||
new GeyserEvent(),
|
||||
|
@ -275,6 +275,8 @@
|
||||
<Compile Include="Utility\CustomCallbacks.cs" />
|
||||
<Compile Include="Utility\DebugBoxManager.cs" />
|
||||
<Compile Include="Utility\DebugGUI.cs" />
|
||||
<Compile Include="Utility\Events\DebugEvent.cs" />
|
||||
<Compile Include="Utility\Events\DebugEventEnum.cs" />
|
||||
<Compile Include="Utility\ZOverride.cs" />
|
||||
<Compile Include="Utility\Extensions.cs" />
|
||||
<Compile Include="Utility\GlobalMessenger4Args.cs" />
|
||||
|
@ -1,6 +1,9 @@
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.ShipSync;
|
||||
using QSB.Utility.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
@ -29,34 +32,32 @@ namespace QSB.Utility
|
||||
|
||||
public void Update()
|
||||
{
|
||||
return;
|
||||
|
||||
if (!QSBCore.DebugMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad5))
|
||||
{
|
||||
Locator.GetDeathManager().KillPlayer(DeathType.Supernova);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad4))
|
||||
if (Keyboard.current[Key.Numpad4].wasPressedThisFrame)
|
||||
{
|
||||
DamageShipElectricalSystem();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad7))
|
||||
if (Keyboard.current[Key.Numpad5].wasPressedThisFrame)
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBDebugEvent, DebugEventEnum.TriggerSupernova);
|
||||
}
|
||||
|
||||
if (Keyboard.current[Key.Numpad7].wasPressedThisFrame)
|
||||
{
|
||||
GoToVessel();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad8))
|
||||
if (Keyboard.current[Key.Numpad8].wasPressedThisFrame)
|
||||
{
|
||||
InsertWarpCore();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad9))
|
||||
if (Keyboard.current[Key.Numpad9].wasPressedThisFrame)
|
||||
{
|
||||
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
||||
}
|
||||
|
36
QSB/Utility/Events/DebugEvent.cs
Normal file
36
QSB/Utility/Events/DebugEvent.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Utility.Events
|
||||
{
|
||||
public class DebugEvent : QSBEvent<EnumMessage<DebugEventEnum>>
|
||||
{
|
||||
public override EventType Type => EventType.DebugEvent;
|
||||
|
||||
public override void SetupListener() => GlobalMessenger<DebugEventEnum>.AddListener(EventNames.QSBDebugEvent, Handler);
|
||||
public override void CloseListener() => GlobalMessenger<DebugEventEnum>.RemoveListener(EventNames.QSBDebugEvent, Handler);
|
||||
|
||||
private void Handler(DebugEventEnum type) => SendEvent(CreateMessage(type));
|
||||
|
||||
private EnumMessage<DebugEventEnum> CreateMessage(DebugEventEnum type) => new EnumMessage<DebugEventEnum>
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
EnumValue = type
|
||||
};
|
||||
|
||||
public override void OnReceiveLocal(bool isHost, EnumMessage<DebugEventEnum> message)
|
||||
{
|
||||
OnReceiveRemote(isHost, message);
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, EnumMessage<DebugEventEnum> message)
|
||||
{
|
||||
switch (message.EnumValue)
|
||||
{
|
||||
case DebugEventEnum.TriggerSupernova:
|
||||
TimeLoop.SetSecondsRemaining(0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
QSB/Utility/Events/DebugEventEnum.cs
Normal file
7
QSB/Utility/Events/DebugEventEnum.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace QSB.Utility.Events
|
||||
{
|
||||
public enum DebugEventEnum
|
||||
{
|
||||
TriggerSupernova
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user