Add warp to vessel / insert core debug actions (#82)

* Add warp to vessel / insert core debug actions

* Add debug mode config flag

* Enable in-game switching of debug flag
This commit is contained in:
Ricardo Lopes 2020-03-14 21:42:43 +01:00 committed by GitHub
parent 494610c0dd
commit f3ec54f75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 1 deletions

45
QSB/DebugActions.cs Normal file
View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace QSB
{
class DebugActions : MonoBehaviour
{
void GoToVessel()
{
var spawnPoint = GameObject.Find("Spawn_Vessel").GetComponent<SpawnPoint>();
OWRigidbody playerBody = Locator.GetPlayerBody();
playerBody.WarpToPositionRotation(spawnPoint.transform.position, spawnPoint.transform.rotation);
playerBody.SetVelocity(spawnPoint.GetPointVelocity());
}
void InsertWarpCore()
{
var warpCore = GameObject.Find("Prefab_NOM_WarpCoreVessel").GetComponent<WarpCoreItem>();
var socket = GameObject.Find("Interactibles_VesselBridge").GetComponentInChildren<WarpCoreSocket>();
socket.PlaceIntoSocket(warpCore);
GetComponent<NomaiCoordinateInterface>().SetPillarRaised(true, true);
}
void Update()
{
if (!QSB.DebugMode)
{
return;
}
if (Input.GetKeyDown(KeyCode.Keypad1))
{
GoToVessel();
}
if (Input.GetKeyDown(KeyCode.Keypad2))
{
InsertWarpCore();
}
}
}
}

View File

@ -10,6 +10,7 @@ namespace QSB
{
public static IModHelper Helper;
public static string DefaultServerIP;
public static bool DebugMode;
private void Awake()
{
@ -23,11 +24,13 @@ namespace QSB
gameObject.AddComponent<DebugLog>();
gameObject.AddComponent<QSBNetworkManager>();
gameObject.AddComponent<NetworkManagerHUD>();
gameObject.AddComponent<DebugActions>();
}
public override void Configure(IModConfig config)
{
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
DebugMode = config.GetSettingsValue<bool>("debugMode");
}
}
}

View File

@ -106,6 +106,7 @@
<Compile Include="Animation\AnimFloatParam.cs" />
<Compile Include="Animation\AnimTriggerMessage.cs" />
<Compile Include="Animation\AnimTrigger.cs" />
<Compile Include="DebugActions.cs" />
<Compile Include="Events\Necronomicon.cs" />
<Compile Include="Events\JoinMessage.cs" />
<Compile Include="Events\LeaveMessage.cs" />

View File

@ -2,6 +2,7 @@
"requireVR": false,
"enabled": true,
"settings": {
"defaultServerIP": "localhost"
"defaultServerIP": "localhost",
"debugMode": false
}
}