Skip to content

Commit

Permalink
1.21 version bump + new KSP bugfix : CometMiningNotRemovingMass, see #66
Browse files Browse the repository at this point in the history
  • Loading branch information
gotmachine committed Jul 21, 2022
1 parent 3aee9d0 commit 25d1230
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GameData/KSPCommunityFixes/KSPCommunityFixes.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"NAME": "KSPCommunityFixes",
"URL": "https://raw.githubusercontent.com/KSPModdingLibs/KSPCommunityFixes/master/GameData/KSPCommunityFixes/KSPCommunityFixes.version",
"DOWNLOAD": "https://github.com/KSPModdingLibs/KSPCommunityFixes/releases",
"VERSION": {"MAJOR": 1, "MINOR": 20, "PATCH": 0, "BUILD": 0},
"VERSION": {"MAJOR": 1, "MINOR": 21, "PATCH": 0, "BUILD": 0},
"KSP_VERSION": {"MAJOR": 1, "MINOR": 12, "PATCH": 3},
"KSP_VERSION_MIN": {"MAJOR": 1, "MINOR": 8, "PATCH": 0},
"KSP_VERSION_MAX": {"MAJOR": 1, "MINOR": 12, "PATCH": 3}
Expand Down
3 changes: 3 additions & 0 deletions GameData/KSPCommunityFixes/Settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ KSP_COMMUNITY_FIXES
// Fix asteroid/comet mass being restored to 100% when reloading after having mined it down to 0%
AsteroidInfiniteMining = true
// Fix mass of comets not actually reducing when mining them, despite the PAW saying so.
CometMiningNotRemovingMass = true
// ##########################
// Obsolete bugfixes
// ##########################
Expand Down
27 changes: 27 additions & 0 deletions KSPCommunityFixes/BugFixes/CometMiningNotRemovingMass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// see https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/66

using HarmonyLib;
using System;
using System.Collections.Generic;

namespace KSPCommunityFixes.BugFixes
{
class CometMiningNotRemovingMass : BasePatch
{
protected override Version VersionMin => new Version(1, 12, 2);

protected override void ApplyPatches(List<PatchInfo> patches)
{
patches.Add(new PatchInfo(
PatchMethodType.Prefix,
AccessTools.Method(typeof(ModuleComet), nameof(ModuleComet.GetModuleMass)),
this));
}

static bool ModuleComet_GetModuleMass_Prefix(ModuleComet __instance, float defaultMass, out float __result)
{
__result = __instance.cometMass - defaultMass;
return false;
}
}
}
1 change: 1 addition & 0 deletions KSPCommunityFixes/KSPCommunityFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<ItemGroup>
<Compile Include="BasePatch.cs" />
<Compile Include="BugFixes\AsteroidInfiniteMining.cs" />
<Compile Include="BugFixes\CometMiningNotRemovingMass.cs" />
<Compile Include="BugFixes\EnginePlateAirstreamShieldedTopPart.cs" />
<Compile Include="Performance\CommNetThrottling.cs" />
<Compile Include="Performance\DisableMapUpdateInFlight.cs" />
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Compatible with **KSP 1.8.0** to **1.12.3** - Available on [CKAN]

### Features

Individual patches can be enabled or disabled by editing (or MM patching) the `Settings.cfg` file. Some patches will be applied only to specific KSP versions.
Individual patches can be enabled or disabled by editing (or MM patching) the `Settings.cfg` file.

While all KSP versions from 1.8.0 to 1.12.3 are supported, using the latest one (1.12.3) is highly recommended, as many patches only apply to the most recent KSP versions. When a bug fix patch doesn't apply to an older KSP version, this **doesn't** mean those bugs don't exist there.

User options are available from the "ESC" in-game settings menu :<br/><img src="https://github.com/KSPModdingLibs/KSPCommunityFixes/raw/master/Screenshots/settings.gif"/>

Expand Down Expand Up @@ -64,6 +66,7 @@ User options are available from the "ESC" in-game settings menu :<br/><img src="
- **[RescaledRoboticParts](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/48)** [KSP 1.8.0 - 1.12.3]<br/> Fix rescaled robotics parts propagating their scale to childrens after actuating the servo in the editor
- **[EnginePlateAirstreamShieldedTopPart](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/52)** [KSP 1.11.0 - 1.12.3]<br/>Fix engine plates causing the part attached above them to be incorrectly shielded from airstream.
- **[AsteroidInfiniteMining](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/51)** [KSP 1.10.0 - 1.12.3]<br/>Fix asteroid/comet mass being restored to 100% when reloading after having mined it down to 0%.
- **[CometMiningNotRemovingMass](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/66)** [KSP 1.12.2 - 1.12.3]<br/>Fix mass of comets not actually reducing when mining them, despite the PAW saying so.

#### Quality of Life tweaks

Expand Down Expand Up @@ -141,6 +144,9 @@ If doing so in the `Debug` configuration and if your KSP install is modified to

### Changelog

##### 1.21.0
- New KSP bugfix : CometMiningNotRemovingMass // Fix mass of comets not actually reducing when mining them, despite the PAW saying so.

##### 1.20.0
- OnSymmetryFieldChanged : fixed mistakenly inverted "changed" condition resulting in the patch not actually preventing symmetry events to be fired when the value hasn't changed.
- Added russian localization (contributed by @sunnypunny)
Expand Down

0 comments on commit 25d1230

Please sign in to comment.