Skip to content

Commit

Permalink
Merge branch 'BK-FSDDev' into 'develop'
Browse files Browse the repository at this point in the history
BK-FSDDev

See merge request KerbaeAdAstra/KerbalFuture!1

Developed FSD and SFD, with bug fixes for both.
  • Loading branch information
AmberCronin committed Oct 26, 2018
2 parents e34a77c + c5c279e commit cc2948b
Show file tree
Hide file tree
Showing 37 changed files with 2,417 additions and 272 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Assembly-Csharp.dll
Assembly-Csharp-firstpass.dll
UnityEngine.dll
UnityEngine.UI.dll
000_AT_Utils.dll
6 changes: 6 additions & 0 deletions GameData/KerbalFuture/Changelog.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
showChangelog = False
VERSION
{
version = 0.0.0
change = Debuging
}
8 changes: 8 additions & 0 deletions GameData/KerbalFuture/Constants.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//FSD
constSpaceTime = 0.000001
constContraction = 0.000000000001
constHyperspaceDrag = 0.00000000000000001
constXMUsage = 400

//SFD
constReactantUsage = 30000
8 changes: 8 additions & 0 deletions GameData/KerbalFuture/Patches/FTLModuleCoreHeat.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@PART[*]:HAS[@MODULE[ModuleSpaceFolderDrive|ModuleFrameShiftDrive|ModuleStutterWarpDrive|ModulePolySpatialDrive]]
{
//Just the name should be fine
%MODULE
{
name = ModuleCoreHeat
}
}
3 changes: 3 additions & 0 deletions GameData/KerbalFuture/PluginData/ledGreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions GameData/KerbalFuture/PluginData/ledPurple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions GameData/KerbalFuture/PluginData/ledRed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions GameData/KerbalFuture/PluginData/ledYellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions GameData/KerbalFuture/PluginData/toolbarLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
146 changes: 146 additions & 0 deletions KerbalFuture/KFGUI/ConstantEditWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
using UnityEngine;
using KerbalFuture.Utils;
using System.IO;
using KerbalFuture.Superluminal.FrameShift;
using KerbalFuture.Superluminal.SpaceFolder;

namespace KerbalFuture.KFGUI
{
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class ConstantEditWindow : MonoBehaviour
{
public static bool advancedMode = false;
double constOfSpaceTime = 0;
double constOfContraction = 0;
double constOfHyperspaceDrag = 0;
double constOfXMUsage = 0;

double constOfReactantUsage = 0;


string stringConstSpaceTime = "";
string stringConstContraction = "";
string stringConstHyperspaceDrag = "";
string stringConstXMUsage = "";

string stringConstReactantUsage = "";

Rect constantsRect;

ConfigNode constants = ConfigNode.Load(Path.Combine(KFGUI.dllLoc, "Constants.cfg"));

private void Start()
{
constantsRect = new Rect(50, 50, (GameSettings.SCREEN_RESOLUTION_WIDTH / 1920) * 300, (GameSettings.SCREEN_RESOLUTION_HEIGHT / 1080) * 500);
UpdateConstants();
}
public static bool drawWindow = false;
private void OnGUI()
{
if(drawWindow)
{
constantsRect = GUILayout.Window(37, constantsRect, DrawConstantEditWindow, "Constants");
}
}
private void DrawConstantEditWindow(int id)
{
GUI.DragWindow(new Rect(0, 0, constantsRect.width, 20 * (GameSettings.SCREEN_RESOLUTION_HEIGHT / 1080)));
GUILayout.Label("FSD");
GUILayout.BeginHorizontal();
GUILayout.Label("constSpaceTime");
stringConstSpaceTime = GUILayout.TextField(stringConstSpaceTime);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("constContraction");
stringConstContraction = GUILayout.TextField(stringConstContraction);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("constHyperspaceDrag");
stringConstHyperspaceDrag = GUILayout.TextField(stringConstHyperspaceDrag);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("constXMUsage");
stringConstXMUsage = GUILayout.TextField(stringConstXMUsage);
GUILayout.EndHorizontal();
GUILayout.Space(30 * (GameSettings.SCREEN_RESOLUTION_HEIGHT / 1080));
GUILayout.Label("SFD");
GUILayout.BeginHorizontal();
GUILayout.Label("constReactantUsage");
stringConstReactantUsage = GUILayout.TextField(stringConstReactantUsage);
GUILayout.EndHorizontal();
GUILayout.Space(30 * (GameSettings.SCREEN_RESOLUTION_HEIGHT / 1080));
GUILayout.BeginHorizontal();
if(GUILayout.Button("Save fields"))
{
SaveConstants();
}
if(GUILayout.Button("Update fields"))
{
UpdateConstants();
}
GUILayout.EndHorizontal();
advancedMode = GUILayout.Toggle(advancedMode, "Debug Mode", "button");
}
private void SaveConstants()
{
constOfSpaceTime = double.Parse(stringConstSpaceTime, System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent);
constOfContraction = double.Parse(stringConstContraction, System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent);
constOfHyperspaceDrag = double.Parse(stringConstHyperspaceDrag, System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent);
constOfXMUsage = double.Parse(stringConstXMUsage, System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent);
constOfReactantUsage = double.Parse(stringConstReactantUsage, System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent);
FrameShiftWarpChecks.ALCUBIERRE_CONSTANT_OF_SPACETIME = constOfSpaceTime;
FrameShiftWarpChecks.CONTRACTION_CONSTANT_OF_SPACETIME = constOfContraction;
FrameShiftWarpChecks.HYPERSPACE_DRAG_CONSTANT = constOfHyperspaceDrag;
FrameShiftWarpChecks.DRIVE_USAGE_CONSTANT_OF_XM = constOfXMUsage;
SpaceFolderDriveVesselModule.SPACEFOLDER_CONSTANT_OF_REACTANT_USAGE = constOfReactantUsage;
if (!GUIUtils.SaveConstant(constants, "constSpaceTime", constOfSpaceTime, "Constants.cfg"))
{
Debug.Log("[KF] Failed to save constant constSpaceTime.");
}
if (!GUIUtils.SaveConstant(constants, "constContraction", constOfContraction, "Constants.cfg"))
{
Debug.Log("[KF] Failed to save constant constContraction.");
}
if (!GUIUtils.SaveConstant(constants, "constHyperspaceDrag", constOfHyperspaceDrag, "Constants.cfg"))
{
Debug.Log("[KF] Failed to save constant constHyperspaceDrag.");
}
if (!GUIUtils.SaveConstant(constants, "constXMUsage", constOfXMUsage, "Constants.cfg"))
{
Debug.Log("[KF] Failed to save constant constXMUsage.");
}
if (!GUIUtils.SaveConstant(constants, "constReactantUsage", constOfReactantUsage, "Constants.cfg"))
{
Debug.Log("[KF] Failed to save constant constReactantUsage.");
}
}
private void UpdateConstants()
{
if(!GUIUtils.TryLoadConstant(constants, "constSpaceTime", ref constOfSpaceTime))
{
Debug.Log("[KF] Failed to load constant constSpaceTime");
}
stringConstSpaceTime = constOfSpaceTime.ToString();
if(!GUIUtils.TryLoadConstant(constants, "constContraction", ref constOfContraction))
{
Debug.Log("[KF] Failed to load constant constContraction");
}
stringConstContraction = constOfContraction.ToString();
if(!GUIUtils.TryLoadConstant(constants, "constHyperspaceDrag", ref constOfHyperspaceDrag))
{
Debug.Log("[KF] Failed to load constant constHyperspaceDrag");
}
stringConstHyperspaceDrag = constOfHyperspaceDrag.ToString();
if(!GUIUtils.TryLoadConstant(constants, "constXMUsage", ref constOfXMUsage))
{
Debug.Log("[KF] Failed to load constant constXMUsage");
}
stringConstXMUsage = constOfXMUsage.ToString();
if(!GUIUtils.TryLoadConstant(constants, "constReactantUsage", ref constOfReactantUsage))
{
Debug.Log("[KF] Failed to load constant constReactantUsage");
}
stringConstReactantUsage = constOfReactantUsage.ToString();
}
}
}
Loading

0 comments on commit cc2948b

Please sign in to comment.