2021-12-26 21:05:07 -08:00
|
|
|
|
using QSB.Messaging;
|
2021-11-18 18:12:55 -08:00
|
|
|
|
using QSB.Player;
|
2022-01-26 17:14:26 -08:00
|
|
|
|
using QSB.RespawnSync;
|
2021-06-19 15:35:40 +01:00
|
|
|
|
using QSB.ShipSync;
|
2021-12-23 16:26:31 -08:00
|
|
|
|
using QSB.Utility.Messages;
|
2021-12-23 17:07:29 -08:00
|
|
|
|
using System.Linq;
|
2020-12-08 09:31:29 +00:00
|
|
|
|
using UnityEngine;
|
2021-10-20 09:10:30 +01:00
|
|
|
|
using UnityEngine.InputSystem;
|
2020-03-14 21:42:43 +01:00
|
|
|
|
|
2020-07-30 22:27:14 +02:00
|
|
|
|
namespace QSB.Utility
|
2020-03-14 21:42:43 +01:00
|
|
|
|
{
|
2020-12-02 21:23:01 +00:00
|
|
|
|
public class DebugActions : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private void GoToVessel()
|
|
|
|
|
{
|
|
|
|
|
var spawnPoint = GameObject.Find("Spawn_Vessel").GetComponent<SpawnPoint>();
|
2020-03-14 21:42:43 +01:00
|
|
|
|
|
2020-12-02 21:23:01 +00:00
|
|
|
|
var playerBody = Locator.GetPlayerBody();
|
|
|
|
|
playerBody.WarpToPositionRotation(spawnPoint.transform.position, spawnPoint.transform.rotation);
|
|
|
|
|
playerBody.SetVelocity(spawnPoint.GetPointVelocity());
|
2021-12-29 12:19:46 +00:00
|
|
|
|
var bridgeVolume = FindObjectOfType<VesselWarpController>()._bridgeVolume;
|
|
|
|
|
bridgeVolume.AddObjectToVolume(Locator.GetPlayerDetector());
|
|
|
|
|
bridgeVolume.AddObjectToVolume(Locator.GetPlayerCameraDetector());
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
2020-03-14 21:42:43 +01:00
|
|
|
|
|
2020-12-02 21:23:01 +00:00
|
|
|
|
private void InsertWarpCore()
|
|
|
|
|
{
|
|
|
|
|
var warpCore = GameObject.Find("Prefab_NOM_WarpCoreVessel").GetComponent<WarpCoreItem>();
|
|
|
|
|
var socket = GameObject.Find("Interactibles_VesselBridge").GetComponentInChildren<WarpCoreSocket>();
|
|
|
|
|
socket.PlaceIntoSocket(warpCore);
|
|
|
|
|
}
|
2020-03-14 21:42:43 +01:00
|
|
|
|
|
2021-07-12 22:02:50 +01:00
|
|
|
|
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
|
2021-06-19 15:35:40 +01:00
|
|
|
|
|
2022-01-18 16:19:49 -08:00
|
|
|
|
private void Awake() => enabled = QSBCore.DebugMode;
|
|
|
|
|
|
2022-01-18 15:50:20 -08:00
|
|
|
|
public void Update()
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
2022-01-20 12:31:19 -08:00
|
|
|
|
if (!Keyboard.current[Key.Q].isPressed)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 21:24:31 +00:00
|
|
|
|
/*
|
2021-12-29 01:08:14 -08:00
|
|
|
|
* 1 - Warp to first non local player
|
2021-12-21 21:24:31 +00:00
|
|
|
|
* 2 - Set time flowing
|
2021-12-29 00:17:13 -08:00
|
|
|
|
* 3 - Destroy probe
|
2021-12-21 21:24:31 +00:00
|
|
|
|
* 4 - Damage ship electricals
|
|
|
|
|
* 5 - Trigger supernova
|
2022-01-12 10:52:11 +00:00
|
|
|
|
* 6 - Set MET_SOLANUM
|
2021-12-21 21:24:31 +00:00
|
|
|
|
* 7 - Warp to vessel
|
|
|
|
|
* 8 - Place warp core into vessel
|
|
|
|
|
* 9 - Load eye scene
|
2022-01-26 17:14:26 -08:00
|
|
|
|
* 0 - Respawn some player
|
2021-12-21 21:24:31 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
|
|
|
|
{
|
2022-01-21 22:14:32 -08:00
|
|
|
|
var otherPlayer = QSBPlayerManager.PlayerList.FirstOrDefault(x => !x.IsLocalPlayer);
|
2021-12-29 00:57:06 -08:00
|
|
|
|
if (otherPlayer != null)
|
2021-12-21 21:24:31 +00:00
|
|
|
|
{
|
2021-12-29 00:57:06 -08:00
|
|
|
|
new DebugRequestTeleportInfoMessage(otherPlayer.PlayerId).Send();
|
2021-12-21 21:24:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 21:05:11 +00:00
|
|
|
|
if (Keyboard.current[Key.Numpad2].wasPressedThisFrame)
|
2021-12-21 21:24:31 +00:00
|
|
|
|
{
|
|
|
|
|
TimeLoop._isTimeFlowing = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 21:05:11 +00:00
|
|
|
|
if (Keyboard.current[Key.Numpad3].wasPressedThisFrame)
|
|
|
|
|
{
|
|
|
|
|
Destroy(Locator.GetProbe().gameObject);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 09:10:30 +01:00
|
|
|
|
if (Keyboard.current[Key.Numpad4].wasPressedThisFrame)
|
2021-08-08 19:48:48 +01:00
|
|
|
|
{
|
2021-10-20 09:10:30 +01:00
|
|
|
|
DamageShipElectricalSystem();
|
2021-08-08 19:48:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 09:10:30 +01:00
|
|
|
|
if (Keyboard.current[Key.Numpad5].wasPressedThisFrame)
|
2021-06-19 15:35:40 +01:00
|
|
|
|
{
|
2021-12-29 00:57:06 -08:00
|
|
|
|
new DebugTriggerSupernovaMessage().Send();
|
2021-06-19 15:35:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-12 10:52:11 +00:00
|
|
|
|
if (Keyboard.current[Key.Numpad6].wasPressedThisFrame)
|
|
|
|
|
{
|
|
|
|
|
PlayerData.SetPersistentCondition("MET_SOLANUM", true);
|
|
|
|
|
PlayerData.SetPersistentCondition("MET_PRISONER", true);
|
|
|
|
|
DialogueConditionManager.SharedInstance.SetConditionState("MET_SOLANUM", true);
|
|
|
|
|
DialogueConditionManager.SharedInstance.SetConditionState("MET_PRISONER", true);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 09:10:30 +01:00
|
|
|
|
if (Keyboard.current[Key.Numpad7].wasPressedThisFrame)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
GoToVessel();
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-10-20 09:10:30 +01:00
|
|
|
|
if (Keyboard.current[Key.Numpad8].wasPressedThisFrame)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
InsertWarpCore();
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-10-20 09:10:30 +01:00
|
|
|
|
if (Keyboard.current[Key.Numpad9].wasPressedThisFrame)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
2022-01-07 18:39:12 -08:00
|
|
|
|
if (Keyboard.current[Key.LeftShift].isPressed)
|
|
|
|
|
{
|
|
|
|
|
PlayerData._currentGameSave.warpedToTheEye = false;
|
|
|
|
|
PlayerData.SaveCurrentGame();
|
|
|
|
|
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PlayerData.SaveWarpedToTheEye(60);
|
|
|
|
|
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
|
|
|
|
}
|
2022-01-07 18:32:23 -08:00
|
|
|
|
}
|
2022-01-26 17:14:26 -08:00
|
|
|
|
|
|
|
|
|
if (Keyboard.current[Key.Numpad0].wasPressedThisFrame)
|
|
|
|
|
{
|
|
|
|
|
RespawnManager.Instance.RespawnSomePlayer();
|
|
|
|
|
}
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-18 18:12:55 -08:00
|
|
|
|
}
|