116 lines
3.1 KiB
C#
Raw Normal View History

2021-12-26 21:05:07 -08:00
using QSB.Messaging;
using QSB.Player;
using QSB.ShipSync;
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;
using UnityEngine.InputSystem;
namespace QSB.Utility
{
2020-12-02 21:23:01 +00:00
public class DebugActions : MonoBehaviour
{
private void GoToVessel()
{
var spawnPoint = GameObject.Find("Spawn_Vessel").GetComponent<SpawnPoint>();
2020-12-02 21:23:01 +00:00
var playerBody = Locator.GetPlayerBody();
playerBody.WarpToPositionRotation(spawnPoint.transform.position, spawnPoint.transform.rotation);
playerBody.SetVelocity(spawnPoint.GetPointVelocity());
}
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);
2021-12-26 20:35:40 -08:00
var bridgeVolume = FindObjectOfType<VesselWarpController>()._bridgeVolume;
2020-12-08 09:31:29 +00:00
bridgeVolume.AddObjectToVolume(Locator.GetPlayerDetector());
bridgeVolume.AddObjectToVolume(Locator.GetPlayerCameraDetector());
2020-12-02 21:23:01 +00:00
}
2021-07-12 22:02:50 +01:00
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
private void Awake()
2020-12-02 21:23:01 +00:00
{
2020-12-14 16:24:52 +00:00
if (!QSBCore.DebugMode)
2020-12-02 21:23:01 +00:00
{
Destroy(this);
2020-12-02 21:23:01 +00:00
}
}
2021-06-18 22:38:32 +01:00
public void Update()
{
2021-12-21 21:24:31 +00:00
/*
* 1 - Warp to first player
* 2 - Set time flowing
* 3 - Destroy probe
2021-12-21 21:24:31 +00:00
* 4 - Damage ship electricals
* 5 - Trigger supernova
* 6 -
* 7 - Warp to vessel
* 8 - Place warp core into vessel
* 9 - Load eye scene
* 0 -
*/
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
{
var otherPlayer = QSBPlayerManager.PlayerList.FirstOrDefault(x => x.PlayerId != QSBPlayerManager.LocalPlayerId);
if (otherPlayer != null && otherPlayer.Body != null)
{
var playerBody = Locator.GetPlayerBody();
playerBody.WarpToPositionRotation(otherPlayer.Body.transform.position, otherPlayer.Body.transform.rotation);
var parentBody = otherPlayer.TransformSync?.ReferenceSector?.AttachedObject?.GetOWRigidbody();
if (parentBody != null)
{
playerBody.SetVelocity(parentBody.GetVelocity());
playerBody.SetAngularVelocity(parentBody.GetAngularVelocity());
}
else
{
playerBody.SetVelocity(Vector3.zero);
playerBody.SetAngularVelocity(Vector3.zero);
}
}
}
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);
}
if (Keyboard.current[Key.Numpad4].wasPressedThisFrame)
2021-08-08 19:48:48 +01:00
{
DamageShipElectricalSystem();
2021-08-08 19:48:48 +01:00
}
if (Keyboard.current[Key.Numpad5].wasPressedThisFrame)
{
2021-12-24 21:21:32 -08:00
new DebugMessage(DebugMessageEnum.TriggerSupernova).Send();
}
if (Keyboard.current[Key.Numpad7].wasPressedThisFrame)
2020-12-02 21:23:01 +00:00
{
GoToVessel();
}
2021-06-18 22:38:32 +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
if (Keyboard.current[Key.Numpad9].wasPressedThisFrame)
2020-12-02 21:23:01 +00:00
{
2021-10-26 18:56:36 +01:00
PlayerData.SaveWarpedToTheEye(60);
2020-12-14 21:41:56 +01:00
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
2020-12-02 21:23:01 +00:00
}
}
}
}