Skip to content

Commit

Permalink
Another fix for the ghost ships, caused when loaded a subassembly whi…
Browse files Browse the repository at this point in the history
…le in the light scene
  • Loading branch information
linuxgurugamer committed Mar 31, 2020
1 parent 3fc4501 commit 2bc591b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 20 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
@@ -1,5 +1,8 @@
ChangeLog

2.0.1.4
Another fix for the ghost ships, caused when loaded a subassembly while in the light scene

2.0.1.3
Added check for existance of Subassemblies folder to avoid an error if it doesn't exist

Expand Down
2 changes: 1 addition & 1 deletion GameData/KSTS/KSTS.version
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 2,
"MINOR": 0,
"PATCH": 1,
"BUILD": 3
"BUILD": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
Binary file modified GameData/KSTS/Plugins/KSTS.dll
Binary file not shown.
13 changes: 13 additions & 0 deletions GameData/KSTS/readme.md
@@ -0,0 +1,13 @@
# KSTS: Kerbal Space Transport System

## Introduction

This Kerbal Space Program Mod allows the player to automate routine missions to Kerbin-orbit, like crew and resource transfers as well as deployment of new ships, by recording and replaying missions.

For more information see the official [forum thread](http://forum.kerbalspaceprogram.com/index.php?/topic/148071-113-kerbal-space-transport-system/).

![KSTS](http://i.imgur.com/fb57izT.png)

Includes a small patch by base10 to allow launches from other bodies than Kerbin, generally facilitated by Kerbal Konstructs or similar.

Licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0)
2 changes: 1 addition & 1 deletion KSTS.version
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 2,
"MINOR": 0,
"PATCH": 1,
"BUILD": 3
"BUILD": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion Source/AssemblyVersion.cs
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("2.0.1.3")]
[assembly: AssemblyVersion("2.0.1.4")]
34 changes: 22 additions & 12 deletions Source/GUI.cs
Expand Up @@ -257,6 +257,8 @@ public static void UpdateShipTemplateCache()

static void ReadAllCraftFiles(string editorFacility, string shipDirectory)
{
if (HighLogic.LoadedSceneIsFlight)

foreach (var craftFile in Directory.GetFiles(shipDirectory, "*.craft"))
{
try
Expand All @@ -281,27 +283,35 @@ static void ReadAllCraftFiles(string editorFacility, string shipDirectory)

Texture2D thumbnail;

//
// Make the thumbnail file if it doesn't exist.
// Needed for the subassemblies, will also replace any missing thumbnail files for regular craft
//
if (!File.Exists(thumbFile))
{
Log.Info("Missing Thumbfile: " + thumbFile);
ShipConstruct ship = ShipConstruction.LoadShip(craftFile);
ThumbnailHelper.CaptureThumbnail(ship, 256, "thumbs/", HighLogic.SaveFolder + "_" + editorFacility + "_" + validFileName);
}
//
// Make the thumbnail file if it doesn't exist.
// Needed for the subassemblies, will also replace any missing thumbnail files for regular craft
//
if (!HighLogic.LoadedSceneIsFlight)
{
if (!File.Exists(thumbFile))
{
Log.Info("Missing Thumbfile: " + thumbFile);
ShipConstruct ship = ShipConstruction.LoadShip(craftFile);
ThumbnailHelper.CaptureThumbnail(ship, 256, "thumbs/", HighLogic.SaveFolder + "_" + editorFacility + "_" + validFileName);
}
}

bool placeholder = false;
if (File.Exists(thumbFile))
{
thumbnail = new Texture2D(256, 256, TextureFormat.RGBA32, false);
thumbnail.LoadImage(File.ReadAllBytes(thumbFile));
}
else thumbnail = placeholderImage;
else
{
thumbnail = placeholderImage;
placeholder = true;
}

// The thumbnails are rather large, so we have to resize them first:
cachedTemplate.thumbnail = GUI.ResizeTexture(thumbnail, 64, 64);
if (thumbnail != null)
if (!placeholder)
Destroy(thumbnail);
GUI.shipTemplates.Add(cachedTemplate);
}
Expand Down
3 changes: 0 additions & 3 deletions Source/ThumbnailHelper.cs
Expand Up @@ -37,10 +37,7 @@ public static void CaptureThumbnail(ShipConstruct ship, int resolution, string s
public static void CaptureThumbnail(ShipConstruct ship, int resolution,
float elevation, float azimuth, float pitch, float heading, float fov, string saveFolder, string craftName)
{
//Log.Info("CaptureThumbnail elevation: " + elevation.ToString() + " azimuth: " + azimuth.ToString() + "pitch: " + pitch.ToString() +
//" heading: " + heading.ToString() + " fov: " + fov.ToString());
CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, elevation, azimuth, pitch, heading, fov);

}
#if false
/// <summary>
Expand Down
6 changes: 4 additions & 2 deletions deploy.bat
@@ -1,5 +1,5 @@

@echo off
@echo off

This comment has been minimized.

Copy link
@Fulgora

Fulgora Mar 31, 2020

I am not a bat expert in any way but the space looks odd :)

This comment has been minimized.

Copy link
@linuxgurugamer

linuxgurugamer Mar 31, 2020

Author Owner

Space is harmless


rem H is the destination game folder
rem GAMEDIR is the name of the mod folder (usually the mod name)
Expand All @@ -9,11 +9,13 @@ rem but not always

set H=%KSPDIR%
rem set H=R:\KSP_1.9.1_dev-KSTS
rem set H=R:\dp0\kspdev
set GAMEDIR=KSTS
set GAMEDATA="GameData"
set VERSIONFILE=%GAMEDIR%.version

copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"

copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%

xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"
xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"

This comment has been minimized.

Copy link
@Fulgora

Fulgora Mar 31, 2020

You removed the newline at the end of this file which may have unintended consequences depending on how this is being read!

This comment has been minimized.

Copy link
@linuxgurugamer

linuxgurugamer Mar 31, 2020

Author Owner

It's a batch file, it still gets executed

1 comment on commit 2bc591b

@Fulgora
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads-up :)

Please sign in to comment.