Skip to content

Commit

Permalink
Merge pull request #142 from post-kerbin-mining-corporation/dev
Browse files Browse the repository at this point in the history
Release 1.1.6
  • Loading branch information
ChrisAdderley committed Aug 14, 2024
2 parents af1b438 + 9dbc36b commit 24e9d8a
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .mod_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ package:
- changelog.txt
dependencies: # Configure dependencies
ModuleManager:
version: 4.2.1
version: 4.2.3
location: s3
B9PartSwitch:
version: 2.18.0
version: 2.20.0
location: s3
CommunityResourcePack:
version: 1.4.2
location: s3
DynamicBatteryStorage:
tag: 2.2.4
tag: 2.3.0
location: github
repository: post-kerbin-mining-corporation/DynamicBatteryStorage
deploy:
Expand Down
4 changes: 4 additions & 0 deletions CKAN/CryoTanks-Core.netkan
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"supports": [
{ "name": "CryoTanks" }
],
"conflicts": [
{ "name": "SimpleFuelSwitch" },
{ "name": "InterstellarFuelSwitch" }
],
"install" : [
{ "file" : "GameData/CryoTanks/Plugins/SimpleBoiloff.dll",
"install_to" : "GameData/CryoTanks/Plugins" }
Expand Down
4 changes: 4 additions & 0 deletions CKAN/CryoTanks.netkan
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{ "name": "KerbalAtomics" },
{ "name": "CryoEngines" }
],
"conflicts": [
{ "name": "SimpleFuelSwitch" },
{ "name": "InterstellarFuelSwitch" }
],
"install": [
{
"find" : "CryoTanks",
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Adds the parts added to a new VABOrganizer category
@PART[hydrogen-radial-125-1,hydrogen-radial-25-1,hydrogen-radial-375-1,hydrogen-5-1,hydrogen-5-2,hydrogen-5-3,hydrogen-10-1,hydrogen-375-1,hydrogen-375-2,hydrogen-375-3,hydrogen-25-1,hydrogen-25-2,hydrogen-25-3,hydrogen-125-1,hydrogen-125-2]:FOR[CryoTanks]:NEEDS[VABOrganizer]
{
%VABORGANIZER
{
%organizerSubcategory = cryogenic
}
}
Binary file modified GameData/CryoTanks/Plugins/SimpleBoiloff.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions GameData/CryoTanks/Versioning/CryoTanks.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
{
"MAJOR":1,
"MINOR":6,
"PATCH":5,
"PATCH":6,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":12,
"PATCH":3
"PATCH":5
},
"KSP_VERSION_MIN":{
"MAJOR":1,
Expand Down
16 changes: 14 additions & 2 deletions Source/BoiloffFuel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,20 @@ public void Boiloff(double seconds, double scale)
if (fuelPresent)
{
double toBoil = resource.amount * (1.0 - Math.Pow(1.0 - boiloffRateSeconds, seconds)) * scale;

double boilResult = part.RequestResource(resource.info.id, toBoil, ResourceFlowMode.NO_FLOW);
double boilResult;
/// If you're reading this, stop now
if (!resource.flowState)
{
/// This handles if the flow has been disabled in the UI. we gotta ignore it, in the best way possible
resource.flowState = true;
boilResult = part.RequestResource(resource.info.id, toBoil, ResourceFlowMode.NO_FLOW);
resource.flowState = false;
}
else
{
boilResult = part.RequestResource(resource.info.id, toBoil, ResourceFlowMode.NO_FLOW);
}


/// Generate outputs
if (outputs.Count > 0)
Expand Down
20 changes: 12 additions & 8 deletions Source/ModuleSimpleBoiloff.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using KSP.Localization;

namespace SimpleBoiloff
Expand Down Expand Up @@ -71,6 +69,10 @@ public class ModuleCryoTank : PartModule
[KSPField(isPersistant = false)]
public double MaximumBoiloffScale = 5f;

// The number of physics frames before boiloff starts
[KSPField(isPersistant = false)]
public int BoiloffFrames = 30;

/// <summary>
/// Indicates whether there are any boilable resources currently on the part
/// </summary>
Expand All @@ -83,13 +85,12 @@ public class ModuleCryoTank : PartModule
private double fuelAmount = 0.0;
private double maxFuelAmount = 0.0;

private double boiloffRateSeconds = 0.0;

// Thermal
private double solarFlux = 1.0;
private double planetFlux = 1.0;
private double fluxScale = 1.0;

private int currentBoiloffFrames = 0;

// UI FIELDS/ BUTTONS
// Status string
Expand Down Expand Up @@ -313,7 +314,6 @@ public override void OnLoad(ConfigNode node)
fuels.Add(new BoiloffFuel(varNodes[i], this.part));
}
}
Utils.Log($"Now have {fuels.Count} fuels");
}

/// <summary>
Expand All @@ -329,7 +329,7 @@ public void DoCatchup()
double elapsedTime = Planetarium.GetUniversalTime() - LastUpdateTime;
if (elapsedTime > 0d)
{
Utils.Log($"Catching up {elapsedTime} s of time on load");
Utils.Log($"[SimpleBoiloff] Catching up {elapsedTime} s of time on load");

for (int i = 0; i < fuels.Count; i++)
{
Expand Down Expand Up @@ -454,7 +454,11 @@ protected void FixedUpdate()

if (BoiloffOccuring)
{
DoBoiloff();
currentBoiloffFrames++;
if (currentBoiloffFrames > BoiloffFrames)
{
DoBoiloff();
}
}
if (part.vessel.missionTime > 0.0)
{
Expand Down Expand Up @@ -492,7 +496,7 @@ protected double CalculateRadiativeEffects()

if (ShortwaveFluxAffectsBoiloff || LongwaveFluxAffectsBoiloff)
{
fluxScale = Math.Max((planetFlux / LongwaveFluxBaseline + (solarFlux * Albedo) / ShortwaveFluxBaseline) / 2.0f, MinimumBoiloffScale);
fluxScale = Math.Min(Math.Max((planetFlux / LongwaveFluxBaseline + (solarFlux * Albedo) / ShortwaveFluxBaseline) / 2.0f, MinimumBoiloffScale), MaximumBoiloffScale);
}
else
{
Expand Down
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
v1.6.6
------
- Updated DynamicBatteryStorage to 2.3.0
- Updated B9PartSwitch to 2.20.0
- Updated ModuleManager to 4.2.3
- Added some handling which sets a delay of 30 physics ticks (~1s) before boiloff kicks in to help with solar panel inconsistencies
- Fixed shader on medium inline 3.75m hydrogen tank (again)
- Fixed an issue where a player could disable a tank in the UI, thus disabling boiloff
- Fixed an issue where MaximumBoiloffScale was not respected when using the advanced solar modes
- Support VABOrganizer subcategories

v1.6.5
------
- Fixed shader on 3.75m hydrogen tank
Expand Down
8 changes: 4 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=================
Cryo Tanks v1.6.5
Cryo Tanks v1.6.6
=================

A mod pack for Kerbal Space Program, specifically supporting my other mods Kerbal Atomics (https://github.com/ChrisAdderley/KerbalAtomics) and Cryogenic Engines (https://github.com/ChrisAdderley/CryoEngines), dealing with cryogenic fuels, their storage and their properties.
Expand All @@ -20,10 +20,10 @@ DEPENDENCIES
============

Required:
- B9PartSwitch (2.18.0)
- B9PartSwitch (2.20.0)
- Community Resource Pack (1.4.2)
- ModuleManager (4.1.4)
- DynamicBatteryStorage (2.2.4)
- ModuleManager (4.2.3)
- DynamicBatteryStorage (2.3.0)

Optional
- Community Tech Tree (v2.2+)
Expand Down

0 comments on commit 24e9d8a

Please sign in to comment.