Skip to content

Commit

Permalink
Incepting ChillingOut - an (naive) attempt to handle the new bug on l…
Browse files Browse the repository at this point in the history
…aunching some old parts on KSP 1.11
  • Loading branch information
Lisias committed Jan 6, 2021
1 parent 31ae6c0 commit 01c8d50
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CONFIG.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TARGETDIR="999_$PACKAGE"
TARGETBINDIR="$TARGETDIR/Plugins"
PROJECTSDIR="$PACKAGE/"
VERSIONFILE="KSP_Recall.version"
DLLS="KSP-Recall Resourceful Driftless Attached"
DLLS="KSP-Recall Resourceful Driftless Attached ChillingOut"

PROJECT_BRANCH=`git branch | grep \* | cut -d ' ' -f2`
if [ "$PROJECT_BRANCH" == "master" ] ; then
Expand Down
7 changes: 7 additions & 0 deletions GameData/999_KSP-Recall/patches/chillingout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@PART[*]:NEEDS[KSPRECALL-CHILLINGOUT]
{
%MODULE[ChillingOut]
{
active = True
}
}
6 changes: 6 additions & 0 deletions KSP-Recall.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Driftless", "Source\Driftle
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Attached", "Source\Attached\Attached.csproj", "{FE47E629-DB24-4518-B6A0-799BA3E758D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChillingOut", "Source\ChillingOut\ChillingOut.csproj", "{BCB11210-C285-4919-A134-52F9136554AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -35,6 +37,10 @@ Global
{FE47E629-DB24-4518-B6A0-799BA3E758D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE47E629-DB24-4518-B6A0-799BA3E758D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE47E629-DB24-4518-B6A0-799BA3E758D6}.Release|Any CPU.Build.0 = Release|Any CPU
{BCB11210-C285-4919-A134-52F9136554AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCB11210-C285-4919-A134-52F9136554AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCB11210-C285-4919-A134-52F9136554AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCB11210-C285-4919-A134-52F9136554AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down
52 changes: 52 additions & 0 deletions Source/ChillingOut/ChillingOut.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BCB11210-C285-4919-A134-52F9136554AC}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ChillingOut</RootNamespace>
<AssemblyName>ChillingOut</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<BaseIntermediateOutputPath>..\..\obj\ChillingOut</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>..\..\bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\LIB\managed\1.4.1\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="KSPe.Light.Recall">
<HintPath>..\..\..\..\..\..\LIB\plugins\KSPe.Light.Recall.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\LIB\managed\1.4.1\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KSP-Recall\KSP-Recall.csproj">
<Project>{40E7A5F2-C30E-43E9-B345-51971959149F}</Project>
<Name>KSP-Recall</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
144 changes: 144 additions & 0 deletions Source/ChillingOut/PartModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
This file is part of Resourceful, a component of KSP-Recall
(C) 2020-2021 Lisias T : http://lisias.net <[email protected]>
KSP-Recall is double licensed, as follows:
* SKL 1.0 : https://ksp.lisias.net/SKL-1_0.txt
* GPL 2.0 : https://www.gnu.org/licenses/gpl-2.0.txt
And you are allowed to choose the License that better suit your needs.
KSP-Recall is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the SKL Standard License 1.0
along with KSP-Recall. If not, see <https://ksp.lisias.net/SKL-1_0.txt>.
You should have received a copy of the GNU General Public License 2.0
along with KSP-Recall. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using UnityEngine;

namespace KSP_Recall { namespace ChillingOut
{
public class ChillingOut : PartModule
{
#region KSP UI

[KSPField(isPersistant = false, guiActive = true, guiActiveEditor = false, guiName = "KSP-Recall::ChillingOut")]
[UI_Toggle(disabledText = "Disabled", enabledText = "Enabled", scene = UI_Scene.Flight)]
public bool active = false;

#endregion


#region KSP Life Cycle

public override void OnAwake()
{
Log.dbg("OnAwake {0}:{1:X}", this.name, this.part.GetInstanceID());
base.OnAwake();
}

public override void OnStart(StartState state)
{
Log.dbg("OnStart {0}:{1:X} {2} {3}", this.name, this.part.GetInstanceID(), state, this.active);
base.OnStart(state);
}

public override void OnCopy(PartModule fromModule)
{
Log.dbg("OnCopy {0}:{1:X} from {2:X}", this.name, this.part.GetInstanceID(), fromModule.part.GetInstanceID());
base.OnCopy(fromModule);
}

public override void OnLoad(ConfigNode node)
{
Log.dbg("OnLoad {0}:{1:X} {2}", this.name, this.part.GetInstanceID(), null != node);
base.OnLoad(node);
}

public override void OnSave(ConfigNode node)
{
Log.dbg("OnSave {0}:{1:X} {2}", this.name, this.part.GetInstanceID(), null != node);
base.OnSave(node);
}

public override void OnInitialize()
{
Log.dbg("OnInitialize {0}:{1:X}", this.name, this.part.GetInstanceID());
base.OnInitialize();
this.init();
}

public override void OnActive()
{
Log.dbg("OnActive {0}:{1:X}", this.name, this.part.GetInstanceID());
base.OnActive();
this.init();
}

// Needed because I had overriden OnActive.
// See https://kerbalspaceprogram.com/api/class_part_module.html#a6f2dd76038326c527e64d2ce96bb45fe
public override bool IsStageable()
{
return false;
}

public override void OnInactive()
{
Log.dbg("OnInactive {0}:{1:X}", this.name, this.part.GetInstanceID());
base.OnInactive();
this.deinit();
}

#endregion


#region Unity Life Cycle

private void FixedUpdate()
{
if (!HighLogic.LoadedSceneIsFlight) return;
if (this.vessel.missionTime > DELTA) this.enabled = false; // We are not needed anymore

this.part.temperature = 0;
this.part.skinTemperature = 0;
this.part.skinUnexposedTemperature = 0;
this.part.skinUnexposedExternalTemp = 0;
}

private void OnDestroy()
{
Log.dbg("OnDestroy {0}:{1:X}", this.name, this.part.GetInstanceID());
}

#endregion


private const float DELTA = 1.0f; // 1 second
private void init()
{
}

private void deinit()
{
}

private static readonly KSPe.Util.Log.Logger Log = KSPe.Util.Log.Logger.CreateForType<ChillingOut>("KSP-Recall", "ChillingOut");
static ChillingOut()
{
Log.level =
#if DEBUG
KSPe.Util.Log.Level.TRACE
#else
KSPe.Util.Log.Level.INFO
#endif
;
}
}
} }
26 changes: 26 additions & 0 deletions Source/ChillingOut/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("KSP-Recall :: ChillingOut")]
[assembly: AssemblyDescription("<TBD>")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(KSP_Recall.LegalMamboJambo.Company)]
[assembly: AssemblyProduct(KSP_Recall.LegalMamboJambo.Product)]
[assembly: AssemblyCopyright(KSP_Recall.LegalMamboJambo.Copyight)]
[assembly: AssemblyTrademark(KSP_Recall.LegalMamboJambo.Trademark)]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion(KSP_Recall.Version.Number)]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

0 comments on commit 01c8d50

Please sign in to comment.