Skip to content

Commit

Permalink
Release 1.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
severedsolo committed Jun 19, 2019
1 parent 71710e5 commit 7c5c5a6
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 9 deletions.
6 changes: 3 additions & 3 deletions GameData/Severedsolo/OhScrap/Changelog.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ KERBALCHANGELOG //Required to have this name
VERSION
{
version = 1.6.1.1
change = PLEASE ENSURE THE SEVEREDSOLO DIRECTORY HAS BEEN REMOVED COMPLETELY DUE TO POLLUTION OF THE ZIP IN THE LAST VERSION
change = Removed duplicate dlls in the zip.
version = 1.6.2
change = Fixed issue where Editor Ship was being cached before it had any parts.
change = UI will now point out that the Editor Ship has no parts, rather than just reporting Safety Rating 0.
}
VERSION
Expand Down
12 changes: 6 additions & 6 deletions GameData/Severedsolo/OhScrap/OhScrap.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
{
"MAJOR" : 1,
"MINOR" : 6,
"PATCH" : 1,
"BUILD" : 1
"PATCH" : 2,
"BUILD" : 0
},
"KSP_VERSION" :
{
"MAJOR" : 1,
"MINOR" : 6,
"PATCH" : 1
"MINOR" : 7,
"PATCH" : 2
},
"KSP_VERSION_MIN" :
{
"MAJOR" : 1,
"MINOR" : 6,
"MINOR" : 7,
"PATCH" : 0
},
"KSP_VERSION_MAX" :
{
"MAJOR" : 1,
"MINOR" : 6,
"MINOR" : 7,
"PATCH" : 99
}
}
66 changes: 66 additions & 0 deletions OhScrap/HeatControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using ScrapYard.Utilities;
using UnityEngine;

namespace OhScrap
{
public class HeatControl : PartModule
{
[KSPField(isPersistant = true, guiActive = false)]
internal bool turnedOn = true;
[KSPField(isPersistant = false, guiActive = true, guiName = "Cabin Temperature", guiUnits = "C")]
private double cabinTemp = 20.0f;
[KSPField(isPersistant = true, guiActive = false)]
private double cabinTempKelvin = 293.15f;
[KSPField(isPersistant = false, guiActive = true, guiName = "Internal Temperature", guiUnits = "K")]
private double internalTemp = 0;
[KSPField(isPersistant = false, guiActive = true, guiName = "Skin Temperature", guiUnits = "K")]
private double skinTemp = 0;
private void Start()
{
cabinTemp = Math.Round(cabinTempKelvin - 273.15f, 0);
if (HighLogic.LoadedScene != GameScenes.FLIGHT) return;
InvokeRepeating("DrawPower",0.01f,0.01f);
}

private void DrawPower()
{
double desiredTemp = 293.15f;
internalTemp = Math.Round(part.temperature, 0);
skinTemp = Math.Round(part.skinTemperature, 0);
double requiredEC = 0;
double providedEC = 0;
if (turnedOn)
{
requiredEC = (Math.Max(cabinTempKelvin, internalTemp) - Math.Min(cabinTempKelvin, internalTemp)) * TimeWarp.CurrentRate / 60 / 60 / 10;
providedEC = part.vessel.RequestResource(part, PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id, requiredEC, false);
}

Debug.Log("[HeatControl]: Need "+requiredEC+"got"+providedEC);
if (cabinTemp > 15.0f && cabinTemp < 25.0f) turnedOn = false;
else if (cabinTemp < 10.0f || cabinTemp > 30f) turnedOn = true;
if (!WithinTolerance(requiredEC, providedEC) || !turnedOn)
{
double energyDeficit = providedEC / requiredEC;
if (providedEC == 0) energyDeficit = 1;
Debug.Log("[HeatControl]: Deficit is "+energyDeficit);
double heatLoss = (cabinTempKelvin - internalTemp) / 60 / 60 / 10 * TimeWarp.CurrentRate*energyDeficit;
Debug.Log("Removing "+heatLoss);
cabinTempKelvin -= heatLoss;
cabinTemp = Math.Round(cabinTempKelvin - 273.15f, 0);
}
else if (cabinTempKelvin != desiredTemp)
{
cabinTempKelvin += (desiredTemp - cabinTempKelvin)/60/60/10*TimeWarp.CurrentRate;
cabinTemp = Math.Round(cabinTempKelvin - 273.15f, 0);
}
}

private bool WithinTolerance(double num1, double num2)
{
if (Math.Max(num1, num2) - Math.Min(num1, num2) < 0.0001) return true;
return false;
}
}
}
12 changes: 12 additions & 0 deletions OhScrap/HeatControlFailure.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


namespace OhScrap
{
class HeatControlFailure : BaseFailureModule
{
protected override void Overrides()
{

}
}
}
2 changes: 2 additions & 0 deletions OhScrap/OhScrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
<Compile Include="AntennaFailureModule.cs" />
<Compile Include="FARControlSurfaceFailureModule.cs" />
<Compile Include="FARParachuteFailureModule.cs" />
<Compile Include="HeatControl.cs" />
<Compile Include="HeatControlFailure.cs" />
<Compile Include="ModWrapper.cs" />
<Compile Include="RTAntennaFailureModule.cs" />
<Compile Include="BaseFailureModule.cs" />
Expand Down

0 comments on commit 7c5c5a6

Please sign in to comment.