├── Source
├── AssemblyVersion-1.3.1.cs
├── Textures
│ ├── KRASH.png
│ └── KRASH-old.png
├── .vs
│ └── KRASH
│ │ └── v15
│ │ └── sqlite3
│ │ └── storage.ide
├── KRASHCustom.cfg
├── ToolbarRegistration.cs
├── AssemblyVersion.cs
├── UIClass.cs
├── Properties
│ └── AssemblyInfo.cs
├── KRASH.userprefs
├── SceneModules
│ └── EditorModule.cs
├── View
│ ├── SiSuffix.cs
│ ├── Core.cs
│ ├── OrbitEditor.cs
│ ├── Lander.cs
│ └── View.cs
├── Log.cs
├── AssemblyVersion-1.3.1.tt
├── Settings.cs
├── AssemblyVersion.tt
├── InstallChecker.cs.orig
├── wireFrame.cs
├── InstallChecker.cs
├── KRASH - 1.3.1.csproj.173
├── KRASH - 1.3.1.csproj.orig
├── KRASH.csproj
├── KRASH - 1.3.1.csproj
├── APIManager.cs
├── KRASH.csproj.173
├── KRASH.csproj.orig
├── KRASH.cfg
└── LocalizationCache.cs
├── .vs
└── KRASH
│ └── v15
│ └── sqlite3
│ └── storage.ide
├── GameData
└── KRASH
│ ├── Textures
│ ├── KRASH.png
│ ├── KRASH_24.png
│ ├── Simulate.png
│ └── KRASH-old.png
│ ├── KRASH.version
│ ├── README4Modders.txt
│ ├── Localization
│ ├── zh-cn.cfg
│ ├── en-us.cfg
│ ├── ru.cfg
│ └── de-de.cfg
│ ├── README.md
│ ├── PluginData
│ └── KRASH.cfg
│ └── ChangeLog.txt
├── .github
└── FUNDING.yml
├── KRASH-1.3.1.version
├── KRASH.version
├── deploy-1.3.1.bat
├── deploy.bat
├── jenkins.txt
├── LICENSE.md
├── TODO.txt
├── KRASH.sln
├── README4Modders.txt
├── .gitignore
├── README.md
└── ChangeLog.txt
/Source/AssemblyVersion-1.3.1.cs:
--------------------------------------------------------------------------------
1 | ErrorGeneratingOutput
--------------------------------------------------------------------------------
/Source/Textures/KRASH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/Source/Textures/KRASH.png
--------------------------------------------------------------------------------
/Source/Textures/KRASH-old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/Source/Textures/KRASH-old.png
--------------------------------------------------------------------------------
/.vs/KRASH/v15/sqlite3/storage.ide:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/.vs/KRASH/v15/sqlite3/storage.ide
--------------------------------------------------------------------------------
/GameData/KRASH/Textures/KRASH.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/GameData/KRASH/Textures/KRASH.png
--------------------------------------------------------------------------------
/GameData/KRASH/Textures/KRASH_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/GameData/KRASH/Textures/KRASH_24.png
--------------------------------------------------------------------------------
/GameData/KRASH/Textures/Simulate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/GameData/KRASH/Textures/Simulate.png
--------------------------------------------------------------------------------
/GameData/KRASH/Textures/KRASH-old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/GameData/KRASH/Textures/KRASH-old.png
--------------------------------------------------------------------------------
/Source/.vs/KRASH/v15/sqlite3/storage.ide:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxgurugamer/KRASH/HEAD/Source/.vs/KRASH/v15/sqlite3/storage.ide
--------------------------------------------------------------------------------
/Source/KRASHCustom.cfg:
--------------------------------------------------------------------------------
1 | KRASHCustom
2 | {
3 | selectedCosts = default
4 |
5 | showRunningSimCosts = true
6 | showAllInCareer = false
7 | horizontalPos = 10
8 | verticalPos = 50
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Source/ToolbarRegistration.cs:
--------------------------------------------------------------------------------
1 | #if !RP_1_131
2 | using UnityEngine;
3 | using ToolbarControl_NS;
4 |
5 | namespace KRASH
6 | {
7 | [KSPAddon(KSPAddon.Startup.MainMenu, true)]
8 | public class RegisterToolbar : MonoBehaviour
9 | {
10 | void Start()
11 | {
12 | ToolbarControl.RegisterMod(LaunchGUI.MODID, LaunchGUI.MODNAME);
13 | }
14 | }
15 | }
16 | #endif
--------------------------------------------------------------------------------
/Source/AssemblyVersion.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | /* < # @ assembly name="EnvDTE" # > < # / * This assembly provides access to Visual Studio project properties. * / # > */
6 |
7 | // This code was generated by a tool. Any changes made manually will be lost
8 | // the next time this code is regenerated.
9 | //
10 |
11 | using System.Reflection;
12 |
13 | [assembly: AssemblyVersion("0.5.34.2")]
14 | [assembly: AssemblyFileVersion("0.5.34.2")]
15 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: linuxgurugamer
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | custom: # Replace with a single custom sponsorship URL
9 |
--------------------------------------------------------------------------------
/KRASH-1.3.1.version:
--------------------------------------------------------------------------------
1 | {
2 | "NAME": "KRASH",
3 | "URL": "http://ksp.spacetux.net/avc/KRASH-1.3.1",
4 | "DOWNLOAD": "https://github.com/linuxgurugamer/KRASH/releases",
5 | "GITHUB": {
6 | "USERNAME": "linuxgurugamer",
7 | "REPOSITORY": "KRASH"
8 | },
9 | "VERSION": {
10 | "MAJOR": 0,
11 | "MINOR": 5,
12 | "PATCH": 27,
13 | "BUILD": 0
14 | },
15 | "KSP_VERSION": {
16 | "MAJOR": 1,
17 | "MINOR": 3,
18 | "PATCH": 1
19 | },
20 | "KSP_VERSION_MIN": {
21 | "MAJOR": 1,
22 | "MINOR": 8,
23 | "PATCH": 0
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/KRASH.version:
--------------------------------------------------------------------------------
1 | {
2 | "NAME": "KRASH",
3 | "URL": "https://raw.githubusercontent.com/linuxgurugamer/KRASH/refs/heads/master/KRASH.version",
4 | "DOWNLOAD": "https://github.com/linuxgurugamer/KRASH/releases",
5 | "GITHUB": {
6 | "USERNAME": "linuxgurugamer",
7 | "REPOSITORY": "KRASH"
8 | },
9 | "VERSION": {
10 | "MAJOR": 0,
11 | "MINOR": 5,
12 | "PATCH": 34,
13 | "BUILD": 2
14 | },
15 | "KSP_VERSION": {
16 | "MAJOR": 1,
17 | "MINOR": 12,
18 | "PATCH": 5
19 | },
20 | "KSP_VERSION_MIN": {
21 | "MAJOR": 1,
22 | "MINOR": 12,
23 | "PATCH": 0
24 | },
25 | "KSP_VERSION_MAX": {
26 | "MAJOR": 1,
27 | "MINOR": 12,
28 | "PATCH": 99
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/GameData/KRASH/KRASH.version:
--------------------------------------------------------------------------------
1 | {
2 | "NAME": "KRASH",
3 | "URL": "https://raw.githubusercontent.com/linuxgurugamer/KRASH/refs/heads/master/KRASH.version",
4 | "DOWNLOAD": "https://github.com/linuxgurugamer/KRASH/releases",
5 | "GITHUB": {
6 | "USERNAME": "linuxgurugamer",
7 | "REPOSITORY": "KRASH"
8 | },
9 | "VERSION": {
10 | "MAJOR": 0,
11 | "MINOR": 5,
12 | "PATCH": 34,
13 | "BUILD": 2
14 | },
15 | "KSP_VERSION": {
16 | "MAJOR": 1,
17 | "MINOR": 12,
18 | "PATCH": 5
19 | },
20 | "KSP_VERSION_MIN": {
21 | "MAJOR": 1,
22 | "MINOR": 12,
23 | "PATCH": 0
24 | },
25 | "KSP_VERSION_MAX": {
26 | "MAJOR": 1,
27 | "MINOR": 12,
28 | "PATCH": 99
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/deploy-1.3.1.bat:
--------------------------------------------------------------------------------
1 |
2 | @echo off
3 |
4 | rem H is the destination game folder
5 | rem GAMEDIR is the name of the mod folder (usually the mod name)
6 | rem GAMEDATA is the name of the local GameData
7 | rem VERSIONFILE is the name of the version file, usually the same as GAMEDATA,
8 | rem but not always
9 |
10 | set H=R:\KSP_1.3.1_dev
11 | set GAMEDIR=KRASH
12 | set GAMEDATA="GameData\"
13 | set VERSIONFILE=%GAMEDIR%-1.3.1.version
14 |
15 | del %GAMEDATA%\%GAMEDIR%\*.version
16 | del %H%\GameData\%GAMEDIR%\*.version
17 |
18 | copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"
19 | copy /y "%1\*.pdb" "%GAMEDATA%\%GAMEDIR%\Plugins"
20 |
21 | copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%
22 |
23 | xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"
24 |
--------------------------------------------------------------------------------
/deploy.bat:
--------------------------------------------------------------------------------
1 |
2 | @echo off
3 |
4 | rem H is the destination game folder
5 | rem GAMEDIR is the name of the mod folder (usually the mod name)
6 | rem GAMEDATA is the name of the local GameData
7 | rem VERSIONFILE is the name of the version file, usually the same as GAMEDATA,
8 | rem but not always
9 |
10 | set H=%KSPDIR%
11 | set GAMEDIR=KRASH
12 | set GAMEDATA="GameData\"
13 | set VERSIONFILE=%GAMEDIR%.version
14 |
15 | set DP0=r:\dp0\kspdev
16 |
17 | copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"
18 | copy /Y "%1%3".pdb "%GAMEDATA%\%GAMEDIR%\Plugins"
19 |
20 | copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%
21 |
22 | xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"
23 | xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%DP0%\GameData\%GAMEDIR%"
24 |
25 | rem pause
26 |
--------------------------------------------------------------------------------
/Source/UIClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using KSP.IO;
4 |
5 | namespace KRASH
6 | {
7 | public class UICLASS: MonoBehaviour
8 | {
9 | private bool uiVisible = true;
10 |
11 | public UICLASS ()
12 | {
13 | Log.Info ("New instance of UICLASS: UICLASS constructor");
14 |
15 | }
16 | public void Start ()
17 | {
18 | DontDestroyOnLoad (this);
19 | }
20 |
21 | public void Awake ()
22 | {
23 | GameEvents.onShowUI.Add(onShowUI);
24 | GameEvents.onHideUI.Add(onHideUI);
25 | }
26 |
27 | private void onShowUI ()
28 | {
29 | uiVisible = true;
30 | }
31 |
32 | private void onHideUI ()
33 | {
34 | uiVisible = false;
35 | }
36 |
37 | public void OnDestroy ()
38 | {
39 | GameEvents.onShowUI.Remove(onShowUI);
40 | GameEvents.onHideUI.Remove(onHideUI);
41 | }
42 |
43 | public bool isVisible()
44 | {
45 | return uiVisible && KRASHShelter.instance.cfg.showRunningSimCosts;
46 | }
47 |
48 | public void setVisible(bool b)
49 | {
50 | uiVisible = b;
51 | }
52 | }
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/jenkins.txt:
--------------------------------------------------------------------------------
1 | #
2 | # This file contains several types of information:
3 | #
4 | # 1 Mod install directory, version file to use when building zip file
5 | # 2 Project definitions
6 | # 3 Files to copy, source, dest
7 | # 4 Directory to copy, sourcedir, destdir
8 | # 5 Add ModuleManager to GameData
9 | # 6 Spacedock.info mod id
10 | # 7 Additional folders in the GameData to be included in the final zip
11 | # 8 Additional mods to include, will copy into GameData and will be included in zip
12 |
13 | #
14 | # All paths are relative to the top git folder of the repo
15 | #
16 | # and must use forward slashes
17 | #
18 |
19 | # 1:GAMEDIR, VERSIONFILE
20 | 1:KRASH, KRASH.version
21 |
22 | # 2:PROJNAME, PROJFILE, VERSIONFILE, PLUGINSFOLDER
23 | 2:KRASH,Source/KRASH.csproj,KRASH.version,GameData/KRASH/Plugins
24 |
25 | # 3:SOURCEFILE, DESTDIR
26 | 3:KRASH.version,GameData/KRASH
27 | #3:LICENSE.md,GameData/KRASH
28 | #3:README.md,GameData/KRASH
29 |
30 | # 4:SOURCDIR, DESTDIR
31 | #4:Textures,GameData/ManeuverQueue/Textures
32 |
33 | # 5:ModuleManager
34 | # 5:ModuleManager
35 |
36 | # 6:mod_id
37 | #6:1272
38 |
39 | # 7: AdditionalFolders in the GameData, 1 per line
40 | #7:ConnectedLivingSpace
41 |
42 | # 8: AdditionalMods to include
43 | #8:ConnectedLivingSpace
44 |
45 | #
46 | # End of file
47 | #
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Portions of this mod are covered by the GPL license, provided in a separate file.
2 | Those files covered by the GPL are noted at the top of the file
3 |
4 |
5 | All other portions of ths mod are covered by the MIT license below:
6 |
7 |
8 | The MIT License (MIT)
9 |
10 | Copyright (c) 2015 Alexander Taylor (fingerboxes)
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining a copy
13 | of this software and associated documentation files (the "Software"), to deal
14 | in the Software without restriction, including without limitation the rights
15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 | copies of the Software, and to permit persons to whom the Software is
17 | furnished to do so, subject to the following conditions:
18 |
19 | The above copyright notice and this permission notice shall be included in
20 | all copies or substantial portions of the Software.
21 |
22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Source/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("KRASH")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("KRASH.Properties")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a820487d-a06d-4070-870c-b6f14189acbb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | //[assembly: AssemblyVersion("1.0.0.0")]
33 | //[assembly: AssemblyFileVersion("1.0.0.0")]
34 |
35 | #if !RP_1_131
36 | [assembly: KSPAssemblyDependency("ClickThroughBlocker", 1, 0)]
37 | [assembly: KSPAssemblyDependency("ToolbarController", 1, 0)]
38 | #endif
--------------------------------------------------------------------------------
/TODO.txt:
--------------------------------------------------------------------------------
1 | Done
2 | Add % of ship costs to costing structure for setup and per-minute
3 |
4 |
5 | ---------------------
6 |
7 | The costs will be configurable via an interface. I'll have an initial setup of costs, but they will all be configurable via the interface.
8 |
9 |
10 | ===========
11 | ToDo
12 | Configurable settings:
13 | font size
14 | costs position
15 |
16 | Timed events, called every second or so
17 |
18 | Add Wireframe: https://github.com/LGhassen/Scatterer/blob/master/scatterer/Core.cs
19 |
20 | if (farCamera)
21 | {
22 | if (nearCamera.gameObject.GetComponent (typeof(Wireframe)))
23 | Component.Destroy (nearCamera.gameObject.GetComponent (typeof(Wireframe)));
24 |
25 |
26 | if (farCamera.gameObject.GetComponent (typeof(Wireframe)))
27 | Component.Destroy (farCamera.gameObject.GetComponent (typeof(Wireframe)));
28 |
29 |
30 | if (scaledSpaceCamera.gameObject.GetComponent (typeof(Wireframe)))
31 | Component.Destroy (scaledSpaceCamera.gameObject.GetComponent (typeof(Wireframe)));
32 | }
33 |
34 |
35 |
36 |
37 | if (GUILayout.Button ("Toggle WireFrame"))
38 | {
39 | if (wireFrame)
40 | {
41 | if (nearCamera.gameObject.GetComponent (typeof(Wireframe)))
42 | Component.Destroy(nearCamera.gameObject.GetComponent (typeof(Wireframe)));
43 |
44 | if (farCamera.gameObject.GetComponent (typeof(Wireframe)))
45 | Component.Destroy(farCamera.gameObject.GetComponent (typeof(Wireframe)));
46 |
47 | if (scaledSpaceCamera.gameObject.GetComponent (typeof(Wireframe)))
48 | Component.Destroy(scaledSpaceCamera.gameObject.GetComponent (typeof(Wireframe)));
49 |
50 | wireFrame=false;
51 | }
52 |
53 | else
54 | {
55 | nearCamera.gameObject.AddComponent (typeof(Wireframe));
56 | farCamera.gameObject.AddComponent (typeof(Wireframe));
57 | scaledSpaceCamera.gameObject.AddComponent (typeof(Wireframe));
58 |
59 | wireFrame=true;
60 | }
61 | }
--------------------------------------------------------------------------------
/Source/KRASH.userprefs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | ..\..\FingerboxLib\Source\FingerboxLib.csproj
37 |
38 |
--------------------------------------------------------------------------------
/Source/SceneModules/EditorModule.cs:
--------------------------------------------------------------------------------
1 | #if false
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using UnityEngine;
6 |
7 | namespace KRASH.SceneModules
8 | {
9 | [KSPAddon(KSPAddon.Startup.EditorAny, true)]
10 | class EditorModule : MonoBehaviour
11 | {
12 | private const string TAG = "KRASH.EditorModule";
13 | DateTime lastUpdate;
14 |
15 | void Start() {
16 | Log.Info ("EditorModule.Start");
17 | lastUpdate = System.DateTime.Now.AddSeconds(1);
18 | }
19 |
20 | void Awake() {
21 | Log.Info ("EditorModule.Awake");
22 | }
23 |
24 | void LateUpdate() {
25 | Log.Info ("EditorModule.LateUpdate, shelterSimulationActive: " + KRASHShelter.persistent.shelterSimulationActive.ToString());
26 |
27 | // This is a hack until I can figure out a better way to determine where we are still in the editor
28 | // The problem comes when you try to start a simulation, and it is stopped by KSP because of
29 | // either locked parts or no control units available, and you then cancel.
30 | // First, this is only active in the Editor
31 | // Second, if a sim is active, then check to see if the LockMask is 0, if it is, and if
32 | // more than a second of real time has happened since the last time the lockmast wasn't 0
33 | // then disable the sim
34 | //
35 | // This is dependent on the LockMask being set to 0 when exiting a menu (this is the hack)
36 |
37 | if (KRASHShelter.persistent.shelterSimulationActive) {
38 |
39 | if (InputLockManager.LockMask == 0) {
40 |
41 | if (System.DateTime.Now.CompareTo(lastUpdate) < 0) {
42 |
43 | Log.Info ("Disabling simulation");
44 | KRASHShelter.persistent.shelterSimulationActive = false;
45 | KRASHShelter.instance.SimulationNotification (false);
46 | HighLogic.CurrentGame.Parameters.Flight.CanQuickSave = true;
47 | HighLogic.CurrentGame.Parameters.Flight.CanQuickLoad = true;
48 | }
49 |
50 | } else {
51 |
52 | lastUpdate = System.DateTime.Now.AddSeconds(1);
53 | Log.Info ("LastUpdate: " + lastUpdate.ToString ());
54 | }
55 | }
56 | }
57 |
58 | }
59 | }
60 | #endif
61 |
--------------------------------------------------------------------------------
/Source/View/SiSuffix.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace KRASH
6 | {
7 | public static class SiSuffix
8 | {
9 | private static readonly Dictionary Suffixes = new Dictionary
10 | {
11 | { "Y", 1e24 },
12 | { "Z", 1e21 },
13 | { "E", 1e18 },
14 | { "P", 1e15 },
15 | { "T", 1e12 },
16 | { "G", 1e9 },
17 | { "M", 1e6 },
18 | { "k", 1e3 },
19 | { "h", 1e2 },
20 | { "da", 1e1 },
21 |
22 | { "d", 1e-1 },
23 | { "c", 1e-2 },
24 | { "m", 1e-3 },
25 | { "u", 1e-6 },
26 | { "n", 1e-9 },
27 | { "p", 1e-12 },
28 | { "f", 1e-15 },
29 | { "a", 1e-18 },
30 | { "z", 1e-21 },
31 | { "y", 1e-24 }
32 | };
33 |
34 | public static bool TryParse(string s, out float value)
35 | {
36 | double dval;
37 | var success = TryParse(s, out dval);
38 | value = (float)dval;
39 | return success;
40 | }
41 |
42 | public static bool TryParse(string s, out double value)
43 | {
44 | s = s.Trim();
45 | double multiplier;
46 | var suffix = Suffixes.FirstOrDefault(suf => s.EndsWith(suf.Key, StringComparison.Ordinal));
47 | if (suffix.Key != null)
48 | {
49 | s = s.Substring(0, s.Length - suffix.Key.Length);
50 | multiplier = suffix.Value;
51 | }
52 | else
53 | multiplier = 1.0;
54 | if (double.TryParse(s, out value) == false)
55 | return false;
56 | value *= multiplier;
57 | return true;
58 | }
59 |
60 | /*
61 | // Not currently used. Si suffixes are unnecessary and confusing. Possibly useful with modification for clarity and practicality.
62 | public static string ToString(this double value)
63 | {
64 | var log = Math.Log10(Math.Abs(value));
65 | var minDiff = double.MaxValue;
66 | var minSuffix = new KeyValuePair("", 1);
67 | foreach (var suffix in Suffixes.Concat(new[] { new KeyValuePair("", 1) }))
68 | {
69 | var diff = Math.Abs(log - Math.Log10(suffix.Value));
70 | if (diff < minDiff)
71 | {
72 | minDiff = diff;
73 | minSuffix = suffix;
74 | }
75 | }
76 | value /= minSuffix.Value;
77 | return value.ToString("F") + minSuffix.Key;
78 | }
79 | */
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/Source/Log.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | //using UnityEngine;
4 |
5 |
6 | namespace KRASH
7 | {
8 | public static class Log
9 | {
10 | public enum LEVEL
11 | {
12 | OFF = 0,
13 | ERROR = 1,
14 | WARNING = 2,
15 | INFO = 3,
16 | DETAIL = 4,
17 | TRACE = 5
18 | };
19 |
20 | public static LEVEL level = LEVEL.INFO;
21 |
22 | private static readonly String PREFIX = "KRASH" + ": ";
23 |
24 | public static LEVEL GetLevel ()
25 | {
26 | return level;
27 | }
28 |
29 | public static void SetLevel (LEVEL level)
30 | {
31 | UnityEngine.Debug.Log ("log level " + level);
32 | Log.level = level;
33 | }
34 |
35 | public static LEVEL GetLogLevel ()
36 | {
37 | return level;
38 | }
39 |
40 | private static bool IsLevel (LEVEL level)
41 | {
42 | return level == Log.level;
43 | }
44 |
45 | public static bool IsLogable (LEVEL level)
46 | {
47 | return level <= Log.level;
48 | }
49 |
50 | public static void Trace (String msg)
51 | {
52 | if (IsLogable (LEVEL.TRACE)) {
53 | UnityEngine.Debug.Log (PREFIX + msg);
54 | }
55 | }
56 |
57 | public static void Detail (String msg)
58 | {
59 | if (IsLogable (LEVEL.DETAIL)) {
60 | UnityEngine.Debug.Log (PREFIX + msg);
61 | }
62 | }
63 |
64 | [ConditionalAttribute("DEBUG")]
65 | public static void Info (String msg)
66 | {
67 | if (IsLogable (LEVEL.INFO)) {
68 | UnityEngine.Debug.Log (PREFIX + msg);
69 | }
70 | }
71 |
72 | [ConditionalAttribute("DEBUG")]
73 | public static void Test (String msg)
74 | {
75 | //if (IsLogable(LEVEL.INFO))
76 | {
77 | UnityEngine.Debug.LogWarning (PREFIX + "TEST:" + msg);
78 | }
79 | }
80 |
81 |
82 | public static void Warning (String msg)
83 | {
84 | if (IsLogable (LEVEL.WARNING)) {
85 | UnityEngine.Debug.LogWarning (PREFIX + msg);
86 | }
87 | }
88 |
89 | public static void Error (String msg)
90 | {
91 | if (IsLogable (LEVEL.ERROR)) {
92 | UnityEngine.Debug.LogError (PREFIX + msg);
93 | }
94 | }
95 |
96 | public static void Exception (Exception e)
97 | {
98 | Log.Error ("exception caught: " + e.GetType () + ": " + e.Message);
99 | }
100 |
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/KRASH.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.8
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KRASH", "Source\KRASH.csproj", "{8C5539DD-396B-4084-892E-8F1901E51584}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1} = {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}
9 | EndProjectSection
10 | EndProject
11 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{8CBA63F7-E895-4EC1-AFCE-FD0E98C69047}"
12 | ProjectSection(SolutionItems) = preProject
13 | buildrelease-1.3.1.bat = buildrelease-1.3.1.bat
14 | buildrelease.bat = buildrelease.bat
15 | ChangeLog.txt = ChangeLog.txt
16 | deploy-1.3.1.bat = deploy-1.3.1.bat
17 | deploy.bat = deploy.bat
18 | jenkins.txt = jenkins.txt
19 | KRASH-1.3.1.version = KRASH-1.3.1.version
20 | KRASH.version = KRASH.version
21 | License.txt = License.txt
22 | README.md = README.md
23 | README4Modders.txt = README4Modders.txt
24 | TODO.txt = TODO.txt
25 | EndProjectSection
26 | EndProject
27 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KRASH - 1.3.1", "Source\KRASH - 1.3.1.csproj", "{87B8D2BE-7BC3-4712-9816-084DAAFD24A1}"
28 | EndProject
29 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BB2A0585-6D5E-46A3-B164-0FCF3CE643CC}"
30 | EndProject
31 | Global
32 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
33 | Debug|Any CPU = Debug|Any CPU
34 | Release|Any CPU = Release|Any CPU
35 | EndGlobalSection
36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
37 | {8C5539DD-396B-4084-892E-8F1901E51584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 | {8C5539DD-396B-4084-892E-8F1901E51584}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 | {8C5539DD-396B-4084-892E-8F1901E51584}.Release|Any CPU.ActiveCfg = Release|Any CPU
40 | {8C5539DD-396B-4084-892E-8F1901E51584}.Release|Any CPU.Build.0 = Release|Any CPU
41 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
43 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}.Release|Any CPU.Build.0 = Release|Any CPU
45 | EndGlobalSection
46 | GlobalSection(SolutionProperties) = preSolution
47 | HideSolutionNode = FALSE
48 | EndGlobalSection
49 | GlobalSection(ExtensibilityGlobals) = postSolution
50 | SolutionGuid = {53AC9AD0-6ABC-4EF1-AA21-DA272E92F00C}
51 | EndGlobalSection
52 | EndGlobal
53 |
--------------------------------------------------------------------------------
/Source/AssemblyVersion-1.3.1.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ import namespace="System.IO" #>
3 | <#@ output extension=".cs" #>
4 |
5 | <#@ assembly name="EnvDTE" #><# /* This assembly provides access to Visual Studio project properties. */ #>
6 | <#
7 |
8 | // Instructions
9 | // 1. Add a new Text Template to the project
10 | // 2. Copy this file into the new template
11 | // 3. Update the string: versionfile with the complete path to the .version file
12 | // 4. Remove the following line from the file AssemblyInfo.cs (usually located in the "Property" folder inside your C# project):
13 | // [assembly: AssemblyVersion("1.0.0.0")]
14 | // 5. Add the following to the PreBuild steps:
15 | // set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
16 | //
17 | // if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
18 | //
19 | // %textTemplatingPath% "$(ProjectDir)AssemblyFileVersion.tt"
20 |
21 | int major = 0;
22 | int minor = 0;
23 | int build = 0;
24 | int patch = 0;
25 | bool versionSection = false;
26 |
27 | int i = 0;
28 | int i2 = 0;
29 | string s;
30 |
31 | string versionfile = @"D:\Users\jbb\github\KRASH\KRASH-1.3.1.version";
32 | if (!File.Exists(versionfile))
33 | {
34 | Write("File: " + versionfile + " missing\n");
35 | }
36 |
37 | try
38 | {
39 | foreach (var line in File.ReadAllLines(versionfile))
40 | {
41 | if (line != null)
42 | {
43 | if (!versionSection)
44 | {
45 | if (line.Contains("\"VERSION\""))
46 | versionSection = true;
47 | }
48 | else
49 | {
50 | if (line.Contains("}"))
51 | versionSection = false;
52 | i = line.IndexOf(":");
53 | i2 = line.IndexOf(",");
54 | if (i2 == -1)
55 | i2 = line.Length;
56 | if (i >= 0 && i2 >= 0)
57 | {
58 | s = line.Substring(i + 1, i2 - i - 1);
59 |
60 | if (line.Contains("MAJOR"))
61 | Int32.TryParse(s, out major);
62 |
63 | if (line.Contains("MINOR"))
64 | Int32.TryParse(s, out minor);
65 |
66 | if (line.Contains("PATCH"))
67 | Int32.TryParse(s, out patch);
68 |
69 | if (line.Contains("BUILD"))
70 | Int32.TryParse(s, out build);
71 | }
72 | }
73 | }
74 | }
75 |
76 | }
77 | catch
78 | {
79 | major = 1;
80 | minor = 0;
81 | patch = 0;
82 | build = 0;
83 | }
84 | //Write("File done");
85 |
86 | #>
87 | // This code was generated by a tool. Any changes made manually will be lost
88 | // the next time this code is regenerated.
89 | //
90 |
91 | using System.Reflection;
92 |
93 | [assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
--------------------------------------------------------------------------------
/Source/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Text;
8 | using UnityEngine;
9 |
10 | namespace KRASH
11 | {
12 | // http://forum.kerbalspaceprogram.com/index.php?/topic/147576-modders-notes-for-ksp-12/#comment-2754813
13 | // search for "Mod integration into Stock Settings
14 | public class KRASH_Settings : GameParameters.CustomParameterNode
15 | {
16 | public override string Title { get { return ""; } } // column heading
17 | public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } }
18 | public override string Section { get { return "KRASH"; } }
19 | public override string DisplaySection { get { return "KRASH"; } }
20 | public override int SectionOrder { get { return 1; } }
21 | public override bool HasPresets { get { return false; } }
22 |
23 |
24 | [GameParameters.CustomParameterUI("#KRASH_Settings_Wireframes")] // "Wireframes"
25 | public bool wireframes = false;
26 |
27 | [GameParameters.CustomFloatParameterUI("#KRASH_Settings_defaultAtmoStartingAltitude", minValue = 10000.0f, maxValue = 250000.0f, // "Starting Orbital Altitude (atmo)"
28 | toolTip = "#KRASH_Settings_defaultAtmoStartingAltitude_tooltip")] //"For planets and moons with atmosphere"
29 | public double defaultAtmoStartingAltitude = 75000f;
30 |
31 | [GameParameters.CustomFloatParameterUI("#KRASH_Settings_defaultNoAtmoStartingAltitude", minValue = 1000.0f, maxValue = 250000.0f, //"Starting Orbital Altitude (no atmo)"
32 | toolTip = "#KRASH_Settings_defaultNoAtmoStartingAltitude_tooltip")] // "For planets and moons without any atmosphere"
33 | public double defaultNoAtmoStartingAltitude = 10000f;
34 |
35 |
36 | public float costAdjustment = 1.0f;
37 | [GameParameters.CustomFloatParameterUI("#KRASH_Settings_costAdjustment", minValue = 25f, maxValue = 200.0f, // "Cost Adjustment (%)"
38 | toolTip = "#KRASH_Settings_costAdjustment_tooltip")] // "Adjusts the costs by this value "
39 | public float CostAdj
40 | {
41 | get { return costAdjustment * 100; }
42 | set { costAdjustment = value / 100.0f; }
43 | }
44 | public float CostAdjustment
45 | {
46 | get { return costAdjustment; }
47 | set { costAdjustment = value; }
48 | }
49 |
50 | [GameParameters.CustomParameterUI("#KRASH_Settings_noChargeDuringTimewarp", // "Don't charge during timewarp"
51 | toolTip = "#KRASH_Settings_noChargeDuringTimewarp_tooltip")] // "If enabled, will not charge any funds while timewarping"
52 | public bool noChargeDuringTimewarp = true;
53 |
54 |
55 | public override bool Enabled(MemberInfo member, GameParameters parameters)
56 | {
57 | return true; //otherwise return true
58 | }
59 |
60 | public override bool Interactible(MemberInfo member, GameParameters parameters)
61 | {
62 |
63 | return true;
64 | // return true; //otherwise return true
65 | }
66 |
67 | public override IList ValidValues(MemberInfo member)
68 | {
69 | return null;
70 | }
71 |
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Source/AssemblyVersion.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ import namespace="System.IO" #>
3 | <#@ output extension=".cs" #>
4 |
5 | /* < # @ assembly name="EnvDTE" # > < # / * This assembly provides access to Visual Studio project properties. * / # > */
6 | <#
7 |
8 | // Instructions
9 | // 1. Add a new Text Template to the project
10 | // 2. Copy this file into the new template
11 | // 3. Update the string: versionfile with the complete path to the .version file
12 | // 4. Remove the following line from the file AssemblyInfo.cs (usually located in the "Property" folder inside your C# project):
13 | // [assembly: AssemblyVersion("1.0.0.0")]
14 | // 5. Add the following to the PreBuild steps:
15 | // set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
16 | //
17 | // if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe"
18 | //
19 | // %textTemplatingPath% "$(ProjectDir)AssemblyFileVersion.tt"
20 |
21 | int major = 0;
22 | int minor = 0;
23 | int build = 0;
24 | int patch = 0;
25 | bool versionSection = false;
26 |
27 | int i = 0;
28 | int i2 = 0;
29 | string s;
30 |
31 | // For Visual Studio / MSBuild Build-Time Template Resolution
32 | string RootDirectory = System.IO.Path.GetDirectoryName(Host.TemplateFile) + @"\..\";
33 |
34 | //
35 | // Update the following with the name of the .version file which is in the root directory
36 | //
37 | string versionfile = RootDirectory + "KRASH.version";
38 |
39 | if (!File.Exists(versionfile))
40 | {
41 | Write("File: " + versionfile + " missing\n");
42 | }
43 |
44 | try
45 | {
46 | foreach (var line in File.ReadAllLines(versionfile))
47 | {
48 | if (line != null)
49 | {
50 | if (!versionSection)
51 | {
52 | if (line.Contains("\"VERSION\""))
53 | versionSection = true;
54 | }
55 | else
56 | {
57 | if (line.Contains("}"))
58 | versionSection = false;
59 | i = line.IndexOf(":");
60 | i2 = line.IndexOf(",");
61 | if (i2 == -1)
62 | i2 = line.Length;
63 | if (i >= 0 && i2 >= 0)
64 | {
65 | s = line.Substring(i + 1, i2 - i - 1);
66 |
67 | if (line.Contains("MAJOR"))
68 | Int32.TryParse(s, out major);
69 |
70 | if (line.Contains("MINOR"))
71 | Int32.TryParse(s, out minor);
72 |
73 | if (line.Contains("PATCH"))
74 | Int32.TryParse(s, out patch);
75 |
76 | if (line.Contains("BUILD"))
77 | Int32.TryParse(s, out build);
78 | }
79 | }
80 | }
81 | }
82 |
83 | }
84 | catch
85 | {
86 | major = 1;
87 | minor = 0;
88 | patch = 0;
89 | build = 0;
90 | }
91 | //Write("File done");
92 |
93 | #>
94 | // This code was generated by a tool. Any changes made manually will be lost
95 | // the next time this code is regenerated.
96 | //
97 |
98 | using System.Reflection;
99 |
100 | [assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
101 | [assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
102 |
--------------------------------------------------------------------------------
/Source/InstallChecker.cs.orig:
--------------------------------------------------------------------------------
1 | /**
2 | * Based on the InstallChecker from the Kethane mod for Kerbal Space Program.
3 | * https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs
4 | *
5 | * Original is (C) Copyright Majiir.
6 | * CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/)
7 | * http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895
8 | *
9 | * This file has been modified extensively and is released under the same license.
10 | */
11 | using System;
12 | using System.IO;
13 | using System.Linq;
14 | using System.Reflection;
15 | using UnityEngine;
16 |
17 | namespace KRASH
18 | {
19 | [KSPAddon(KSPAddon.Startup.MainMenu, true)]
20 | internal class InstallChecker : MonoBehaviour
21 | {
22 | private const string MODNAME = "KRASH";
23 | private const string FOLDERNAME = "KRASH";
24 | private const string EXPECTEDPATH = FOLDERNAME + "/Plugins";
25 |
26 | protected void Start()
27 | {
28 | // Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place.
29 | var assemblies = AssemblyLoader.loadedAssemblies.Where(a => a.assembly.GetName().Name == Assembly.GetExecutingAssembly().GetName().Name).Where(a => a.url != EXPECTEDPATH);
30 | if (assemblies.Any())
31 | {
32 | var badPaths = assemblies.Select(a => a.path).Select(p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar)));
33 | PopupDialog.SpawnPopupDialog
34 | (
35 | new Vector2(0.5f, 0.5f),
36 | new Vector2(0.5f, 0.5f),
37 | "test",
38 | "Incorrect " + MODNAME + " Installation",
39 | MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + FOLDERNAME + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()),
40 | "OK",
41 | false,
42 | HighLogic.UISkin
43 | );
44 | Debug.Log("Incorrect " + MODNAME + " Installation: " + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + EXPECTEDPATH + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray())
45 |
46 | );
47 |
48 | }
49 |
50 | //// Check for Module Manager
51 | //if (!AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name.StartsWith("ModuleManager") && a.url == ""))
52 | //{
53 | // PopupDialog.SpawnPopupDialog("Missing Module Manager",
54 | // modName + " requires the Module Manager mod in order to function properly.\n\nPlease download from http://forum.kerbalspaceprogram.com/threads/55219 and copy to the KSP/GameData/ directory.",
55 | // "OK", false, HighLogic.Skin);
56 | //}
57 |
58 | CleanupOldVersions();
59 | }
60 |
61 | /*
62 | * Tries to fix the install if it was installed over the top of a previous version
63 | */
64 | void CleanupOldVersions()
65 | {
66 | try
67 | {
68 | }
69 | catch (Exception ex)
70 | {
71 | Debug.LogError("-ERROR- " + this.GetType().FullName + "[" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.00") + "]: " +
72 | "Exception caught while cleaning up old files.\n" + ex.Message + "\n" + ex.StackTrace);
73 |
74 | }
75 | }
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/Source/View/Core.cs:
--------------------------------------------------------------------------------
1 | // Contents of this file are under the license of the GPL V3, a copy of which is
2 | // included in this directory
3 | // This file included with permission from the Hyperedit project
4 | //
5 | // HyperEdit Created by:
6 | // khyperia (original creator, code)
7 | // Ezriilc (web)
8 | // sirkut (code)
9 | // payo (code [Planet Editor])
10 | // forecaster (graphics, logo)
11 | //
12 |
13 | using System;
14 | using System.Collections.Generic;
15 | using System.Linq;
16 | using UnityEngine;
17 |
18 | namespace KRASH.Hyperedit
19 | {
20 | public delegate bool TryParse(string str, out T value);
21 |
22 | public static class Extensions
23 | {
24 |
25 | // public static void Log(string message)
26 | // {
27 | // Debug.Log("KRASH: " + message);
28 | // }
29 | public static void ErrorPopup(string message)
30 | {
31 | //PopupDialog.SpawnPopupDialog("Error", message, "Close", true, HighLogic.Skin);
32 | PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), "krash1", "Error", message, "Close", true, HighLogic.UISkin);
33 | }
34 | public static void PrepVesselTeleport(this Vessel vessel)
35 | {
36 | Log.Info ("PrepVesselTeleport");
37 | if (vessel.Landed)
38 | {
39 | vessel.Landed = false;
40 | Log.Info("Set ActiveVessel.Landed = false");
41 | }
42 | if (vessel.Splashed)
43 | {
44 | vessel.Splashed = false;
45 | Log.Info("Set ActiveVessel.Splashed = false");
46 | }
47 | if (vessel.landedAt != string.Empty)
48 | {
49 | vessel.landedAt = string.Empty;
50 | Log.Info("Set ActiveVessel.landedAt = \"\"");
51 | }
52 | var parts = vessel.parts;
53 | if (parts != null)
54 | {
55 | int killcount = 0;
56 | foreach (var part in parts.Where(part => part.Modules.OfType().Any()).ToList())
57 | {
58 | killcount++;
59 | part.Die();
60 | }
61 | if (killcount != 0)
62 | {
63 | Log.Info(string.Format("Removed {0} launch clamps from {1}", killcount, vessel.vesselName));
64 | }
65 | }
66 | }
67 | public static double Soi(this CelestialBody body)
68 | {
69 | var radius = body.sphereOfInfluence * 0.95;
70 | if (double.IsNaN(radius) || double.IsInfinity(radius) || radius < 0 || radius > 200000000000)
71 | radius = 200000000000; // jool apo = 72,212,238,387
72 | return radius;
73 | }
74 | public static double Mod(this double x, double y)
75 | {
76 | var result = x % y;
77 | if (result < 0)
78 | result += y;
79 | return result;
80 | }
81 | public static string CbToString(this CelestialBody body)
82 | {
83 | return body.bodyName;
84 | }
85 | public static string OrbitDriverToString(this OrbitDriver driver)
86 | {
87 | if (driver == null)
88 | return null;
89 | if (driver.celestialBody != null)
90 | return driver.celestialBody.bodyName;
91 | if (driver.vessel != null)
92 | return driver.vessel.VesselToString();
93 | if (!string.IsNullOrEmpty(driver.name))
94 | return driver.name;
95 | return "Unknown";
96 | }
97 |
98 | public static string VesselToString(this Vessel vessel)
99 | {
100 | if (FlightGlobals.fetch != null && FlightGlobals.ActiveVessel == vessel)
101 | return "Active vessel";
102 | return vessel.vesselName;
103 | }
104 | public static void ClearGuiFocus()
105 | {
106 | GUIUtility.keyboardControl = 0;
107 | }
108 | private static GUIStyle _pressedButton;
109 |
110 | public static GUIStyle PressedButton
111 | {
112 | get
113 | {
114 | return _pressedButton ?? (_pressedButton = new GUIStyle(HighLogic.Skin.button)
115 | {
116 | normal = HighLogic.Skin.button.active,
117 | hover = HighLogic.Skin.button.active,
118 | active = HighLogic.Skin.button.normal
119 | });
120 | }
121 | }
122 | }
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/Source/wireFrame.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17929
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 | using System;
11 | using System.Collections.Generic;
12 | using UnityEngine;
13 |
14 | #if true
15 | namespace KRASH
16 | {
17 | #if true
18 | public class WireFrame : MonoBehaviour
19 | {
20 |
21 | // Use this for initialization
22 | void Start()
23 | {
24 | }
25 |
26 | // Update is called once per frame
27 | void Update()
28 | {
29 |
30 | }
31 |
32 | void OnPreRender()
33 | {
34 |
35 | GL.wireframe = true;
36 | }
37 |
38 | void OnPostRender()
39 | {
40 | GL.wireframe = false;
41 | }
42 | }
43 |
44 | #else
45 |
46 |
47 |
48 | public class WireFrame : MonoBehaviour
49 | {
50 | private static Material _material;
51 |
52 | public static Material lineMaterial => _material ?? (_material = new Material(Shader.Find("Particles/Alpha Blended")));
53 | public Color lineColor = new Color(0.0f, 1.0f, 0.0f);
54 |
55 | private Mesh toRender;
56 |
57 | void Start()
58 | {
59 | Log.Info("WireFrame.Start");
60 | lineMaterial.hideFlags = HideFlags.HideAndDontSave;
61 | lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
62 |
63 | toRender = new Mesh();
64 | }
65 |
66 | Part p;
67 | void OnRenderObject()
68 | {
69 |
70 | p = GetComponent();
71 | Log.Info("OnRenderObject, part: " + p.partInfo.name);
72 | var mf = p.FindModelComponents();
73 | var smr = p.FindModelComponents();
74 |
75 | Log.Info("OnRenderObject, name: " + this.name);
76 | Log.Info("camera: " + Camera.current.ToString());
77 | //MeshFilter filter = GetComponent();
78 | //if (filter)
79 | foreach (var filter in mf)
80 | {
81 | Log.Info("filter");
82 | DoRender(filter.mesh);
83 | return;
84 | }
85 |
86 | //SkinnedMeshRenderer skinned = GetComponent();
87 | //if (skinned)
88 | foreach (var skinned in smr)
89 | {
90 | Log.Info("skinned");
91 | skinned.BakeMesh(toRender);
92 |
93 | Vector3[] verts = toRender.vertices;
94 |
95 | for (int i = 0; i < verts.Length; i++)
96 | {
97 | float x = verts[i].x;
98 | float y = verts[i].y;
99 | float z = verts[i].z;
100 | verts[i] = new Vector3(x / transform.lossyScale.x, y / transform.lossyScale.y, z / transform.lossyScale.z);
101 | }
102 |
103 | toRender.vertices = verts;
104 |
105 | DoRender(toRender);
106 | }
107 | }
108 |
109 | void DoRender(Mesh mesh)
110 | {
111 | Log.Info("DoRender");
112 |
113 | if (mesh == null ||transform == null || lineMaterial == null)
114 | return;
115 | GL.wireframe = true;
116 |
117 | lineMaterial.color = lineColor;
118 |
119 | lineMaterial.SetPass(0);
120 | try
121 | {
122 | Graphics.DrawMeshNow(mesh, p.partTransform.localToWorldMatrix);
123 | // Graphics.DrawMeshNow(mesh, p.partTransform.position, p.partTransform.rotation);
124 | }
125 | catch (Exception) { }
126 | GL.wireframe = false;
127 | }
128 | }
129 |
130 |
131 | #endif
132 |
133 | }
134 | #endif
--------------------------------------------------------------------------------
/README4Modders.txt:
--------------------------------------------------------------------------------
1 | API Documentation for KRASH
2 |
3 | Include the file KRASHWrapper.cs in your project.
4 | The KRASHWrapper.cs file is provided as-is and is not to be modified other than to update
5 | the namespace. Should further modification be made, no support will be provided by the author,
6 | linuxgurugamer.
7 |
8 | If you wish to use your own logging functions, you can replace the function Infolog with a call
9 | to your functions
10 |
11 | The following functions are available to interface with KRASH:
12 |
13 |
14 | KRASHAvailable returns true or false to indicate whether KRASH is available or not
15 | bool KRASHAvailable
16 |
17 | SetoverrideNode will allow you to override the default node from the KRASH.cfg file. The KRASH.cfg file contains the following nodes:
18 | Easy, Normal, Moderate, Hard, Custom
19 |
20 | You can use ModuleManager to add additional nodes to the file and specify which one you want to use with this funciton
21 |
22 | bool SetOverrideNode(string node)
23 |
24 | doTerminateSim will terminate the simulation
25 | bool doTerminateSim(string msg)
26 |
27 | SetAllCosts will set all the costs, both flat, and per minute. This function actually calls both SetSetupCosts() and SetPerMinCosts(), it is
28 | provided here for convenience
29 | bool SetAllCosts(float flatSetupCost, float perPartSetupCost, float perTonSetupCost, float flatPerMinCost, float perPartPerMinCost, float perTonPerMinCost)
30 |
31 | SetSetupCosts will set the setup costs for the sim
32 | bool SetSetupCosts(float flatSetupCost, float perPartSetupCost, float perTonSetupCost)
33 |
34 | SetPerMinCost will set the costs per minute for the sim
35 | bool SetPerMinCost(float flatPerMinCost, float perPartPerMinCost, float perTonPerMinCost)
36 |
37 | SetFlastCosts will set the flat costs, both setup and per minute
38 | bool SetFlatCosts(float flatSetupCost, float flatPerMinCost)
39 |
40 | SetPerPartCosts will set the per part costs, both setup and per minute
41 | bool SetPerPartCosts(float perPartSetupCost, float perPartPerMinCost)
42 |
43 | SetPerTonCosts will set the per ton costs, both setup and per minute
44 | bool SetPerTonCosts(float perTonSetupCost, float perTonPerMinCost)
45 |
46 | addtoCosts will add the specified amount to the simulation cost
47 | bool AddToCosts(float cost)
48 |
49 | GetCurrentSimcosts will return the current costs of the simulation.
50 | double GetCurrentSimCosts()
51 |
52 | ============================================================================
53 |
54 | The following sets of functions will allow you to add callbacks to KRASH. The
55 | added callbacks will be called when the event happens.
56 |
57 | ******************************************
58 | /* Adds a listener to the Sim Menu Event. When the initial KRASH menu is entered the method will
59 | * be invoked with the Vessel; a double with 0 */
60 | void AddSimMenuEvent (Action method)
61 |
62 | /* Removes a listener from the Sim Menu Event */
63 | void RemoveSimMenuEvent (Action method)
64 |
65 | ******************************************
66 |
67 | /* Adds a listener to the Sim Start Event. When the simulation is started the method will
68 | * be invoked with the Vessel; a double with 0 */
69 | void AddSimStartEvent (Action method)
70 |
71 | /* Removes a listener from the Sim Start Event */
72 | void RemoveSimStartEvent (Action method)
73 |
74 | ******************************************
75 |
76 | /* Adds a listener to the Sim Restart Event. When the simulation is restarted the method will
77 | * be invoked with the Vessel; a double with the cost of the simulation to this point in time */
78 | void AddSimRestartEvent (Action method)
79 |
80 | /* Removes a listener from the Sim Restart Event */
81 | void RemoveSimRestartEvent (Action method)
82 |
83 | ******************************************
84 |
85 | /* Adds a listener to the Sim Termination Event. When the simulation is terminated the method will
86 | * be invoked with the Vessel; a double with the total cost of the simulation */
87 | void AddSimTerminationEvent (Action method)
88 |
89 | /* Removes a listener from the Sim Termination Event */
90 | void RemoveSimTerminationEvent (Action method)
91 |
92 | ******************************************
93 |
94 | /* Adds a listener to the Sim Termination Event. When the simulation is terminated the method will
95 | * be invoked with the Vessel; a double with the total cost of the simulation */
96 | void AddSimTimedEvent (Action method)
97 |
98 | /* Removes a listener from the Sim Termination Event */
99 | void RemoveSimTimedEvent (Action method)
100 |
--------------------------------------------------------------------------------
/GameData/KRASH/README4Modders.txt:
--------------------------------------------------------------------------------
1 | API Documentation for KRASH
2 |
3 | Include the file KRASHWrapper.cs in your project.
4 | The KRASHWrapper.cs file is provided as-is and is not to be modified other than to update
5 | the namespace. Should further modification be made, no support will be provided by the author,
6 | linuxgurugamer.
7 |
8 | If you wish to use your own logging functions, you can replace the function Infolog with a call
9 | to your functions
10 |
11 | The following functions are available to interface with KRASH:
12 |
13 |
14 | KRASHAvailable returns true or false to indicate whether KRASH is available or not
15 | bool KRASHAvailable
16 |
17 | SetoverrideNode will allow you to override the default node from the KRASH.cfg file. The KRASH.cfg file contains the following nodes:
18 | Easy, Normal, Moderate, Hard, Custom
19 |
20 | You can use ModuleManager to add additional nodes to the file and specify which one you want to use with this funciton
21 |
22 | bool SetOverrideNode(string node)
23 |
24 | doTerminateSim will terminate the simulation
25 | bool doTerminateSim(string msg)
26 |
27 | SetAllCosts will set all the costs, both flat, and per minute. This function actually calls both SetSetupCosts() and SetPerMinCosts(), it is
28 | provided here for convenience
29 | bool SetAllCosts(float flatSetupCost, float perPartSetupCost, float perTonSetupCost, float flatPerMinCost, float perPartPerMinCost, float perTonPerMinCost)
30 |
31 | SetSetupCosts will set the setup costs for the sim
32 | bool SetSetupCosts(float flatSetupCost, float perPartSetupCost, float perTonSetupCost)
33 |
34 | SetPerMinCost will set the costs per minute for the sim
35 | bool SetPerMinCost(float flatPerMinCost, float perPartPerMinCost, float perTonPerMinCost)
36 |
37 | SetFlastCosts will set the flat costs, both setup and per minute
38 | bool SetFlatCosts(float flatSetupCost, float flatPerMinCost)
39 |
40 | SetPerPartCosts will set the per part costs, both setup and per minute
41 | bool SetPerPartCosts(float perPartSetupCost, float perPartPerMinCost)
42 |
43 | SetPerTonCosts will set the per ton costs, both setup and per minute
44 | bool SetPerTonCosts(float perTonSetupCost, float perTonPerMinCost)
45 |
46 | addtoCosts will add the specified amount to the simulation cost
47 | bool AddToCosts(float cost)
48 |
49 | GetCurrentSimcosts will return the current costs of the simulation.
50 | double GetCurrentSimCosts()
51 |
52 | ============================================================================
53 |
54 | The following sets of functions will allow you to add callbacks to KRASH. The
55 | added callbacks will be called when the event happens.
56 |
57 | ******************************************
58 | /* Adds a listener to the Sim Menu Event. When the initial KRASH menu is entered the method will
59 | * be invoked with the Vessel; a double with 0 */
60 | void AddSimMenuEvent (Action method)
61 |
62 | /* Removes a listener from the Sim Menu Event */
63 | void RemoveSimMenuEvent (Action method)
64 |
65 | ******************************************
66 |
67 | /* Adds a listener to the Sim Start Event. When the simulation is started the method will
68 | * be invoked with the Vessel; a double with 0 */
69 | void AddSimStartEvent (Action method)
70 |
71 | /* Removes a listener from the Sim Start Event */
72 | void RemoveSimStartEvent (Action method)
73 |
74 | ******************************************
75 |
76 | /* Adds a listener to the Sim Restart Event. When the simulation is restarted the method will
77 | * be invoked with the Vessel; a double with the cost of the simulation to this point in time */
78 | void AddSimRestartEvent (Action method)
79 |
80 | /* Removes a listener from the Sim Restart Event */
81 | void RemoveSimRestartEvent (Action method)
82 |
83 | ******************************************
84 |
85 | /* Adds a listener to the Sim Termination Event. When the simulation is terminated the method will
86 | * be invoked with the Vessel; a double with the total cost of the simulation */
87 | void AddSimTerminationEvent (Action method)
88 |
89 | /* Removes a listener from the Sim Termination Event */
90 | void RemoveSimTerminationEvent (Action method)
91 |
92 | ******************************************
93 |
94 | /* Adds a listener to the Sim Termination Event. When the simulation is terminated the method will
95 | * be invoked with the Vessel; a double with the total cost of the simulation */
96 | void AddSimTimedEvent (Action method)
97 |
98 | /* Removes a listener from the Sim Termination Event */
99 | void RemoveSimTimedEvent (Action method)
100 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 | *.dll
10 | Source/ref/*.*
11 |
12 | !GameData/Fingerboxes/HoloDeck/Plugins/*.*
13 | !GameData/Fingerboxes/Common/Plugins/*.*
14 |
15 | #ignore this
16 |
17 | # User-specific allows
18 | !/GameData/ModuleManager.*.dll
19 |
20 | # Build results
21 | [Dd]ebug/
22 | [Dd]ebugPublic/
23 | [Rr]elease/
24 | [Rr]eleases/
25 | x64/
26 | x86/
27 | build/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 |
32 | # Roslyn cache directories
33 | *.ide/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | #NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 |
84 | # Visual Studio profiler
85 | *.psess
86 | *.vsp
87 | *.vspx
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding addin-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 |
113 | # MightyMoose
114 | *.mm.*
115 | AutoTest.Net/
116 |
117 | # Web workbench (sass)
118 | .sass-cache/
119 |
120 | # Installshield output folder
121 | [Ee]xpress/
122 |
123 | # DocProject is a documentation generator add-in
124 | DocProject/buildhelp/
125 | DocProject/Help/*.HxT
126 | DocProject/Help/*.HxC
127 | DocProject/Help/*.hhc
128 | DocProject/Help/*.hhk
129 | DocProject/Help/*.hhp
130 | DocProject/Help/Html2
131 | DocProject/Help/html
132 |
133 | # Click-Once directory
134 | publish/
135 |
136 | # Publish Web Output
137 | *.[Pp]ublish.xml
138 | *.azurePubxml
139 | # TODO: Comment the next line if you want to checkin your web deploy settings
140 | # but database connection strings (with potential passwords) will be unencrypted
141 | *.pubxml
142 | *.publishproj
143 |
144 | # NuGet Packages
145 | *.nupkg
146 | # The packages folder can be ignored because of Package Restore
147 | **/packages/*
148 | # except build/, which is used as an MSBuild target.
149 | !**/packages/build/
150 | # If using the old MSBuild-Integrated Package Restore, uncomment this:
151 | #!**/packages/repositories.config
152 |
153 | # Windows Azure Build Output
154 | csx/
155 | *.build.csdef
156 |
157 | # Windows Store app package directory
158 | AppPackages/
159 |
160 | # Others
161 | sql/
162 | *.Cache
163 | ClientBin/
164 | [Ss]tyle[Cc]op.*
165 | ~$*
166 | *~
167 | *.dbmdl
168 | *.dbproj.schemaview
169 | *.pfx
170 | *.publishsettings
171 | node_modules/
172 |
173 | # RIA/Silverlight projects
174 | Generated_Code/
175 |
176 | # Backup & report files from converting an old project file
177 | # to a newer Visual Studio version. Backup files are not needed,
178 | # because we have git ;-)
179 | _UpgradeReport_Files/
180 | Backup*/
181 | UpgradeLog*.XML
182 | UpgradeLog*.htm
183 |
184 | # SQL Server files
185 | *.mdf
186 | *.ldf
187 |
188 | # Business Intelligence projects
189 | *.rdl.data
190 | *.bim.layout
191 | *.bim_*.settings
192 |
193 | # Microsoft Fakes
194 | FakesAssemblies/
195 |
196 | # =========================
197 | # Operating System Files
198 | # =========================
199 |
200 | # OSX
201 | # =========================
202 |
203 | .DS_Store
204 | .AppleDouble
205 | .LSOverride
206 |
207 | # Thumbnails
208 | ._*
209 |
210 | # Files that might appear on external disk
211 | .Spotlight-V100
212 | .Trashes
213 |
214 | # Directories potentially created on remote AFP share
215 | .AppleDB
216 | .AppleDesktop
217 | Network Trash Folder
218 | Temporary Items
219 | .apdisk
220 |
221 | # Windows
222 | # =========================
223 |
224 | # Windows image file caches
225 | Thumbs.db
226 | ehthumbs.db
227 |
228 | # Folder config file
229 | Desktop.ini
230 |
231 | # Recycle Bin used on file shares
232 | $RECYCLE.BIN/
233 |
234 | # Windows Installer files
235 | *.cab
236 | *.msi
237 | *.msm
238 | *.msp
239 |
240 | # Windows shortcuts
241 | *.lnk
242 | *.zip
243 | .vs
244 |
--------------------------------------------------------------------------------
/Source/InstallChecker.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Based on the InstallChecker from the Kethane mod for Kerbal Space Program.
3 | * https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs
4 | *
5 | * Original is (C) Copyright Majiir.
6 | * CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/)
7 | * http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895
8 | *
9 | * This file has been modified extensively and is released under the same license.
10 | */
11 | using System;
12 | using System.IO;
13 | using System.Linq;
14 | using System.Reflection;
15 | using UnityEngine;
16 |
17 | namespace KRASH
18 | {
19 | [KSPAddon(KSPAddon.Startup.Instantly, true)]
20 | internal class Startup : MonoBehaviour
21 | {
22 | private void Start()
23 | {
24 | string v = "n/a";
25 | AssemblyTitleAttribute attributes = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false);
26 | string title = attributes?.Title;
27 | if (title == null)
28 | {
29 | title = "TitleNotAvailable";
30 | }
31 | v = Assembly.GetExecutingAssembly().FullName;
32 | if (v == null)
33 | {
34 | v = "VersionNotAvailable";
35 | }
36 | Debug.Log("[" + title + "] Version " + v);
37 | }
38 | }
39 |
40 | [KSPAddon(KSPAddon.Startup.MainMenu, true)]
41 | internal class InstallChecker : MonoBehaviour
42 | {
43 | private const string MODNAME = "KRASH";
44 | private const string FOLDERNAME = "KRASH";
45 | private const string EXPECTEDPATH = FOLDERNAME + "/Plugins";
46 |
47 | protected void Start()
48 | {
49 | // Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place.
50 | var assemblies = AssemblyLoader.loadedAssemblies.Where(a => a.assembly.GetName().Name == Assembly.GetExecutingAssembly().GetName().Name).Where(a => a.url != EXPECTEDPATH);
51 | if (assemblies.Any())
52 | {
53 | var badPaths = assemblies.Select(a => a.path).Select(p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar)));
54 | PopupDialog.SpawnPopupDialog
55 | (
56 | new Vector2(0.5f, 0.5f),
57 | new Vector2(0.5f, 0.5f),
58 | "test",
59 | "Incorrect " + MODNAME + " Installation",
60 | MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + FOLDERNAME + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()),
61 | "OK",
62 | false,
63 | HighLogic.UISkin
64 | );
65 | Debug.Log("Incorrect " + MODNAME + " Installation: " + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + EXPECTEDPATH + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray())
66 |
67 | );
68 |
69 | }
70 |
71 | //// Check for Module Manager
72 | //if (!AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name.StartsWith("ModuleManager") && a.url == ""))
73 | //{
74 | // PopupDialog.SpawnPopupDialog("Missing Module Manager",
75 | // modName + " requires the Module Manager mod in order to function properly.\n\nPlease download from http://forum.kerbalspaceprogram.com/threads/55219 and copy to the KSP/GameData/ directory.",
76 | // "OK", false, HighLogic.Skin);
77 | //}
78 |
79 | CleanupOldVersions();
80 | }
81 |
82 | /*
83 | * Tries to fix the install if it was installed over the top of a previous version
84 | */
85 | void CleanupOldVersions()
86 | {
87 | try
88 | {
89 | }
90 | catch (Exception ex)
91 | {
92 | Debug.LogError("-ERROR- " + this.GetType().FullName + "[" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.00") + "]: " +
93 | "Exception caught while cleaning up old files.\n" + ex.Message + "\n" + ex.StackTrace);
94 |
95 | }
96 | }
97 | }
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/GameData/KRASH/Localization/zh-cn.cfg:
--------------------------------------------------------------------------------
1 | Localization
2 | {
3 | zh-cn
4 | {
5 | #KRASH_ConfigWindow_title = KRASH 配置窗口
6 | #KRASH_SelectedCFG = 选择Cfg
7 | #KRASH_NotCareer = 配置无法应用到沙盒或科研模式
8 | #KRASH_ConfigName = 配置名称:
9 | #KRASH_ConfigNameNotGood = <-----> 需要重新命名
10 |
11 | #KRASH_Button_Save = 保存
12 | #KRASH_Button_Accept = 接受
13 | #KRASH_Button_Reset = 重置
14 | #KRASH_Button_Cancel = 取消
15 | #KRASH_Button_Delete = 删除
16 | #KRASH_Button_OrbitSelection = 轨道选择
17 | #KRASH_Button_Landed = 地面
18 | #KRASH_Button_All = 全部
19 | #KRASH_Button_Planets = 行星
20 | #KRASH_Button_Moons = 卫星
21 | #KRASH_Button_StartSimulation = 开始模拟
22 | #KRASH_Button_DisableTestFlight = 关闭TestFlight
23 | #KRASH_Button_DisableTestLite = 关闭TestLite
24 | #KRASH_Button_Select = 选择
25 | #KRASH_Button_Set = 设置
26 | #KRASH_Button_ResumeSimulation = 恢复模拟
27 | #KRASH_Button_TerminateSimulation = 终止模拟
28 | #KRASH_Button_RestartSimulation = 重新模拟
29 | #KRASH_Button_Settings = 设置
30 |
31 | #KRASH_CostOptions = 成本设置
32 | #KRASH_FlatSetupCosts = 起步固定花费:
33 | #KRASH_FlatPer_minuteCosts = 每分钟花费:
34 | #KRASH_PerpartSetupCosts = Per-part Setup Costs:
35 | #KRASH_PerpartPerminuteCosts = Per-part Per-minute Costs:
36 | #KRASH_PertonSetupCosts = Per-ton Setup Costs:
37 | #KRASH_PertonPerminuteCosts = Per-ton Per-minute Costs:
38 | #KRASH_PercentageSetupCosts = Percentage Setup Costs:
39 | #KRASH_PercentagePerminuteCosts = 每分钟花费比例:
40 | #KRASH_AtmosphericMultiplier = 大气系数:
41 | #KRASH_TerminationOptions = 终止选项(无数据)
42 | #KRASH_TerminateatSoi = 切换引力范围后终止
43 | #KRASH_TerminateatLand = 到达地面后终止
44 | #KRASH_TerminateatAtmo = 到达大气后终止
45 | #KRASH_MiscellaneousOptionsGlobal = 杂项(全局)
46 | #KRASH_Continuesimifnocash = 资金不足时继续模拟
47 | #KRASH_Obeylaunchpadlimits = 遵循发射台限制规则
48 | #KRASH_DefaultMaxSimCost = 默认最大模拟成本:
49 | #KRASH_ShowRunningSimCosts = 显示运行模拟成本
50 | #KRASH_Showallbodiesincareer = 生涯模式显示所有天体
51 | #KRASH_HorizontalPosition = 水平位置:
52 | #KRASH_VerticalPosition = 垂直位置:
53 | #KRASH_LaunchSiteSelector_title = 发射位置选择
54 | #KRASH_SimulateInfo_ReachlaunchMassLimit1 = 航天器过重:<<1>>t
55 | #KRASH_SimulateInfo_ReachlaunchMassLimit2 = 重量限制:<<1>>t
56 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide1 = 航天器过宽:\n<<1>>m x<<2>>m
57 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide2 = 宽度限制:<<1>>m
58 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall1 = 航天器过高:\n<<1>>m
59 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall2 = 高度限制:<<1>>m
60 | #KRASH_SimulateInfo_ReachPartLimit1 = 部件过多:<<1>>
61 | #KRASH_SimulateInfo_ReachPartLimit2 = 部件限制:<<1>>
62 | #KRASH_SimulateInfo_NoFundsToSim = 资金不足以模拟
63 | #KRASH_SimulateInfo_LockedParts = 航天器拥有锁定部件
64 | #KRASH_SimulateInfo_VesselNotControllable = 航天器不可控
65 | #KRASH_SimulateInfo_SimCostexceedslimit = 模拟成本超出限制
66 | #KRASH_VesselUnlaunchableReasons = 航天器因下列原因不可控:
67 | #KRASH_SimulationSettings = 模拟设定
68 | #KRASH_StartLocation = 起始位置:
69 | #KRASH_Launchpad = 发射台
70 | #KRASH_Runway = 跑道
71 | #KRASH_Altitude = 高度:
72 | #KRASH_Latitude = 纬度:
73 | #KRASH_Longitude = 经度:
74 | #KRASH_PartCount = 部件数量:
75 | #KRASH_DryMass = 干质量:
76 | #KRASH_FuelMass = 燃料质量:
77 | #KRASH_TotalMass = 总质量:
78 | #KRASH_SimulationCosts = 模拟成本:
79 | #KRASH_SimSetupCost = 模拟设置成本:
80 | #KRASH_EstSimMinCost = 模拟每分钟花费:
81 | #KRASH_EstAtmoSimMinCost = 大气中模拟每分钟花费:
82 | #KRASH_LimitMaxCosts = 最大成本限制
83 | #KRASH_Limit = 限制:
84 | #KRASH_PauseAfterVesselLanded = 航天器已着陆,点击 OK 继续
85 | #KRASH_GamePaused = 游戏暂停
86 | #KRASH_SpaceplaneHangar = 飞行器机库
87 | #KRASH_VehicleAssemblyBuilding = 航天器组装大楼
88 | #KRASH_SpaceCenter = 太空中心
89 | #KRASH_PreSimulation = 预模拟
90 | #KRASH_RevertToTarget = 退回到 <<1>>
91 | #KRASH_RevertToLaunch = 退回到起始发射(<<1>> 之前
92 | #KRASH_TerminatingSimulation_Msg = 终止将使游戏返回到先前的状态。是否确实要继续?
93 | #KRASH_TerminatingSimulation_title = 终止模拟
94 | #KRASH_RevertingSimulation_Msg = 退回将使游戏恢复到以前的状态。是否确实要继续?
95 | #KRASH_RevertingSimulation_title = 退回模拟
96 | #KRASH_SimulationActive = 模拟运行中
97 | #KRASH_SimulationEnded = 模拟结束!
98 | #KRASH_SimulationResult = 模拟结果!
99 | #KRASH_SimulationTitle = 模拟成本:
100 |
101 | // Settings
102 | #KRASH_Settings_Wireframes = 线框渲染模式
103 | #KRASH_Settings_defaultAtmoStartingAltitude = 起始轨道高度(大气)
104 | #KRASH_Settings_defaultAtmoStartingAltitude_tooltip = 对于有大气层的行星和卫星
105 | #KRASH_Settings_defaultNoAtmoStartingAltitude = 起始轨道高度(无大气)
106 | #KRASH_Settings_defaultNoAtmoStartingAltitude_tooltip = 对于无大气层的行星和卫星
107 | #KRASH_Settings_costAdjustment = 成本调整(%)
108 | #KRASH_Settings_costAdjustment_tooltip = 调整成本值
109 | #KRASH_Settings_noChargeDuringTimewarp = 不要在时间加速期间充电
110 | #KRASH_Settings_noChargeDuringTimewarp_tooltip = 如果启用,将不会在时间加速时花费任何资金
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/Source/KRASH - 1.3.1.csproj.173:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;KRASH;RP_1_131
21 | prompt
22 | 4
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | bin\Release\
32 | TRACE;KRASH;RP_1_131
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 | True
49 | AssemblyVersion-1.3.1.tt
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
79 |
80 |
81 |
82 | LICENSE.md
83 |
84 |
85 | README.md
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | False
96 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll
97 |
98 |
99 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\System.dll
100 |
101 |
102 | False
103 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll
104 |
105 |
106 | False
107 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll
108 |
109 |
110 |
111 |
112 | TextTemplatingFileGenerator
113 | AssemblyVersion-1.3.1.cs
114 |
115 |
116 |
117 |
118 | start /D D:\Users\jbb\github\KRASH/WAIT deploy-1.3.1.bat $(TargetDir) $(TargetFileName)
119 |
120 |
121 |
122 | if $(ConfigurationName) == Release (
123 |
124 |
125 | start /D D:\Users\jbb\github\KRASH/WAIT buildRelease-1.3.1.bat $(TargetDir) $(TargetFileName)
126 |
127 |
128 | )
129 |
130 |
131 |
132 | set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe"
133 |
134 |
135 |
136 | %25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion-1.3.1.tt"
137 |
138 |
--------------------------------------------------------------------------------
/Source/KRASH - 1.3.1.csproj.orig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;KRASH;RP_1_131
21 | prompt
22 | 4
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | bin\Release\
32 | TRACE;KRASH;RP_1_131
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 | True
49 | AssemblyVersion-1.3.1.tt
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
79 |
80 |
81 |
82 | LICENSE.md
83 |
84 |
85 | README.md
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | False
96 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll
97 |
98 |
99 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\System.dll
100 |
101 |
102 | False
103 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll
104 |
105 |
106 | False
107 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll
108 |
109 |
110 |
111 |
112 | TextTemplatingFileGenerator
113 | AssemblyVersion-1.3.1.cs
114 |
115 |
116 |
117 |
118 | start /D D:\Users\jbb\github\KRASH/WAIT deploy-1.3.1.bat $(TargetDir) $(TargetFileName)
119 |
120 |
121 |
122 | if $(ConfigurationName) == Release (
123 |
124 |
125 | start /D D:\Users\jbb\github\KRASH/WAIT buildRelease-1.3.1.bat $(TargetDir) $(TargetFileName)
126 |
127 |
128 | )
129 |
130 |
131 |
132 | set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe"
133 |
134 |
135 |
136 | %25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion-1.3.1.tt"
137 |
138 |
--------------------------------------------------------------------------------
/Source/KRASH.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8C5539DD-396B-4084-892E-8F1901E51584}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v4.8
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | TRACE;DEBUG;KRASH
22 | prompt
23 | 4
24 | false
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | true
33 | bin\Release\
34 | TRACE;KRASH
35 | prompt
36 | 4
37 | false
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | True
51 | True
52 | AssemblyVersion.tt
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
84 |
85 |
86 |
87 | LICENSE.md
88 |
89 |
90 | README.md
91 |
92 |
93 |
94 |
95 |
96 |
97 | TextTemplatingFileGenerator
98 | AssemblyVersion.cs
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | False
107 |
108 |
109 | False
110 |
111 |
112 |
113 | $(KSPDIR)\GameData\000_ClickThroughBlocker\Plugins\ClickThroughBlocker.dll
114 |
115 |
116 |
117 | $(KSPDIR)\GameData\001_ToolbarControl\Plugins\ToolbarControl.dll
118 |
119 |
120 |
121 |
122 | set KSPDIR=$(KSPDIR)
123 |
124 | IF "%25KSPDIR%25"=="" (
125 |
126 | ECHO Configuration error - KSPDIR not specified in project.
127 |
128 | ECHO Either set KSPDIR environment variable or edit BetterLoadSaveGame.Common.props
129 |
130 | PAUSE
131 |
132 | GOTO DONE
133 |
134 | )
135 |
136 | start /D $(SolutionDir) /WAIT deploy.bat $(TargetDir) $(TargetFileName)
137 |
138 | if $(ConfigurationName) == Release (
139 |
140 | start /D $(SolutionDir) /WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
141 |
142 | )
143 |
144 |
145 |
146 |
147 | "$(DevEnvDir)\texttransform.exe" "$(ProjectDir)AssemblyVersion.tt"
148 |
149 |
--------------------------------------------------------------------------------
/GameData/KRASH/Localization/en-us.cfg:
--------------------------------------------------------------------------------
1 | Localization
2 | {
3 | en-us
4 | {
5 | #KRASH_ConfigWindow_title = KRASH Config Window
6 | #KRASH_SelectedCFG = Selected Cfg
7 | #KRASH_NotCareer = Configs don't apply to Sandbox or Science games
8 | #KRASH_ConfigName = Config name:
9 | #KRASH_ConfigNameNotGood = <-----> Must be renamed to save
10 |
11 | #KRASH_Button_Save = Save
12 | #KRASH_Button_Accept = Accept
13 | #KRASH_Button_Reset = Reset
14 | #KRASH_Button_Cancel = Cancel
15 | #KRASH_Button_Delete = Delete
16 | #KRASH_Button_OrbitSelection = Orbit selection
17 | #KRASH_Button_Landed = Landed
18 | #KRASH_Button_All = All
19 | #KRASH_Button_Planets = Planets
20 | #KRASH_Button_Moons = Moons
21 | #KRASH_Button_StartSimulation = Start simulation
22 | #KRASH_Button_DisableTestFlight = Disable TestFlight
23 | #KRASH_Button_DisableTestLite = Disable TestLite
24 | #KRASH_Button_Select = Select
25 | #KRASH_Button_Set = Set
26 | #KRASH_Button_ResumeSimulation = Resume Simulation
27 | #KRASH_Button_TerminateSimulation = Terminate Simulation
28 | #KRASH_Button_RestartSimulation = Restart Simulation
29 | #KRASH_Button_Settings = Settings
30 |
31 | #KRASH_CostOptions = Cost Options
32 | #KRASH_FlatSetupCosts = Flat Setup Costs:
33 | #KRASH_FlatPer_minuteCosts = Flat Per-minute Costs:
34 | #KRASH_PerpartSetupCosts = Per-part Setup Costs:
35 | #KRASH_PerpartPerminuteCosts = Per-part Per-minute Costs:
36 | #KRASH_PertonSetupCosts = Per-ton Setup Costs:
37 | #KRASH_PertonPerminuteCosts = Per-ton Per-minute Costs:
38 | #KRASH_PercentageSetupCosts = Percentage Setup Costs:
39 | #KRASH_PercentagePerminuteCosts = Percentage Per-minute Costs:
40 | #KRASH_AtmosphericMultiplier = Atmospheric Multiplier:
41 | #KRASH_TerminationOptions = Termination Options (no data)
42 | #KRASH_TerminateatSoi = Terminate at Soi
43 | #KRASH_TerminateatLand = Terminate at Land
44 | #KRASH_TerminateatAtmo = Terminate at Atmo
45 | #KRASH_MiscellaneousOptionsGlobal = Miscellaneous Options (global)
46 | #KRASH_Continuesimifnocash = Continue sim if no cash
47 | #KRASH_Obeylaunchpadlimits = Obey launch pad limits
48 | #KRASH_DefaultMaxSimCost = Default Max Sim Cost:
49 | #KRASH_ShowRunningSimCosts = Show Running Sim Costs
50 | #KRASH_Showallbodiesincareer = Show all bodies in career
51 | #KRASH_HorizontalPosition = Horizontal Position:
52 | #KRASH_VerticalPosition = Vertical Position:
53 | #KRASH_LaunchSiteSelector_title = Launch Site Selector
54 | #KRASH_SimulateInfo_ReachlaunchMassLimit1 = Vessel too heavy: <<1>>t
55 | #KRASH_SimulateInfo_ReachlaunchMassLimit2 = Weight limit: <<1>>t
56 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide1 = Vessel too wide: \n<<1>>m x<<2>>m
57 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide2 = Width limit: <<1>>m
58 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall1 = Vessel too tall: \n<<1>>m
59 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall2 = Height limit: <<1>>m
60 | #KRASH_SimulateInfo_ReachPartLimit1 = Too many parts: <<1>>
61 | #KRASH_SimulateInfo_ReachPartLimit2 = Part limit: <<1>>
62 | #KRASH_SimulateInfo_NoFundsToSim = Not enough money to start sim
63 | #KRASH_SimulateInfo_LockedParts = Vessel has locked parts
64 | #KRASH_SimulateInfo_VesselNotControllable = Vessel is not controllable
65 | #KRASH_SimulateInfo_SimCostexceedslimit = Sim cost exceeds limit
66 | #KRASH_VesselUnlaunchableReasons = Vessel Unlaunchable for following reason(s):
67 | #KRASH_SimulationSettings = Simulation Settings
68 | #KRASH_StartLocation = Start location:
69 | #KRASH_Launchpad = Launchpad
70 | #KRASH_Runway = Runway
71 | #KRASH_Altitude = Altitude:
72 | #KRASH_Latitude = Latitude:
73 | #KRASH_Longitude = Longitude:
74 | #KRASH_PartCount = Part count:
75 | #KRASH_DryMass = Dry Mass:
76 | #KRASH_FuelMass = Fuel Mass:
77 | #KRASH_TotalMass = Total Mass:
78 | #KRASH_SimulationCosts = Simulation Costs:
79 | #KRASH_SimSetupCost = Sim setup cost:
80 | #KRASH_EstSimMinCost = Est. Sim/min cost:
81 | #KRASH_EstAtmoSimMinCost = Est. Atmo Sim/min cost:
82 | #KRASH_LimitMaxCosts = Limit max costs
83 | #KRASH_Limit = Limit:
84 | #KRASH_PauseAfterVesselLanded = Vessel has landed. Click the OK button to continue
85 | #KRASH_GamePaused = Game Paused
86 | #KRASH_SpaceplaneHangar = Spaceplane Hangar
87 | #KRASH_VehicleAssemblyBuilding = Vehicle Assembly Building
88 | #KRASH_SpaceCenter = Space Center
89 | #KRASH_PreSimulation = Pre-Simulation
90 | #KRASH_RevertToTarget = Revert to <<1>>
91 | #KRASH_RevertToLaunch = Revert to Launch(<<1>> ago
92 | #KRASH_TerminatingSimulation_Msg = Terminating will set the game back to an earlier state. Are you sure you want to continue?
93 | #KRASH_TerminatingSimulation_title = Terminating Simulation
94 | #KRASH_RevertingSimulation_Msg = Reverting will set the game back to an earlier state. Are you sure you want to continue?
95 | #KRASH_RevertingSimulation_title = Reverting Simulation
96 | #KRASH_SimulationActive = Simulation Active
97 | #KRASH_SimulationEnded = Simulation ended!
98 | #KRASH_SimulationResult = Simulation results!
99 | #KRASH_SimulationTitle = Sim Costs:
100 |
101 | // Settings
102 | #KRASH_Settings_Wireframes = Wireframes
103 | #KRASH_Settings_defaultAtmoStartingAltitude = Starting Orbital Altitude (atmo)
104 | #KRASH_Settings_defaultAtmoStartingAltitude_tooltip = For planets and moons with atmosphere
105 | #KRASH_Settings_defaultNoAtmoStartingAltitude = Starting Orbital Altitude (no atmo)
106 | #KRASH_Settings_defaultNoAtmoStartingAltitude_tooltip = For planets and moons without any atmosphere
107 | #KRASH_Settings_costAdjustment = Cost Adjustment (%)
108 | #KRASH_Settings_costAdjustment_tooltip = Adjusts the costs by this value
109 | #KRASH_Settings_noChargeDuringTimewarp = Don't charge during timewarp
110 | #KRASH_Settings_noChargeDuringTimewarp_tooltip = If enabled, will not charge any funds while timewarping
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/Source/KRASH - 1.3.1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {87B8D2BE-7BC3-4712-9816-084DAAFD24A1}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;KRASH;RP_1_131
21 | prompt
22 | 4
23 | false
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | true
32 | bin\Release\
33 | TRACE;KRASH;RP_1_131
34 | prompt
35 | 4
36 | false
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | True
50 | True
51 | AssemblyVersion-1.3.1.tt
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
81 |
82 |
83 |
84 | LICENSE.md
85 |
86 |
87 | README.md
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | False
98 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll
99 |
100 |
101 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\System.dll
102 |
103 |
104 | False
105 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll
106 |
107 |
108 | False
109 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll
110 |
111 |
112 |
113 |
114 | TextTemplatingFileGenerator
115 | AssemblyVersion-1.3.1.cs
116 |
117 |
118 |
119 |
120 | start /D D:\Users\jbb\github\KRASH/WAIT deploy-1.3.1.bat $(TargetDir) $(TargetFileName)
121 |
122 |
123 |
124 | if $(ConfigurationName) == Release (
125 |
126 |
127 | start /D D:\Users\jbb\github\KRASH/WAIT buildRelease-1.3.1.bat $(TargetDir) $(TargetFileName)
128 |
129 |
130 | )
131 |
132 |
133 |
134 | set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe"
135 |
136 |
137 |
138 | %25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion-1.3.1.tt"
139 |
140 |
141 |
--------------------------------------------------------------------------------
/Source/APIManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using UnityEngine;
6 | using KSP;
7 |
8 | #if true
9 | namespace KRASH
10 | {
11 |
12 | public class APIManager:MonoBehaviour
13 | {
14 |
15 | //This is the actual instance. It gets instantiated when someone calls for it, below.
16 | private static APIManager apiInstance = null;
17 | //This is the public reference to the instance. Nobody else can change the instance, it's read only.
18 | public static APIManager ApiInstance {
19 | //get and set let you get the value or set the value. Providing only one (here: get) makes it read only or write only.
20 | get {
21 | Log.Info ("ApiInstance called");
22 | //If the instance is null we make a new one
23 | if (apiInstance == null)
24 | apiInstance = new APIManager ();
25 | //Then we return the instance
26 | return apiInstance;
27 | }
28 | }
29 |
30 |
31 | #if true
32 | public SimAPI simAPI = new SimAPI();
33 |
34 | public class SimAPI
35 | {
36 | public void SetOverrideNode(string node)
37 | {
38 | Log.Info ("SetoverrideNode: " + node);
39 | KRASHShelter.instance.cfg.setOverrideNode (node);
40 | }
41 |
42 | public void TerminateSim(string msg)
43 | {
44 | Log.Info ("TerminateSim called");
45 | KRASHShelter.instance.simPauseMenuInstance.DisplayTerminationMessage (msg);
46 | }
47 | public void TerminateSimNoDialog()
48 | {
49 | SimulationPauseMenu.instance.TerminateSimNoDialog();
50 |
51 | }
52 |
53 | public void SetSetupCosts(float flatSetupCost, float perPartSetupCost, float perTonSetupCost)
54 | {
55 | Log.Info ("APIManager.SetSetupCosts: flatSetupCost: "+ flatSetupCost.ToString() + " perPartSetupCost: " + perPartSetupCost.ToString() + " perTonSetupCost: " + perTonSetupCost.ToString());
56 | KRASHShelter.instance.cfg.flatSetupCost = flatSetupCost;
57 | KRASHShelter.instance.cfg.perPartSetupCost = perPartSetupCost;
58 | KRASHShelter.instance.cfg.perTonSetupCost = perTonSetupCost;
59 | }
60 |
61 | public void SetPerMinCost(float flatPerMinCost, float perPartPerMinCost, float perTonPerMinCost)
62 | {
63 | Log.Info ("APIManager.SetPerMinCost: flatPerMinCost: " + flatPerMinCost.ToString () + " perPartPerMinCost: " + perPartPerMinCost.ToString () + " perTonPerMinCost: " + perTonPerMinCost.ToString ());
64 | KRASHShelter.instance.cfg.flatPerMinCost = flatPerMinCost;
65 | KRASHShelter.instance.cfg.perPartPerMinCost = perPartPerMinCost;
66 | KRASHShelter.instance.cfg.perTonPerMinCost = perTonPerMinCost;
67 | }
68 |
69 | public void SetFlatCosts(float flatSetupCost, float flatPerMinCost)
70 | {
71 | Log.Info ("APIManager.SetFlatCosts: flatSetupCost: " + flatSetupCost.ToString() + " flatPerMinCost: " + flatPerMinCost.ToString());
72 | KRASHShelter.instance.cfg.flatSetupCost = flatSetupCost;
73 | KRASHShelter.instance.cfg.flatPerMinCost = flatPerMinCost;
74 | }
75 |
76 | public void SetPerPartCosts(float perPartSetupCost, float perPartPerMinCost)
77 | {
78 | Log.Info ("APIManager.SetPerPartCosts: perPartSetupCost: " + perPartSetupCost.ToString() + " perPartPerMinCost: " + perPartPerMinCost.ToString());
79 | KRASHShelter.instance.cfg.perPartSetupCost = perPartSetupCost;
80 | KRASHShelter.instance.cfg.perPartPerMinCost = perPartPerMinCost;
81 | }
82 |
83 | public void SetPercentCosts(float percentSetupCost, float percentPerMinCost)
84 | {
85 | Log.Info ("APIManager.percentSetupCost: percentSetupCost: " + percentSetupCost.ToString() + " percentPerMinCost: " + percentPerMinCost.ToString());
86 | KRASHShelter.instance.cfg.percentSetupCost = percentSetupCost;
87 | KRASHShelter.instance.cfg.percentPerMinCost = percentPerMinCost;
88 | }
89 |
90 | public void SetPerTonCosts(float perTonSetupCost, float perTonPerMinCost)
91 | {
92 | Log.Info ("APIManager.SetPerTonCosts: perTonSetupCost: " + perTonSetupCost.ToString() + " perTonPerMinCost: " + perTonPerMinCost.ToString());
93 | KRASHShelter.instance.cfg.perTonSetupCost = perTonSetupCost;
94 | KRASHShelter.instance.cfg.perTonPerMinCost = perTonPerMinCost;
95 | }
96 |
97 | public double getCurrentSimCosts()
98 | {
99 | Log.Info ("APIManager.getCurrentSimCosts");
100 | return KRASHShelter.simCost + KRASHShelter.simSetupCost;
101 | }
102 | public void addToCosts(float cost)
103 | {
104 | Log.Info ("APIManager.addToCosts");
105 | KRASHShelter.simCost += cost;
106 | }
107 |
108 | public bool simulationActive()
109 | {
110 | return KRASHShelter.instance.simPauseMenuInstance.SimStarted();
111 | }
112 | }
113 | #endif
114 |
115 | public SimEvent SimMenuEvent = new SimEvent ();
116 | public SimEvent SimStartEvent = new SimEvent ();
117 | public SimEvent SimRestartEvent = new SimEvent ();
118 | public SimEvent SimTerminationEvent = new SimEvent ();
119 |
120 | //The SimEvent class is used by all events. It basically just lets you add a listening method to the event, remove one, or fire all the events.
121 | public class SimEvent
122 | {
123 | //This is the list of methods that should be activated when the event fires
124 | private List> listeningMethods = new List> ();
125 |
126 | //This adds an event to the List of listening methods
127 | public void Add (Action method)
128 | {
129 | //We only add it if it isn't already added. Just in case.
130 | Log.Info("SimEvent.Add");
131 | if (!listeningMethods.Contains (method))
132 | listeningMethods.Add (method);
133 | }
134 |
135 | //This removes and event from the List
136 | public void Remove (Action method)
137 | {
138 | //We also only remove it if it's actually in the list.
139 | if (listeningMethods.Contains (method))
140 | listeningMethods.Remove (method);
141 | }
142 |
143 | //This fires the event off, activating all the listening methods.
144 | public void Fire (Vessel vessel, double cost)
145 | {
146 | //Loop through the list of listening methods and Invoke them.
147 | Log.Info("listeningMethods.count: " + listeningMethods.Count());
148 | foreach (Action method in listeningMethods) {
149 | Log.Info ("method.Invoke");
150 | method.Invoke (vessel, cost);
151 | }
152 | }
153 | }
154 | }
155 |
156 |
157 | }
158 | #endif
--------------------------------------------------------------------------------
/GameData/KRASH/Localization/ru.cfg:
--------------------------------------------------------------------------------
1 | Localization
2 | {
3 | ru
4 | {
5 | #KRASH_ConfigWindow_title = Настройка KRASH
6 | #KRASH_SelectedCFG = Выбранная конфигурация
7 | #KRASH_NotCareer = Настройки не используются в режимах "Песочница" или "Наука" //Configs don't apply to Sandbox or Science games
8 | #KRASH_ConfigName = Файл настройки: //Config name:
9 | #KRASH_ConfigNameNotGood = <-----> Неправильное имя файла //<-----> Must be renamed to save
10 |
11 | #KRASH_Button_Save = Сохранить
12 | #KRASH_Button_Accept = ОК
13 | #KRASH_Button_Reset = Сброс
14 | #KRASH_Button_Cancel = Отмена
15 | #KRASH_Button_Delete = Удалить
16 | #KRASH_Button_OrbitSelection = Орбита
17 | #KRASH_Button_Landed = Посадка
18 | #KRASH_Button_All = Всё
19 | #KRASH_Button_Planets = Планеты
20 | #KRASH_Button_Moons = Луны
21 | #KRASH_Button_StartSimulation = Запуск симуляции
22 | #KRASH_Button_DisableTestFlight = Отмен. полёта
23 | #KRASH_Button_DisableTestLite = Отмен. упрощ. теста
24 | #KRASH_Button_Select = Выбирать
25 | #KRASH_Button_Set = Установить
26 | #KRASH_Button_ResumeSimulation = Продолжить симуляцию
27 | #KRASH_Button_TerminateSimulation = Закончить симуляцию
28 | #KRASH_Button_RestartSimulation = Повторить симуляцию
29 | #KRASH_Button_Settings = Настройки
30 |
31 | #KRASH_CostOptions = Настройки затрат:
32 | #KRASH_FlatSetupCosts = Начальные затраты:
33 | #KRASH_FlatPer_minuteCosts = Затраты за минуту:
34 | #KRASH_PerpartSetupCosts = Затраты за каждую деталь:
35 | #KRASH_PerpartPerminuteCosts = Затраты за каждую деталь за минуту:
36 | #KRASH_PertonSetupCosts = Начальные затраты за тонну:
37 | #KRASH_PertonPerminuteCosts = Затраты за тонну за минуту:
38 | #KRASH_PercentageSetupCosts = Начальные затраты (%):
39 | #KRASH_PercentagePerminuteCosts = Затраты за минуту (%):
40 | #KRASH_AtmosphericMultiplier = Учёт атмосферы:
41 | #KRASH_TerminationOptions = Параметры завершения
42 | #KRASH_TerminateatSoi = Закончить в сфере притяжения
43 | #KRASH_TerminateatLand = Закончить на поверхности
44 | #KRASH_TerminateatAtmo = Закончить в атмосфере
45 | #KRASH_MiscellaneousOptionsGlobal = Различные опции (глобальные)
46 | #KRASH_Continuesimifnocash = Продолж. при отсут. денег
47 | #KRASH_Obeylaunchpadlimits = Ограничение затрат
48 | #KRASH_DefaultMaxSimCost = Макс. затраты по умолч.:
49 | #KRASH_ShowRunningSimCosts = Показывать затраты
50 | #KRASH_Showallbodiesincareer = Показать все планеты
51 | #KRASH_HorizontalPosition = Горизонт. позиция:
52 | #KRASH_VerticalPosition = Вертикал. позиция:
53 | #KRASH_LaunchSiteSelector_title = Выбор места симуляции
54 | #KRASH_SimulateInfo_ReachlaunchMassLimit1 = Корабль слишком тяжёл: <<1>>т
55 | #KRASH_SimulateInfo_ReachlaunchMassLimit2 = Предел веса: <<1>>т
56 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide1 = Корабль слишком широк: \n<<1>>м x<<2>>м
57 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide2 = Предел ширины: <<1>>м
58 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall1 = Корабль слишком высок: \n<<1>>м
59 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall2 = Предел высоты: <<1>>м
60 | #KRASH_SimulateInfo_ReachPartLimit1 = Слишком много деталей: <<1>>
61 | #KRASH_SimulateInfo_ReachPartLimit2 = Предел деталей: <<1>>
62 | #KRASH_SimulateInfo_NoFundsToSim = Недостаточно средств для симуляции
63 | #KRASH_SimulateInfo_LockedParts = Обнаружены заблокированные детали
64 | #KRASH_SimulateInfo_VesselNotControllable = Корабль неуправляем
65 | #KRASH_SimulateInfo_SimCostexceedslimit = Затраты превышают лимит
66 | #KRASH_VesselUnlaunchableReasons = Симуляция не начнётся из-за:
67 | #KRASH_SimulationSettings = Установки
68 | #KRASH_StartLocation = Место запуска:
69 | #KRASH_Launchpad = Стартовая площадка
70 | #KRASH_Runway = Взлётно-посадочная полоса
71 | #KRASH_Altitude = Высота:
72 | #KRASH_Latitude = Широта:
73 | #KRASH_Longitude = Долгота:
74 | #KRASH_PartCount = Всего деталей:
75 | #KRASH_DryMass = Сухая масса:
76 | #KRASH_FuelMass = Масса топлива:
77 | #KRASH_TotalMass = Общая масса:
78 | #KRASH_SimulationCosts = Затраты на симуляцию:
79 | #KRASH_SimSetupCost = Начальные затраты:
80 | #KRASH_EstSimMinCost = Затраты за минуту:
81 | #KRASH_EstAtmoSimMinCost = Затраты за минуту в атм.:
82 | #KRASH_LimitMaxCosts = Ограничение затрат
83 | #KRASH_Limit = Не более:
84 | #KRASH_PauseAfterVesselLanded = Приземление. Нажать "ОК" для продолжения
85 | #KRASH_GamePaused = Пауза
86 | #KRASH_SpaceplaneHangar = Авиакосмический ангар
87 | #KRASH_VehicleAssemblyBuilding = Цех вертикальной сборки
88 | #KRASH_SpaceCenter = Центр управления полётами
89 | #KRASH_PreSimulation = Предварительная симуляция
90 | #KRASH_RevertToTarget = Вернуться к <<1>>
91 | #KRASH_RevertToLaunch = Вернуться к старту (<<1>> назад
92 | #KRASH_TerminatingSimulation_Msg = После завершения симуляции вы вернетесь к предыдущему состоянию. Продолжить?
93 | #KRASH_TerminatingSimulation_title = Завершение симуляции
94 | #KRASH_RevertingSimulation_Msg = При возврате игра вернётся к раннему состоянию. Продолжить?
95 | #KRASH_RevertingSimulation_title = Возврат
96 | #KRASH_SimulationActive = Симуляция активна
97 | #KRASH_SimulationEnded = Симуляция окончена!
98 | #KRASH_SimulationResult = Результаты симуляции!
99 | #KRASH_SimulationTitle = Затраты:
100 |
101 | // Settings
102 | #KRASH_Settings_Wireframes = Графические объекты отображаются в виде каркасов
103 | #KRASH_Settings_defaultAtmoStartingAltitude = Начальная высота (с атмосферой)
104 | #KRASH_Settings_defaultAtmoStartingAltitude_tooltip = Для планет и лун с атмосферой
105 | #KRASH_Settings_defaultNoAtmoStartingAltitude = Начальная высота (без атмосферы)
106 | #KRASH_Settings_defaultNoAtmoStartingAltitude_tooltip = Для планет и лун без атмосферы
107 | #KRASH_Settings_costAdjustment = Корректировка затрат (%)
108 | #KRASH_Settings_costAdjustment_tooltip = Корректировка затрат
109 | #KRASH_Settings_noChargeDuringTimewarp = Не менять при ускорении времени
110 | #KRASH_Settings_noChargeDuringTimewarp_tooltip = Не менять затраты при ускорении времени
111 | }
112 | }
--------------------------------------------------------------------------------
/Source/KRASH.csproj.173:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8C5539DD-396B-4084-892E-8F1901E51584}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;KRASH
21 | prompt
22 | 4
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | bin\Release\
32 | TRACE;KRASH
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 | True
49 | AssemblyVersion.tt
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
80 |
81 |
82 |
83 | LICENSE.md
84 |
85 |
86 | README.md
87 |
88 |
89 |
90 |
91 |
92 |
93 | TextTemplatingFileGenerator
94 | AssemblyVersion.cs
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | False
103 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll
104 |
105 |
106 | R:\KSP_1.7.3_dev\GameData\000_ClickThroughBlocker\Plugins\ClickThroughBlocker.dll
107 |
108 |
109 |
110 | R:\KSP_1.7.3_dev\GameData\001_ToolbarControl\Plugins\ToolbarControl.dll
111 |
112 |
113 | False
114 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.dll
115 |
116 |
117 | False
118 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll
119 |
120 |
121 |
122 |
d:\Users\jbb\github\pdb2mdb.exe $(TargetPath)
123 |
124 |
125 |
126 |
127 |
128 |
129 | start /D D:\Users\jbb\github\KRASH/WAIT deploy.bat $(TargetDir) $(TargetFileName)
130 |
131 |
132 |
133 |
134 |
135 | if $(ConfigurationName) == Release (
136 |
137 |
138 |
139 |
140 | start /D D:\Users\jbb\github\KRASH/WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
141 |
142 |
143 |
144 |
145 | )
146 |
147 |
148 |
149 | set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe"
150 |
151 |
152 |
153 |
154 |
155 | %25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt"
156 |
157 |
--------------------------------------------------------------------------------
/Source/KRASH.csproj.orig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8C5539DD-396B-4084-892E-8F1901E51584}
8 | Library
9 | Properties
10 | KRASH
11 | KRASH
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;KRASH
21 | prompt
22 | 4
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | bin\Release\
32 | TRACE;KRASH
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 | True
49 | AssemblyVersion.tt
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
80 |
81 |
82 |
83 | LICENSE.md
84 |
85 |
86 | README.md
87 |
88 |
89 |
90 |
91 |
92 |
93 | TextTemplatingFileGenerator
94 | AssemblyVersion.cs
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | False
103 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll
104 |
105 |
106 | R:\KSP_1.7.3_dev\GameData\000_ClickThroughBlocker\Plugins\ClickThroughBlocker.dll
107 |
108 |
109 |
110 | R:\KSP_1.7.3_dev\GameData\001_ToolbarControl\Plugins\ToolbarControl.dll
111 |
112 |
113 | False
114 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.dll
115 |
116 |
117 | False
118 | R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll
119 |
120 |
121 |
122 |
d:\Users\jbb\github\pdb2mdb.exe $(TargetPath)
123 |
124 |
125 |
126 |
127 |
128 |
129 | start /D D:\Users\jbb\github\KRASH/WAIT deploy.bat $(TargetDir) $(TargetFileName)
130 |
131 |
132 |
133 |
134 |
135 | if $(ConfigurationName) == Release (
136 |
137 |
138 |
139 |
140 | start /D D:\Users\jbb\github\KRASH/WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
141 |
142 |
143 |
144 |
145 | )
146 |
147 |
148 |
149 | set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe"
150 |
151 |
152 |
153 |
154 |
155 | %25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt"
156 |
157 |
--------------------------------------------------------------------------------
/GameData/KRASH/Localization/de-de.cfg:
--------------------------------------------------------------------------------
1 | Localization
2 | {
3 | de-de
4 | {
5 | #KRASH_ConfigWindow_title = KRASH Konfiguration Fenster
6 | #KRASH_SelectedCFG = Ausgewählte Konfiguration
7 | #KRASH_NotCareer = Konfigurationen wirken nicht auf Sandbox oder Wissenschaft welten
8 | #KRASH_ConfigName = Konfiguration name:
9 | #KRASH_ConfigNameNotGood = <-----> Muss umbenannt werden um es zu speichern
10 |
11 | #KRASH_Button_Save = Speichern
12 | #KRASH_Button_Accept = Annehmen
13 | #KRASH_Button_Reset = Zurücksetzen
14 | #KRASH_Button_Cancel = Abrechen
15 | #KRASH_Button_Delete = Löschen
16 | #KRASH_Button_OrbitSelection = Umlaufbahn auswahl
17 | #KRASH_Button_Landed = Gelandet
18 | #KRASH_Button_All = Alle
19 | #KRASH_Button_Planets = Planeten
20 | #KRASH_Button_Moons = Monde
21 | #KRASH_Button_StartSimulation = Simulation starten
22 | #KRASH_Button_DisableTestFlight = TestFlight ausmachen
23 | #KRASH_Button_DisableTestLite = TestLite ausmachen
24 | #KRASH_Button_Select = Auswählen
25 | #KRASH_Button_Set = Setzen
26 | #KRASH_Button_ResumeSimulation = Simulation fortsetzen
27 | #KRASH_Button_TerminateSimulation = Simulation abbrechen
28 | #KRASH_Button_RestartSimulation = Simluation neustarten
29 | #KRASH_Button_Settings = Einstellungen
30 |
31 | #KRASH_CostOptions = Kostenoptionen
32 | #KRASH_FlatSetupCosts = Feste Einrichtungskosten:
33 | #KRASH_FlatPer_minuteCosts = Feste Kosten pro Minute:
34 | #KRASH_PerpartSetupCosts = Einrichtungskosten pro Teil:
35 | #KRASH_PerpartPerminuteCosts = Kosten pro Teil und Minute:
36 | #KRASH_PertonSetupCosts = Einrichtungskosten pro Tonne:
37 | #KRASH_PertonPerminuteCosts = Kosten pro Tonne und Minute:
38 | #KRASH_PercentageSetupCosts = Einrichtungskosten (prozentual):
39 | #KRASH_PercentagePerminuteCosts = Kosten pro Minute (prozentual):
40 | #KRASH_AtmosphericMultiplier = Atmosphären-Multiplikator:
41 | #KRASH_TerminationOptions = Beenden optionen
42 | #KRASH_TerminateatSoi = Abbrechen bei Eintritt in Sphäre des Einflusses
43 | #KRASH_TerminateatLand = Abbrechen bei Landung
44 | #KRASH_TerminateatAtmo = Abbrechen beim Eintritt in Atmosphäre
45 | #KRASH_MiscellaneousOptionsGlobal = Verschiedene Optionen (global)
46 | #KRASH_Continuesimifnocash = Simulation fortsetzen ohne Geld
47 | #KRASH_Obeylaunchpadlimits = Startrampenlimits beachten
48 | #KRASH_DefaultMaxSimCost = Max. Standardkosten für Simulation:
49 | #KRASH_ShowRunningSimCosts = Laufende Simulationskosten anzeigen
50 | #KRASH_Showallbodiesincareer = Alle Himmelskörper in Karriere anzeigen
51 | #KRASH_HorizontalPosition = Horizontale Position:
52 | #KRASH_VerticalPosition = Vertikale Position:
53 | #KRASH_LaunchSiteSelector_title = Startplatz-Auswahl
54 | #KRASH_SimulateInfo_ReachlaunchMassLimit1 = Rakete zu schwer: <<1>>t
55 | #KRASH_SimulateInfo_ReachlaunchMassLimit2 = Gewichtsgrenze: <<1>>t
56 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide1 = Rakete zu breit: \n<<1>>m x <<2>>m
57 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooWide2 = Breitenlimit: <<1>>m
58 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall1 = Rakete zu hoch: \n<<1>>m
59 | #KRASH_SimulateInfo_ReachlaunchSizeLimit_TooTall2 = Höhenlimit: <<1>>m
60 | #KRASH_SimulateInfo_ReachPartLimit1 = Zu viele Teile: <<1>>
61 | #KRASH_SimulateInfo_ReachPartLimit2 = Teillimit: <<1>>
62 | #KRASH_SimulateInfo_NoFundsToSim = Nicht genug Geld für Simulation
63 | #KRASH_SimulateInfo_LockedParts = Rakete enthält gesperrte Teile
64 | #KRASH_SimulateInfo_VesselNotControllable = Rakete nicht steuerbar
65 | #KRASH_SimulateInfo_SimCostexceedslimit = Simulationskosten überschreiten Limit
66 | #KRASH_VesselUnlaunchableReasons = Rakete nicht startbereit aus folgendem Grund:
67 | #KRASH_SimulationSettings = Simulationseinstellungen
68 | #KRASH_StartLocation = Startort:
69 | #KRASH_Launchpad = Startrampe
70 | #KRASH_Runway = Landebahn
71 | #KRASH_Altitude = Höhe:
72 | #KRASH_Latitude = Breitengrad:
73 | #KRASH_Longitude = Längengrad:
74 | #KRASH_PartCount = Anzahl der Teile:
75 | #KRASH_DryMass = Trockengewicht:
76 | #KRASH_FuelMass = Treibstoffmasse:
77 | #KRASH_TotalMass = Gesamtmasse:
78 | #KRASH_SimulationCosts = Simulationskosten:
79 | #KRASH_SimSetupCost = Einrichtungskosten der Simulation:
80 | #KRASH_EstSimMinCost = Geschätzte Kosten pro Simulationsminute:
81 | #KRASH_EstAtmoSimMinCost = Geschätzte Kosten pro Minute (mit Atmosphäre):
82 | #KRASH_LimitMaxCosts = Maximale Kosten begrenzen
83 | #KRASH_Limit = Limit:
84 | #KRASH_PauseAfterVesselLanded = Rakete ist gelandet. Klicke auf „OK“, um fortzufahren.
85 | #KRASH_GamePaused = Spiel pausiert
86 | #KRASH_SpaceplaneHangar = Flugzeug Hangar (SPH)
87 | #KRASH_VehicleAssemblyBuilding = Racketen Hangar (VAB)
88 | #KRASH_SpaceCenter = Raumfahrtzentrum
89 | #KRASH_PreSimulation = Vorbereitungssimulation
90 | #KRASH_RevertToTarget = Zurückkehren zu <<1>>
91 | #KRASH_RevertToLaunch = Zurück zum Start (vor <<1>>)
92 | #KRASH_TerminatingSimulation_Msg = Durch Abbrechen wird das Spiel auf einen früheren Stand zurückgesetzt. Bist du sicher, dass du fortfahren willst?
93 | #KRASH_TerminatingSimulation_title = Simulation abbrechen
94 | #KRASH_RevertingSimulation_Msg = Durch das Zurücksetzen wird das Spiel auf einen früheren Stand zurückgesetzt. Bist du sicher, dass du fortfahren willst?
95 | #KRASH_RevertingSimulation_title = Simulation zurücksetzen
96 | #KRASH_SimulationActive = Simulation läuft
97 | #KRASH_SimulationEnded = Simulation beendet!
98 | #KRASH_SimulationResult = Simulationsergebnisse!
99 | #KRASH_SimulationTitle = Simulationskosten:
100 |
101 | // Settings
102 | #KRASH_Settings_Wireframes = Drahtgitteransicht
103 | #KRASH_Settings_defaultAtmoStartingAltitude = Start Höhe (mit Atmosphäre)
104 | #KRASH_Settings_defaultAtmoStartingAltitude_tooltip = Für Planeten und Monde mit Atmosphäre
105 | #KRASH_Settings_defaultNoAtmoStartingAltitude = Start Höhe (ohne Atmosphäre)
106 | #KRASH_Settings_defaultNoAtmoStartingAltitude_tooltip = Für Planeten und Monde ohne Atmosphäre
107 | #KRASH_Settings_costAdjustment = Kostenanpassung (%)
108 | #KRASH_Settings_costAdjustment_tooltip = Passt die Kosten um diesen Wert an
109 | #KRASH_Settings_noChargeDuringTimewarp = Keine Kosten im Zeitraffer
110 | #KRASH_Settings_noChargeDuringTimewarp_tooltip = Wenn aktiviert, entstehen im Zeitraffer keine Kosten
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # KRASH
2 | KRASH - Kerbal Ramification Artifical Simulation Hub (simulation mod for KSP)
3 |
4 | This mod includes version checking using MiniAVC (http://forum.kerbalspaceprogram.com/threads/79745)
5 | If you opt-in, it will use the internet to check whether there is a new version available. Data is only
6 | read from the internet and no personal information is sent. For a more comprehensive version checking
7 | experience, please download the full KSP-AVC plugin (http://forum.kerbalspaceprogram.com/threads/79745">KSP-AVC Plugin)
8 |
9 | KRASH lets you launch flights from the VAB\SPH, and when the flight is over, it restores the game to the exact state that
10 | it was in before the simulation started. It handles restoring the state of any mod which stores its data in the vanilla
11 | persistence file (basically any of them worth their salt), and even handles it if you exit the game during a simulation.
12 |
13 | Instructions
14 |
15 | Configurations
16 |
17 | There are 10 pre-defined configurations:
18 |
19 | Easy Fairly low costs. There are setup costs and per-minute costs, both for the number of parts and weight of the vessel
20 | Normal Reasonable costs
21 | Moderate Somewhat more expensive
22 | Hard Even more expensive
23 | Easy-Percentage Same as easy, except that instead of using the number of parts and weight, it uses a percentage of the cost of the vessel for the setup costs, and then a smaller percentage for each minute
24 | Normal-Percentage
25 | Moderate-Percentage
26 | Hard-Percentage
27 |
28 | For both type listed above, there is also a Custom setting
29 |
30 | In addition, you can create a customized config. See the following image for the configuration screen:
31 |
32 | In the left column is a list of the available configs to use. An asterick indicates one of the predefined settings and can't be changed. Click on
33 | the setting you would like to see, the values will be shown on the right side
34 |
35 | On the right half, the top shows the config name and the buttons:
36 | Save Active only when the name doesn't begin with an asterick. Will save the current config and make it active
37 | Accept Accepts the current config as the active config for the current game
38 | Reset Resets change to the current config
39 | Cancel Cancels the changes and closes the screen
40 | Delete Active only when name refers to existing custom config. Will delete that config
41 |
42 | In the right half, there are two columns; The left column shows the costs for the different
43 | types: Flat, Per-part, Per-ton and Percentage, along with the Atmospheric Multipler
44 |
45 | The right colum has the following:
46 |
47 | Termination options if no data at the specified location(ie: Terminate at SOI, if you enter an SOI
48 | and haven't received any science data from it, the sim will terminate)
49 |
50 | Miscellaneous Options. The max sim cost is merely a default, and can be overridden when you start the sim
51 |
52 | Note that the configuration window can be shown both in the Spacecenter view and in the editor, whether you are in
53 | a career game or not. The costs will only apply if you are in a career game.
54 |
55 |
56 | In the VAB/SPH, load the ship you want to simulate
57 | Click the SIM button, you will see the following screen:
58 | 
59 |
60 | The buttons at the top select the starting location, and are as follows:
61 |
62 | Kerbin - The homeworld of the game. If you are running a mod which changes the homeworld, it will be shown here
63 | Landed - Start sim landed on any planetary body
64 | Orbit Selection - Start sim in an orbit around any planetary body
65 |
66 | In career mode, if you haven't reached a planetary body, you won't be able to start the sim there
67 |
68 | Starting sim at Kerbin
69 | You will be able to start the sim either at the Runway or the Launchpad. Selected which one you want,see this screen:
70 | 
71 |
72 | Starting sim Landed
73 | There is a row of buttons which will allow you to filter the displayed planetary bodies by either planets, moons, or all.
74 | Select the planetary body you want to start the sim at from the displayed list. Also,
75 | enter an altitude where the vessel should be started at. You can also enter the Latitude
76 | and Longitude for the starting location. It will start there, and very
77 | slowly descend until it touches the ground. See the following screen for details:
78 | 
79 |
80 | Starting sim in Orbit
81 | There is a row of buttons which will allow you to filter the displayed planetary bodies by either planets, moons, or all.
82 | Select the planetary body you want to start the sim at from the displayed list. Also,
83 | enter an altitude where the vessel should be started at. Note that when you select a body, the
84 | altitude will be automatically adjusted to be just outside the atmosphere if it has one, or
85 | at an altitude of 10000m. You can override it with whatever values you want.
86 | 
87 |
88 | Click the big green button to start the simulation
89 |
90 | IMPORTANT NOTE: If you are running RemoteTech, be sure that ALL your antennas are set to start retracted,
91 | otherwise they will be ripped off during the teleportation process.
92 |
93 | During the simulation, everything works normally, except you can't go to the Space Center. Hitting the Escape key
94 | will bring up the Simulation menu, see the following screenshot:
95 | 
96 |
97 | At this menu, you can either restart the simulation, or terminate the simulation and return to the editor.
98 |
99 | In the event of either a game crash during the simulation, or exiting the program, restarting the game will restore
100 | the game to the point just before you started the simulation.
101 |
102 | When the simulation is terminated, you will see the usual flight history dialog before the final revert.
103 |
104 | When playing in career mode, there is some additional functionality:
105 |
106 | 1. Simulations now cost money (ie: computer time = money). The cost of the simulation
107 | consists of several parts: A flat cost, a per-part cost and a per-ton cost. These costs
108 | are calculated for an initial setup cost, and a per-minute cost. The costs for the simulation
109 | differs based on the level of game you are playing. Easy, Normal, Moderate, Hard and Custom.
110 | The costs are defined in the KRASH.cfg file, and can be changed if desired
111 | The estimated simulation costs are shown while you are setting up the simulation in the
112 | lower right-hand column.
113 | You can also enter an upper limit for the simulation costs. When the simulation costs equal
114 | the specified limit, the simulation will end.
115 |
116 | 2. Simulations will terminate if one of the following situations happens:
117 |
118 | Simulation terminated due to lack of funds
119 | Simulation terminated due to cost limit reached
120 | Simulation terminated due to lack of science data
121 | Simulation terminated due to entering unknown SOI
122 | Simulation terminated due to landing on unknown body
123 | Simulation terminated due to vessel destruction
--------------------------------------------------------------------------------
/GameData/KRASH/README.md:
--------------------------------------------------------------------------------
1 | # KRASH
2 | KRASH - Kerbal Ramification Artifical Simulation Hub (simulation mod for KSP)
3 |
4 | This mod includes version checking using MiniAVC (http://forum.kerbalspaceprogram.com/threads/79745)
5 | If you opt-in, it will use the internet to check whether there is a new version available. Data is only
6 | read from the internet and no personal information is sent. For a more comprehensive version checking
7 | experience, please download the full KSP-AVC plugin (http://forum.kerbalspaceprogram.com/threads/79745">KSP-AVC Plugin)
8 |
9 | KRASH lets you launch flights from the VAB\SPH, and when the flight is over, it restores the game to the exact state that
10 | it was in before the simulation started. It handles restoring the state of any mod which stores its data in the vanilla
11 | persistence file (basically any of them worth their salt), and even handles it if you exit the game during a simulation.
12 |
13 | Instructions
14 |
15 | Configurations
16 |
17 | There are 10 pre-defined configurations:
18 |
19 | Easy Fairly low costs. There are setup costs and per-minute costs, both for the number of parts and weight of the vessel
20 | Normal Reasonable costs
21 | Moderate Somewhat more expensive
22 | Hard Even more expensive
23 | Easy-Percentage Same as easy, except that instead of using the number of parts and weight, it uses a percentage of the cost of the vessel for the setup costs, and then a smaller percentage for each minute
24 | Normal-Percentage
25 | Moderate-Percentage
26 | Hard-Percentage
27 |
28 | For both type listed above, there is also a Custom setting
29 |
30 | In addition, you can create a customized config. See the following image for the configuration screen:
31 |
32 | In the left column is a list of the available configs to use. An asterick indicates one of the predefined settings and can't be changed. Click on
33 | the setting you would like to see, the values will be shown on the right side
34 |
35 | On the right half, the top shows the config name and the buttons:
36 | Save Active only when the name doesn't begin with an asterick. Will save the current config and make it active
37 | Accept Accepts the current config as the active config for the current game
38 | Reset Resets change to the current config
39 | Cancel Cancels the changes and closes the screen
40 | Delete Active only when name refers to existing custom config. Will delete that config
41 |
42 | In the right half, there are two columns; The left column shows the costs for the different
43 | types: Flat, Per-part, Per-ton and Percentage, along with the Atmospheric Multipler
44 |
45 | The right colum has the following:
46 |
47 | Termination options if no data at the specified location(ie: Terminate at SOI, if you enter an SOI
48 | and haven't received any science data from it, the sim will terminate)
49 |
50 | Miscellaneous Options. The max sim cost is merely a default, and can be overridden when you start the sim
51 |
52 | Note that the configuration window can be shown both in the Spacecenter view and in the editor, whether you are in
53 | a career game or not. The costs will only apply if you are in a career game.
54 |
55 |
56 | In the VAB/SPH, load the ship you want to simulate
57 | Click the SIM button, you will see the following screen:
58 | 
59 |
60 | The buttons at the top select the starting location, and are as follows:
61 |
62 | Kerbin - The homeworld of the game. If you are running a mod which changes the homeworld, it will be shown here
63 | Landed - Start sim landed on any planetary body
64 | Orbit Selection - Start sim in an orbit around any planetary body
65 |
66 | In career mode, if you haven't reached a planetary body, you won't be able to start the sim there
67 |
68 | Starting sim at Kerbin
69 | You will be able to start the sim either at the Runway or the Launchpad. Selected which one you want,see this screen:
70 | 
71 |
72 | Starting sim Landed
73 | There is a row of buttons which will allow you to filter the displayed planetary bodies by either planets, moons, or all.
74 | Select the planetary body you want to start the sim at from the displayed list. Also,
75 | enter an altitude where the vessel should be started at. You can also enter the Latitude
76 | and Longitude for the starting location. It will start there, and very
77 | slowly descend until it touches the ground. See the following screen for details:
78 | 
79 |
80 | Starting sim in Orbit
81 | There is a row of buttons which will allow you to filter the displayed planetary bodies by either planets, moons, or all.
82 | Select the planetary body you want to start the sim at from the displayed list. Also,
83 | enter an altitude where the vessel should be started at. Note that when you select a body, the
84 | altitude will be automatically adjusted to be just outside the atmosphere if it has one, or
85 | at an altitude of 10000m. You can override it with whatever values you want.
86 | 
87 |
88 | Click the big green button to start the simulation
89 |
90 | IMPORTANT NOTE: If you are running RemoteTech, be sure that ALL your antennas are set to start retracted,
91 | otherwise they will be ripped off during the teleportation process.
92 |
93 | During the simulation, everything works normally, except you can't go to the Space Center. Hitting the Escape key
94 | will bring up the Simulation menu, see the following screenshot:
95 | 
96 |
97 | At this menu, you can either restart the simulation, or terminate the simulation and return to the editor.
98 |
99 | In the event of either a game crash during the simulation, or exiting the program, restarting the game will restore
100 | the game to the point just before you started the simulation.
101 |
102 | When the simulation is terminated, you will see the usual flight history dialog before the final revert.
103 |
104 | When playing in career mode, there is some additional functionality:
105 |
106 | 1. Simulations now cost money (ie: computer time = money). The cost of the simulation
107 | consists of several parts: A flat cost, a per-part cost and a per-ton cost. These costs
108 | are calculated for an initial setup cost, and a per-minute cost. The costs for the simulation
109 | differs based on the level of game you are playing. Easy, Normal, Moderate, Hard and Custom.
110 | The costs are defined in the KRASH.cfg file, and can be changed if desired
111 | The estimated simulation costs are shown while you are setting up the simulation in the
112 | lower right-hand column.
113 | You can also enter an upper limit for the simulation costs. When the simulation costs equal
114 | the specified limit, the simulation will end.
115 |
116 | 2. Simulations will terminate if one of the following situations happens:
117 |
118 | Simulation terminated due to lack of funds
119 | Simulation terminated due to cost limit reached
120 | Simulation terminated due to lack of science data
121 | Simulation terminated due to entering unknown SOI
122 | Simulation terminated due to landing on unknown body
123 | Simulation terminated due to vessel destruction
--------------------------------------------------------------------------------
/GameData/KRASH/PluginData/KRASH.cfg:
--------------------------------------------------------------------------------
1 | // This file is not modified by the game, so that all the comments stay
2 | // There is a second cfg file, called: KRASHCustom.cfg, which will hold custom and
3 | // user-defined settings
4 | //
5 | KRASH
6 | {
7 | // Defaults here, nodes below override the defaults
8 |
9 | description = Default settings
10 |
11 | // simulation costs consist of two parts: The initial
12 | // setup cost, and the cost over time
13 |
14 | // Inside that, there are costs based on the number of parts,
15 | // and the weight of the vessel. Also, there is a base cost
16 | // which is irrespective of parts or weight.
17 |
18 | // The flat costs are the basic cost of the simulation.
19 | // These are fixed costs, nothig affects them.
20 |
21 | flatSetupCost = 100
22 | flatPerMinCost = 10
23 |
24 | // These two control the costs based on the
25 | // number of parts in the vessel
26 |
27 | perPartSetupCost = 2
28 | perPartPerMinCost 2
29 |
30 | // The following two are the costs based on the
31 | // weight of the vessel. During flight, as fuel is burned,
32 | // the mass decreases and so does the costs based on the
33 | // mass
34 |
35 | perTonSetupCost = 30
36 | perTonPerMinCost = 3
37 |
38 | // These two control the costs based on the
39 | // initial cost of the vessel (percentage 0-100)
40 |
41 | percentSetupCost = 10
42 | percentPerMinCost = 1
43 |
44 | // This is a multiplier which is applied while a vessel is in the atmosphere
45 | // It represents the additional computing costs of atmospheric flight. This
46 | // cannot be less than 1, if it is, then 1 will be used instead.
47 | AtmoPerMinMultipler = 1
48 |
49 | // The following are true/false values, and are
50 | // fairly self-explanatory
51 |
52 | ContinueIfNoCash = true
53 |
54 | // The following settings will terminate the simulation if the specified situation occurs:
55 | // TerminateAtSoiWithoutData: Upon entering an SOI without any science data from either in orbit or landed
56 | // TerminateAtLandWithoutData: Upon landing on a body without any prior science data
57 | // TerminateAtAtmoWithoutData: Upon entering an atmosphere without any prior science data
58 |
59 | TerminateAtSoiWithoutData = false
60 | TerminateAtLandWithoutData = false
61 | TerminateAtAtmoWithoutData = false
62 |
63 | // The DefaultMaxAllowableSimCost puts an upper limit on the cost of a simulation
64 | // When the simulation cost exceeds this, the simulation is terminated
65 | // If 0, there is no upper limit on the cost
66 |
67 | DefaultMaxAllowableSimCost = 0
68 |
69 | // When calculating the MaxAllowableSimCost, calculate for a default number of minutes
70 |
71 | DefaultSimTime = 15
72 |
73 |
74 | //
75 | // The following sections are values for each mode of play (easy, normal, moderate, hard, custom)
76 | //
77 | // This can be modified with ModuleManager, or additional sections can be added and loaded by other mods
78 | //
79 | Easy
80 | {
81 | description = Standard costs for Easy mode
82 |
83 | flatSetupCost = 100
84 | flatPerMinCost = 10
85 |
86 | perPartSetupCost = 1
87 | perPartPerMinCost 1
88 |
89 | perTonSetupCost = 1
90 | perTonPerMinCost = 1
91 |
92 | percentSetupCost = 0
93 | percentPerMinCost = 0
94 |
95 | AtmoPerMinMultipler = 1
96 | }
97 | Normal
98 | {
99 | description = Standard costs for Normal mode
100 |
101 | flatSetupCost = 150
102 | flatPerMinCost = 15
103 |
104 | perPartSetupCost = 1.5
105 | perPartPerMinCost 1.5
106 |
107 | perTonSetupCost = 1.5
108 | perTonPerMinCost = 1.5
109 |
110 | percentSetupCost = 0
111 | percentPerMinCost = 0
112 |
113 | AtmoPerMinMultipler = 1.5
114 | }
115 | Moderate
116 | {
117 | description = Standard costs for Moderate mode
118 |
119 | flatSetupCost = 200
120 | flatPerMinCost = 20
121 |
122 | perPartSetupCost = 2
123 | perPartPerMinCost 2
124 |
125 | perTonSetupCost = 2
126 | perTonPerMinCost = 2
127 |
128 | percentSetupCost = 0
129 | percentPerMinCost = 0
130 |
131 | AtmoPerMinMultipler = 2
132 | }
133 | Hard
134 | {
135 | description = Standard costs for Hard mode
136 |
137 | flatSetupCost = 300
138 | flatPerMinCost = 30
139 |
140 | perPartSetupCost = 3
141 | perPartPerMinCost 3
142 |
143 | perTonSetupCost = 3
144 | perTonPerMinCost = 3
145 |
146 | percentSetupCost = 0
147 | percentPerMinCost = 0
148 |
149 | AtmoPerMinMultipler = 5
150 |
151 | TerminateAtSoiWithoutData = true
152 | TerminateAtLandWithoutData = true
153 | TerminateAtAtmoWithoutData = true
154 | }
155 | Custom
156 | {
157 | description = Standard costs for Custom mode
158 |
159 | flatSetupCost = 300
160 | flatPerMinCost = 30
161 |
162 | perPartSetupCost = 3
163 | perPartPerMinCost 3
164 |
165 | perTonSetupCost = 3
166 | perTonPerMinCost = 3
167 |
168 | percentSetupCost = 1
169 | percentPerMinCost = 1
170 |
171 | AtmoPerMinMultipler = 1
172 |
173 | TerminateAtSoiWithoutData = true
174 | TerminateAtLandWithoutData = true
175 | TerminateAtAtmoWithoutData = true
176 | ContinueIfNoCash = false
177 | }
178 |
179 | Easy-%
180 | {
181 | description = Percentage costs for Easy mode
182 |
183 | flatSetupCost = 0
184 | flatPerMinCost = 0
185 |
186 | perPartSetupCost = 0
187 | perPartPerMinCost 0
188 |
189 | perTonSetupCost = 0
190 | perTonPerMinCost = 0
191 |
192 | percentSetupCost = 5
193 | percentPerMinCost = 0.5
194 |
195 | AtmoPerMinMultipler = 1
196 | }
197 | Normal-%
198 | {
199 | description = Percentage costs for Normal mode
200 |
201 | flatSetupCost = 0
202 | flatPerMinCost = 0
203 |
204 | perPartSetupCost = 0
205 | perPartPerMinCost 0
206 |
207 | perTonSetupCost = 0
208 | perTonPerMinCost = 0
209 |
210 | percentSetupCost = 10
211 | percentPerMinCost = 1
212 |
213 | AtmoPerMinMultipler = 1.5
214 | }
215 | Moderate-%
216 | {
217 | description = Percentage costs for Moderate mode
218 |
219 | flatSetupCost = 0
220 | flatPerMinCost = 0
221 |
222 | perPartSetupCost = 0
223 | perPartPerMinCost 0
224 |
225 | perTonSetupCost = 0
226 | perTonPerMinCost = 0
227 |
228 | percentSetupCost = 15
229 | percentPerMinCost = 1.5
230 |
231 | AtmoPerMinMultipler = 2
232 | }
233 | Hard-%
234 | {
235 | description = Percentage costs for Hard mode
236 |
237 | flatSetupCost = 0
238 | flatPerMinCost = 0
239 |
240 | perPartSetupCost = 0
241 | perPartPerMinCost 0
242 |
243 | perTonSetupCost = 0
244 | perTonPerMinCost = 0
245 |
246 | percentSetupCost = 20
247 | percentPerMinCost = 2
248 |
249 | AtmoPerMinMultipler = 5
250 |
251 | TerminateAtSoiWithoutData = true
252 | TerminateAtLandWithoutData = true
253 | TerminateAtAtmoWithoutData = true
254 | }
255 | Custom-%
256 | {
257 | description = Percentage costs for Custom mode
258 |
259 | flatSetupCost = 0
260 | flatPerMinCost = 0
261 |
262 | perPartSetupCost = 0
263 | perPartPerMinCost 0
264 |
265 | perTonSetupCost = 0
266 | perTonPerMinCost =0
267 |
268 | percentSetupCost = 25
269 | percentPerMinCost = 3
270 |
271 | AtmoPerMinMultipler = 3
272 |
273 | TerminateAtSoiWithoutData = true
274 | TerminateAtLandWithoutData = true
275 | TerminateAtAtmoWithoutData = true
276 | ContinueIfNoCash = false
277 | }
278 | }
--------------------------------------------------------------------------------
/GameData/KRASH/ChangeLog.txt:
--------------------------------------------------------------------------------
1 | 0.2.0 Initial release
2 | Simple simulation, no costs or termination
3 |
4 | 0.3.0 Bugs fixed:
5 | Fixed Cancel button to cancen the sim
6 | Fixed "Simulation Active" message not being displayed during sim
7 | Disabled Quicksave and Quickload functions
8 |
9 | New Features:
10 | Simulation costs added for career mode
11 | Configuration file added. See the config file for explanations:
12 | flatSetupCost
13 | flatPerMinCost
14 | flatSetupCost
15 | flatPerMinCost
16 | perTonSetupCost
17 | perTonPerMinCost
18 | AtmoPerMinMultipler
19 | ContinueIfNoCash
20 | TerminateAtSoiWithoutData
21 | TerminateAtLandWithoutData
22 | TerminateAtAtmoWithoutData
23 | DefaultMaxAllowableSimCost
24 | DefaultSimTime
25 |
26 | Config file enhanced with with nodes for each career type. Top of
27 | the config file are the basic values, the values in the nodes override
28 | the basic values (if present).
29 |
30 | API added for modders
31 | Ability to limit total simulation costs
32 | Termination modes added for career:
33 | Simulation terminated due to lack of funds
34 | Simulation terminated due to cost limit reached
35 | Simulation terminated due to lack of science data
36 | Simulation terminated due to entering unknown SOI
37 | Simulation terminated due to landing on unknown body
38 | Simulation terminated due to vessel destruction
39 |
40 | 0.3.1 Bug fix:
41 | Disable view of costs when not in career mode
42 | Fix sandbox & science mode (wasn't starting at all)
43 |
44 | 0.3.2 Bug fix:
45 | When in Pause menu, game is not paused even though menu is up
46 | Switching to another craft causes Pause menu to fail
47 | In sandbox, go to another planet, then return and start career game, that last planet is still available
48 | Make simcosts text larger
49 | Decimal points not being accepted at end of number for lat/long
50 |
51 | 0.4.0
52 | Reduced starting costs by 90% based on feedback
53 | Added % of initial ship cost to cost structure
54 | Added description to cfg file
55 | Added new cfg file for custom settings
56 | Added abililty to relocate running costs during sim, or not display altogether
57 | Added dialog to pause when ship lands
58 | 0.5.2
59 | Updated for 1.1
60 | Fixed bug where funds weren't being deducted at end of simulation from current funcs
61 | 0.5.3
62 | Added Changed estimated calcs of cost from Floor to Round, to 1 decimal place
63 | 0.5.4
64 | Added code to ensure that no latitude or longitude of 0.0 will be passed to Unity, this to work
65 | around a Unity bug.
66 | 0.5.5
67 | Added code to hide costs if UI is hidden
68 | Fixed issue when in career mode, if sim terminated in crash, unable to restart sim
69 | Fixed issu e where Flight results dialog would show up multiple times
70 | 0.5.6
71 | Added some code to check for a null value from the ProgressTracking when launching a sim
72 | 0.5.7
73 | Fixed issue where a ship could be recovered when landed, or return to space center when landed, and then
74 | recover ship from space center. Recovery tab disabled
75 | 0.5.8
76 | Fixed constant exceptions when in flight from KSP.UI.Screens.AltimeterSliderButtons.LateUpdate
77 | 0.5.9
78 | Fixed slowdown during simulation mode
79 | 0.5.10
80 | Fixed bug where a ship too big or heavy for the launchpad/runway would be allowed to launch, but the game
81 | would then stop it, leaving the sim enabled until a real launch was done
82 | Fixed inability to hide sim costs during sim
83 | Fixed NullReferenceException when first opening a career game from the main menu
84 | 0.5.11
85 | Fixed issue where you couldn't start a sim in orbit or landed
86 | 0.5.12
87 | Fixed checks for size, mass & part count for orbital & landed sims to properly check against facility being used
88 | 0.5.13
89 | Fixed bug where ships length & width were being added together when checking for a ship too wide
90 | Added display of reasons for inability to start sim, along with the limit being exceeded
91 | 0.5.14
92 | Fixed exploding ships after teleport
93 | 0.5.15
94 | Fixed exploding ships after teleport to landed state
95 | Fixed issue where if flight can't be entered due to some reason, simulation mode will be exited.
96 | This can happen in the following two (known) scenarios:
97 | 1. Try to launch, no kerbals available, cancel launch
98 | 2. In career mode, if you try to simulate a vessel for which you haven't researched the parts,
99 | the simulation does not start but the game remains in simulation mode. Obviously can happen only
100 | if you import a ship design from another save.
101 | 0.5.16
102 | The previous fix wasn't good, and it was still staying in sim mode, now fixed
103 |
104 | 0.5.17
105 | Added check for enough funds in Editor
106 | Now uses the MaxAllowableSimCost to set the initial default value
107 | Renamed MaxAllowableSimCost to DefaultMaxAllowableSimCost
108 | Moved cfg files into PluginData folder
109 |
110 | 0.5.17.1
111 | Recompile for 1.1.3
112 |
113 | 0.5.18
114 | Added option to show all bodies in career mode
115 |
116 | 0.5.18.1
117 | Fixed build script to create the PluginData directory
118 |
119 | 0.5.19
120 | Fixed issue where exiting KSP after never having used KRASH gets an exception and KSP never exits
121 |
122 | 0.5.20
123 | Fixed nullref when KRASHCustom.cfg is missing
124 | 0.5.21
125 | Fixed harmless nullref when starting sim
126 |
127 | 0.5.22 This will be the Three_Pounds release, in honor of all the test work done by Three_Pounds and the new icon
128 | Updated for 1.2
129 | New toolbar icon provided by @Three_Pounds, thanks
130 | Fixed bug where Career-Only: List of available alternative parent bodies comes up empty, despite having reached such a body (example: The Mun).
131 | Fixed bug where Career-Only: When Terminate at SOI option is active in KRASH Config Window, Simulation is not terminated upon SOI switch to undiscovered body
132 | Fixed bug where Career-Only: When attempting to simulate a vessel that costs more than the current available funds, the simulation is not started giving an error message "Not enough Funds! You can't afford to launch the vessel." even though simulation costs could be paid for. "Simulation Active" is then stuck blinking on screen.
133 | Fixed bug where if the KRASHCustom.cfg was missing, the log would get spammed with missing messages while in the config screen
134 | Added missing KRASHCustom.cfg to release
135 | Fixed issue where initial sim cost exceeds available funds, and not allowed to go over was getting a GUI exception
136 | Fixed issue where config name with spaces wasn't being saved, replacing spaces with underscores fixed this
137 | Added code to deal with negative funding
138 | Now properly checks for locked parts
139 | Fixed Science mode
140 | Removed kludge for when editor would refuse to fly because of no crew, etc. Added code to detect in KRASH
141 | Fixed issue where editor controls wouldn't lock
142 |
143 | 0.5.23
144 | Replaced depreciated call to GameEvents.onLevelWasLoaded with Unity SceneManagment calls
145 | Added Settings page
146 | Added Wireframe mode (on settings page)
147 | Updated for 1.3
148 | 0.5.24
149 | Added default starting altitude setting, one for planets with atmosphere, one for planets without atmosphere
150 |
151 | 0.5.25
152 | Updated for KSP 1.3.1
--------------------------------------------------------------------------------
/Source/KRASH.cfg:
--------------------------------------------------------------------------------
1 | // This file is not modified by the game, so that all the comments stay
2 | // There is a second cfg file, called: KRASHCustom.cfg, which will hold custom and
3 | // user-defined settings
4 | //
5 | KRASH
6 | {
7 | // Defaults here, nodes below override the defaults
8 |
9 | description = Default settings
10 |
11 | // simulation costs consist of two parts: The initial
12 | // setup cost, and the cost over time
13 |
14 | // Inside that, there are costs based on the number of parts,
15 | // and the weight of the vessel. Also, there is a base cost
16 | // which is irrespective of parts or weight.
17 |
18 | // The flat costs are the basic cost of the simulation.
19 | // These are fixed costs, nothig affects them.
20 |
21 | flatSetupCost = 100
22 | flatPerMinCost = 10
23 |
24 | // These two control the costs based on the
25 | // number of parts in the vessel
26 |
27 | perPartSetupCost = 2
28 | perPartPerMinCost 2
29 |
30 | // The following two are the costs based on the
31 | // weight of the vessel. During flight, as fuel is burned,
32 | // the mass decreases and so does the costs based on the
33 | // mass
34 |
35 | perTonSetupCost = 30
36 | perTonPerMinCost = 3
37 |
38 | // These two control the costs based on the
39 | // initial cost of the vessel (percentage 0-100)
40 |
41 | percentSetupCost = 10
42 | percentPerMinCost = 1
43 |
44 | // This is a multiplier which is applied while a vessel is in the atmosphere
45 | // It represents the additional computing costs of atmospheric flight. This
46 | // cannot be less than 1, if it is, then 1 will be used instead.
47 | AtmoPerMinMultipler = 1
48 |
49 | // The following are true/false values, and are
50 | // fairly self-explanatory
51 |
52 | ContinueIfNoCash = true
53 | ObeyPadLimits = false
54 |
55 | // The following settings will terminate the simulation if the specified situation occurs:
56 | // TerminateAtSoiWithoutData: Upon entering an SOI without any science data from either in orbit or landed
57 | // TerminateAtLandWithoutData: Upon landing on a body without any prior science data
58 | // TerminateAtAtmoWithoutData: Upon entering an atmosphere without any prior science data
59 |
60 | TerminateAtSoiWithoutData = false
61 | TerminateAtLandWithoutData = false
62 | TerminateAtAtmoWithoutData = false
63 |
64 | // The DefaultMaxAllowableSimCost puts an upper limit on the cost of a simulation
65 | // When the simulation cost exceeds this, the simulation is terminated
66 | // If 0, there is no upper limit on the cost
67 |
68 | DefaultMaxAllowableSimCost = 0
69 |
70 | // When calculating the MaxAllowableSimCost, calculate for a default number of minutes
71 |
72 | DefaultSimTime = 15
73 |
74 |
75 | //
76 | // The following sections are values for each mode of play (easy, normal, moderate, hard, custom)
77 | //
78 | // This can be modified with ModuleManager, or additional sections can be added and loaded by other mods
79 | //
80 | Easy
81 | {
82 | description = Standard costs for Easy mode
83 |
84 | flatSetupCost = 100
85 | flatPerMinCost = 10
86 |
87 | perPartSetupCost = 1
88 | perPartPerMinCost 1
89 |
90 | perTonSetupCost = 1
91 | perTonPerMinCost = 1
92 |
93 | percentSetupCost = 0
94 | percentPerMinCost = 0
95 |
96 | AtmoPerMinMultipler = 1
97 | }
98 | Normal
99 | {
100 | description = Standard costs for Normal mode
101 |
102 | flatSetupCost = 150
103 | flatPerMinCost = 15
104 |
105 | perPartSetupCost = 1.5
106 | perPartPerMinCost 1.5
107 |
108 | perTonSetupCost = 1.5
109 | perTonPerMinCost = 1.5
110 |
111 | percentSetupCost = 0
112 | percentPerMinCost = 0
113 |
114 | AtmoPerMinMultipler = 1.5
115 | }
116 | Moderate
117 | {
118 | description = Standard costs for Moderate mode
119 |
120 | flatSetupCost = 200
121 | flatPerMinCost = 20
122 |
123 | perPartSetupCost = 2
124 | perPartPerMinCost 2
125 |
126 | perTonSetupCost = 2
127 | perTonPerMinCost = 2
128 |
129 | percentSetupCost = 0
130 | percentPerMinCost = 0
131 |
132 | AtmoPerMinMultipler = 2
133 | }
134 | Hard
135 | {
136 | description = Standard costs for Hard mode
137 |
138 | flatSetupCost = 300
139 | flatPerMinCost = 30
140 |
141 | perPartSetupCost = 3
142 | perPartPerMinCost 3
143 |
144 | perTonSetupCost = 3
145 | perTonPerMinCost = 3
146 |
147 | percentSetupCost = 0
148 | percentPerMinCost = 0
149 |
150 | AtmoPerMinMultipler = 5
151 |
152 | TerminateAtSoiWithoutData = true
153 | TerminateAtLandWithoutData = true
154 | TerminateAtAtmoWithoutData = true
155 | }
156 | Custom
157 | {
158 | description = Standard costs for Custom mode
159 |
160 | flatSetupCost = 300
161 | flatPerMinCost = 30
162 |
163 | perPartSetupCost = 3
164 | perPartPerMinCost 3
165 |
166 | perTonSetupCost = 3
167 | perTonPerMinCost = 3
168 |
169 | percentSetupCost = 1
170 | percentPerMinCost = 1
171 |
172 | AtmoPerMinMultipler = 1
173 |
174 | TerminateAtSoiWithoutData = true
175 | TerminateAtLandWithoutData = true
176 | TerminateAtAtmoWithoutData = true
177 | ContinueIfNoCash = false
178 | }
179 |
180 | Easy-%
181 | {
182 | description = Percentage costs for Easy mode
183 |
184 | flatSetupCost = 0
185 | flatPerMinCost = 0
186 |
187 | perPartSetupCost = 0
188 | perPartPerMinCost 0
189 |
190 | perTonSetupCost = 0
191 | perTonPerMinCost = 0
192 |
193 | percentSetupCost = 5
194 | percentPerMinCost = 0.5
195 |
196 | AtmoPerMinMultipler = 1
197 | }
198 | Normal-%
199 | {
200 | description = Percentage costs for Normal mode
201 |
202 | flatSetupCost = 0
203 | flatPerMinCost = 0
204 |
205 | perPartSetupCost = 0
206 | perPartPerMinCost 0
207 |
208 | perTonSetupCost = 0
209 | perTonPerMinCost = 0
210 |
211 | percentSetupCost = 10
212 | percentPerMinCost = 1
213 |
214 | AtmoPerMinMultipler = 1.5
215 | }
216 | Moderate-%
217 | {
218 | description = Percentage costs for Moderate mode
219 |
220 | flatSetupCost = 0
221 | flatPerMinCost = 0
222 |
223 | perPartSetupCost = 0
224 | perPartPerMinCost 0
225 |
226 | perTonSetupCost = 0
227 | perTonPerMinCost = 0
228 |
229 | percentSetupCost = 15
230 | percentPerMinCost = 1.5
231 |
232 | AtmoPerMinMultipler = 2
233 | }
234 | Hard-%
235 | {
236 | description = Percentage costs for Hard mode
237 |
238 | flatSetupCost = 0
239 | flatPerMinCost = 0
240 |
241 | perPartSetupCost = 0
242 | perPartPerMinCost 0
243 |
244 | perTonSetupCost = 0
245 | perTonPerMinCost = 0
246 |
247 | percentSetupCost = 20
248 | percentPerMinCost = 2
249 |
250 | AtmoPerMinMultipler = 5
251 |
252 | TerminateAtSoiWithoutData = true
253 | TerminateAtLandWithoutData = true
254 | TerminateAtAtmoWithoutData = true
255 | }
256 | Custom-%
257 | {
258 | description = Percentage costs for Custom mode
259 |
260 | flatSetupCost = 0
261 | flatPerMinCost = 0
262 |
263 | perPartSetupCost = 0
264 | perPartPerMinCost 0
265 |
266 | perTonSetupCost = 0
267 | perTonPerMinCost =0
268 |
269 | percentSetupCost = 25
270 | percentPerMinCost = 3
271 |
272 | AtmoPerMinMultipler = 3
273 |
274 | TerminateAtSoiWithoutData = true
275 | TerminateAtLandWithoutData = true
276 | TerminateAtAtmoWithoutData = true
277 | ContinueIfNoCash = false
278 | }
279 | }
--------------------------------------------------------------------------------
/Source/View/OrbitEditor.cs:
--------------------------------------------------------------------------------
1 | // Contents of this file are under the license of the GPL V3, a copy of which is
2 | // included in this directory
3 | // This file included with permission from the Hyperedit project
4 | //
5 | // HyperEdit Created by:
6 | // khyperia (original creator, code)
7 | // Ezriilc (web)
8 | // sirkut (code)
9 | // payo (code [Planet Editor])
10 | // forecaster (graphics, logo)
11 | //
12 | using System;
13 | using System.Collections.Generic;
14 | using System.Linq;
15 |
16 | namespace KRASH.Hyperedit
17 | {
18 | public static class OrbitEditor
19 | {
20 |
21 | public static void Simple(OrbitDriver currentlyEditing, double altitude, CelestialBody body)
22 | {
23 | Log.Info ("Simple, currentlyEditing:" + currentlyEditing.ToString());
24 | SetOrbit(currentlyEditing, CreateOrbit(0, 0, altitude + body.Radius, 0, 0, 0, 0, body));
25 | }
26 |
27 |
28 | public static void GetSimple(OrbitDriver currentlyEditing, out double altitude, out CelestialBody body)
29 | {
30 | const int min = 1000;
31 | const int defaultAlt = 100000;
32 | body = currentlyEditing.orbit.referenceBody;
33 | altitude = currentlyEditing.orbit.semiMajorAxis - body.Radius;
34 | if (altitude > min)
35 | return;
36 | altitude = currentlyEditing.orbit.ApA;
37 | if (altitude > min)
38 | return;
39 | altitude = defaultAlt;
40 | }
41 |
42 | private static void SetOrbit(OrbitDriver currentlyEditing, Orbit orbit)
43 | {
44 | Log.Info ("Setorbit");
45 | currentlyEditing.DynamicSetOrbit(orbit);
46 | }
47 |
48 | private static Orbit CreateOrbit(double inc, double e, double sma, double lan, double w, double mEp, double epoch, CelestialBody body)
49 | {
50 | if (inc == 0)
51 | inc = 0.0001d;
52 | if (double.IsNaN(inc))
53 | inc = 0.0001d;
54 |
55 | if (double.IsNaN(e))
56 | e = 0;
57 | if (double.IsNaN(sma))
58 | sma = body.Radius + body.atmosphereDepth + 10000d;
59 | if (double.IsNaN(lan))
60 | lan = 0.0001d;
61 | if (lan == 0)
62 | lan = 0.0001d;
63 |
64 | if (double.IsNaN(w))
65 | w = 0;
66 | if (double.IsNaN(mEp))
67 | mEp = 0;
68 | if (double.IsNaN(epoch))
69 | mEp = Planetarium.GetUniversalTime();
70 |
71 | if (Math.Sign(e - 1) == Math.Sign(sma))
72 | sma = -sma;
73 |
74 | if (Math.Sign(sma) >= 0)
75 | {
76 | while (mEp < 0)
77 | mEp += Math.PI * 2;
78 | while (mEp > Math.PI * 2)
79 | mEp -= Math.PI * 2;
80 | }
81 |
82 | return new Orbit(inc, e, sma, lan, w, mEp, epoch, body);
83 | }
84 |
85 | public static void DynamicSetOrbit(this OrbitDriver orbit, Orbit newOrbit)
86 | {
87 | Log.Info ("DynamicSetOrbit");
88 | var vessel = orbit.vessel;
89 |
90 | if (vessel != null)
91 | SetOrbit(vessel, newOrbit);
92 | else
93 | HardsetOrbit(orbit, newOrbit);
94 | }
95 |
96 | public static void SetOrbit(this Vessel vessel, Orbit newOrbit)
97 | {
98 | //var originalUp = FlightGlobals.getUpAxis ();
99 | //Log.Info ("originalUp: " + originalUp.ToString ());
100 |
101 | var destinationMagnitude = newOrbit.getRelativePositionAtUT(Planetarium.GetUniversalTime()).magnitude;
102 | if (destinationMagnitude > newOrbit.referenceBody.sphereOfInfluence)
103 | {
104 | Extensions.ErrorPopup("Destination position was above the sphere of influence");
105 | return;
106 | }
107 | if (destinationMagnitude < newOrbit.referenceBody.Radius)
108 | {
109 | Extensions.ErrorPopup("Destination position was below the surface");
110 | return;
111 | }
112 |
113 | FlightGlobals.fetch.SetShipOrbit(newOrbit.referenceBody.flightGlobalsIndex, newOrbit.eccentricity, newOrbit.semiMajorAxis, newOrbit.inclination, newOrbit.LAN, newOrbit.meanAnomalyAtEpoch, newOrbit.argumentOfPeriapsis, newOrbit.ObT);
114 | FloatingOrigin.ResetTerrainShaderOffset();
115 |
116 | try
117 | {
118 | OrbitPhysicsManager.HoldVesselUnpack(60);
119 | }
120 | catch (NullReferenceException)
121 | {
122 | Log.Info("OrbitPhysicsManager.HoldVesselUnpack threw NullReferenceException");
123 | }
124 | }
125 |
126 | private static readonly object HardsetOrbitLogObject = new object();
127 |
128 | private static void HardsetOrbit(OrbitDriver orbitDriver, Orbit newOrbit)
129 | {
130 | Log.Info ("HardsetOrbit");
131 | var orbit = orbitDriver.orbit;
132 | orbit.inclination = newOrbit.inclination;
133 | orbit.eccentricity = newOrbit.eccentricity;
134 | orbit.semiMajorAxis = newOrbit.semiMajorAxis;
135 | orbit.LAN = newOrbit.LAN;
136 | orbit.argumentOfPeriapsis = newOrbit.argumentOfPeriapsis;
137 | orbit.meanAnomalyAtEpoch = newOrbit.meanAnomalyAtEpoch;
138 | orbit.epoch = newOrbit.epoch;
139 | orbit.referenceBody = newOrbit.referenceBody;
140 | orbit.Init();
141 | orbit.UpdateFromUT(Planetarium.GetUniversalTime());
142 | if (orbit.referenceBody != newOrbit.referenceBody)
143 | {
144 | if (orbitDriver.OnReferenceBodyChange != null)
145 | orbitDriver.OnReferenceBodyChange(newOrbit.referenceBody);
146 | }
147 | RateLimitedLogger.Log(HardsetOrbitLogObject,
148 | string.Format("Orbit \"{0}\" changed to: inc={1} ecc={2} sma={3} lan={4} argpe={5} mep={6} epoch={7} refbody={8}",
149 | orbitDriver.OrbitDriverToString(), orbit.inclination, orbit.eccentricity, orbit.semiMajorAxis,
150 | orbit.LAN, orbit.argumentOfPeriapsis, orbit.meanAnomalyAtEpoch, orbit.epoch, orbit.referenceBody.CbToString()));
151 | }
152 |
153 | public static Orbit Clone(this Orbit o)
154 | {
155 | return new Orbit(o.inclination, o.eccentricity, o.semiMajorAxis, o.LAN,
156 | o.argumentOfPeriapsis, o.meanAnomalyAtEpoch, o.epoch, o.referenceBody);
157 | }
158 | }
159 |
160 | public static class RateLimitedLogger
161 | {
162 | private const int MaxFrequency = 100; // measured in number of frames
163 |
164 | class Countdown
165 | {
166 | public string lastMessage;
167 | public int framesLeft;
168 | public bool needsPrint;
169 |
170 | public Countdown(string msg, int frames)
171 | {
172 | lastMessage = msg;
173 | framesLeft = frames;
174 | needsPrint = false;
175 | }
176 | }
177 |
178 | private static readonly Dictionary