Skip to content

Commit

Permalink
2.2.0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
innominata committed Jan 29, 2022
1 parent 523241e commit 9a70852
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 25 deletions.
2 changes: 1 addition & 1 deletion GalacticScale2/Scripts/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class GS2
[BepInDependency(NebulaAPI.NebulaModAPI.API_GUID)]
public class Bootstrap : BaseUnityPlugin
{
public const string VERSION = "2.2.0.25";
public const string VERSION = "2.2.0.26";

public new static ManualLogSource Logger;

Expand Down
1 change: 1 addition & 0 deletions GalacticScale2/Scripts/GalacticScale2.0/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static void Init()

if (File.Exists(Path.Combine(AssemblyPath, "icon.png")))
{
if (ActiveGenerator != null && ActiveGenerator.GUID == "space.customizing.generators.vanilla") updateMessage += "Note: Settings for this mod are in the settings menu. Make sure to change the Generator to get the full Galactic Scale experience.\r\n";
updateMessage += "Update Detected. Please do not save over existing saves \r\nuntil you are sure you can load saves saved with this version!\r\nPlease Click GS2 Help and click the link to join our community on discord for preview builds and to help shape the mod going forward".Translate();
File.Delete(Path.Combine(AssemblyPath, "icon.png"));
updateMessage += "The latest DSP update has added additional planet themes which are yet to be included in GS2. \r\nI'm working on getting them added to the GS2 themeset, as well as implementing their new subtheme system";
Expand Down
68 changes: 68 additions & 0 deletions GalacticScale2/Scripts/GalacticScale2.0/Patches/-Debug/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,76 @@
namespace GalacticScale

{

public class PatchOnWhatever
{
[HarmonyPrefix, HarmonyPatch(typeof(PlanetData), "AddHeightMapModLevel")]
public static bool AddHeightMapModLevel(int index, int level, PlanetData __instance)
{
if (__instance.data.AddModLevel(index, level))
{
int num = __instance.precision / __instance.segment;
int num2 = index % __instance.data.stride;
int num3 = index / __instance.data.stride;
int num4 = ((num2 < __instance.data.substride) ? 0 : 1) + ((num3 < __instance.data.substride) ? 0 : 2);
int num5 = num2 % __instance.data.substride;
int num6 = num3 % __instance.data.substride;
int num7 = (num5 - 1) / num;
int num8 = (num6 - 1) / num;
int num9 = num5 / num;
int num10 = num6 / num;
if (num9 >= __instance.segment)
{
num9 = __instance.segment - 1;
}
if (num10 >= __instance.segment)
{
num10 = __instance.segment - 1;
}
int num11 = num4 * __instance.segment * __instance.segment;
int num12 = num7 + num8 * __instance.segment + num11;
int num13 = num9 + num8 * __instance.segment + num11;
int num14 = num7 + num10 * __instance.segment + num11;
int num15 = num9 + num10 * __instance.segment + num11;
num12 = Mathf.Clamp(num12, 0, 99);
num13 = Mathf.Clamp(num13, 0, 99);
num14 = Mathf.Clamp(num14, 0, 99);
num15 = Mathf.Clamp(num15, 0, 99);
__instance.dirtyFlags[num12] = true;
__instance.dirtyFlags[num13] = true;
__instance.dirtyFlags[num14] = true;
__instance.dirtyFlags[num15] = true;
}

return false;
}

[HarmonyPostfix, HarmonyPatch(typeof(BuildTool_Inserter), "CheckBuildConditions")]
public static void BuildToolInserter(BuildTool_Inserter __instance, ref bool __result)
{
if (__instance.buildPreviews.Count == 0)
{
return;
}
// if (__instance.buildPreviews == null) return;
var preview = __instance.buildPreviews[0];
// GS2.Warn(preview?.condition.ToString());

if (__instance.planet.realRadius < 20)
{
if (preview.condition == EBuildCondition.TooSkew)
{
preview.condition = EBuildCondition.Ok;
// GS2.Warn("TooSkew");
__instance.cursorValid = true; // Prevent red text
__result = true; // Override the build condition check
UICursor.SetCursor(ECursor.Default); // Get rid of that ban cursor
__instance.actionBuild.model.cursorText = "Click to build";
__instance.actionBuild.model.cursorState = 0;
}
}
}

[HarmonyPrefix, HarmonyPatch(typeof(UILoadGameWindow), "_OnOpen")]
public static bool UILoadGameWindow_OnOpen()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructio

return matcher.InstructionEnumeration();
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ public class PatchOnBuildTool_Path
[HarmonyPatch(typeof(BuildTool_Path), "CheckBuildConditions")]
public static bool CheckBuildConditions(bool __result, BuildTool_Path __instance, ref bool ___cursorValid)
{
// GS2.Warn(__instance.buildPreviews[0].condition.ToString());
var count = __instance.buildPreviews.Count;
if (count < 2) return __result; // Check we are building

var preview = __instance.buildPreviews[0];

var preview2 = __instance.buildPreviews[count - 1];

var objId = preview.inputObjId;
var objId2 = preview2.outputObjId;
//GS2.Warn(objId.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static bool CalculateGeothermalStrenth(Vector3 pos, Quaternion rot, ref f
}
GS2.Warn($"***GeoStrenth:{num}");
float modifier = 1;
if (__instance.planet.orbitAround == null) {
if (__instance.planet.orbitAroundPlanet == null) {
modifier -= __instance.planet.orbitRadius;
}
else if (__instance.planet.orbitAroundPlanet.orbitAroundPlanet == null) {
Expand All @@ -133,6 +133,12 @@ public static bool CalculateGeothermalStrenth(Vector3 pos, Quaternion rot, ref f
modifier -= __instance.planet.orbitAroundPlanet.orbitAroundPlanet.orbitRadius;
}
if (modifier < 0) modifier = 0;
if (__instance.planet.realRadius > 200)
{
var diff = __instance.planet.realRadius - 200;
var mod = diff / 300f;
modifier *= (1 + mod);
}
num *= (modifier + 1f);
__result = num;
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ public static void Update(ref Text ___promptText)
var status = "WARNING - Galactic Scale savegames can be broken by updates.Read the FAQ @ http://customizing.space\r\n".Translate();
if (GameMain.localStar != null && !GameMain.localStar.loaded)
status += "Loading Planets: ".Translate();
// GS2.Warn("A");
status += $"{HandleLocalStarPlanets.GetStarLoadingStatus(GameMain.localStar)}";
if (HandleLocalStarPlanets.GetLoadedPlanetCount(GameMain.localStar) >= GameMain.localStar.planets.Length || GS2.Vanilla) return;
var loadingPlanet = GameMain.localStar.planets[HandleLocalStarPlanets.GetLoadedPlanetCount(GameMain.localStar)];
status += $" {loadingPlanet.name} a {loadingPlanet.realRadius} Radius {GS2.GetGSPlanet(loadingPlanet).GsTheme.Name} ";
if (loadingPlanet.orbitAroundPlanet != null) status += "Moon " ;
// GS2.Warn("B");
if (GameMain.localStar != null && HandleLocalStarPlanets.GetLoadedPlanetCount(GameMain.localStar) >= GameMain.localStar.planets.Length || GS2.Vanilla) return;
// GS2.Warn("C");
var loadingPlanet = GameMain.localStar?.planets[HandleLocalStarPlanets.GetLoadedPlanetCount(GameMain.localStar)];
// GS2.Warn("D");
status += $" {loadingPlanet?.name}, a size {loadingPlanet?.realRadius} {GS2.GetGSPlanet(loadingPlanet)?.GsTheme?.DisplayName} ";
// GS2.Warn("E");
if (loadingPlanet?.orbitAroundPlanet != null) status += "Moon " ;
else status += "Planet ";
//status += $"with a {loadingPlanet.orbitRadius}AU Orbit";
___promptText.text = status;
// GS2.Warn("F");
if (___promptText != null) ___promptText.text = status;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void SetLuts(int segments, float planetRadius)
if (!DSPGame.IsMenuDemo && !Vanilla)
{
// Prevent special LUT's being created in main menu
if (keyedLUTs.ContainsKey(segments) && keyedLUTs.ContainsKey(segments) && PatchOnUIBuildingGrid.LUT512.ContainsKey(segments)) return;
if (keyedLUTs.ContainsKey(segments) && PatchOnUIBuildingGrid.LUT512.ContainsKey(segments)) return;
var numSegments = segments / 4; //Number of segments on a quarter circle (the other 3/4 will result by mirroring)
var lut = new int[numSegments];
var segmentAngle = Mathf.PI / 2f / numSegments; //quarter circle divided by num segments is the angle per segment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Tony\.nuget\packages\</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\inno\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.9.1</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.10.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Tony\.nuget\packages\" />
<SourceRoot Include="C:\Users\inno\.nuget\packages\" />
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgBepInEx_Core Condition=" '$(PkgBepInEx_Core)' == '' ">C:\Users\Tony\.nuget\packages\bepinex.core\5.4.17</PkgBepInEx_Core>
<PkgBepInEx_Analyzers Condition=" '$(PkgBepInEx_Analyzers)' == '' ">C:\Users\Tony\.nuget\packages\bepinex.analyzers\1.0.8</PkgBepInEx_Analyzers>
<PkgBepInEx_Core Condition=" '$(PkgBepInEx_Core)' == '' ">C:\Users\inno\.nuget\packages\bepinex.core\5.4.17</PkgBepInEx_Core>
<PkgBepInEx_Analyzers Condition=" '$(PkgBepInEx_Analyzers)' == '' ">C:\Users\inno\.nuget\packages\bepinex.analyzers\1.0.8</PkgBepInEx_Analyzers>
</PropertyGroup>
</Project>
16 changes: 8 additions & 8 deletions GalacticScale2/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 3,
"targets": {
".NETFramework,Version=v4.8": {
"BepInEx.Analyzers/1.0.7": {
"BepInEx.Analyzers/1.0.8": {
"type": "package"
},
"BepInEx.BaseLib/5.4.17": {
Expand Down Expand Up @@ -158,7 +158,7 @@
}
},
".NETFramework,Version=v4.8/win": {
"BepInEx.Analyzers/1.0.7": {
"BepInEx.Analyzers/1.0.8": {
"type": "package"
},
"BepInEx.BaseLib/5.4.17": {
Expand Down Expand Up @@ -314,7 +314,7 @@
}
},
".NETFramework,Version=v4.8/win-x64": {
"BepInEx.Analyzers/1.0.7": {
"BepInEx.Analyzers/1.0.8": {
"type": "package"
},
"BepInEx.BaseLib/5.4.17": {
Expand Down Expand Up @@ -470,7 +470,7 @@
}
},
".NETFramework,Version=v4.8/win-x86": {
"BepInEx.Analyzers/1.0.7": {
"BepInEx.Analyzers/1.0.8": {
"type": "package"
},
"BepInEx.BaseLib/5.4.17": {
Expand Down Expand Up @@ -627,16 +627,16 @@
}
},
"libraries": {
"BepInEx.Analyzers/1.0.7": {
"sha512": "/RZ1GzpvD9Va5/pW+2Kce5rcaIX5mXiTvzwMqjgPGxsVzNGxt6wulw3zCS6jZYJWA1j4D5YQQ2jVbcz/Dkpjdg==",
"BepInEx.Analyzers/1.0.8": {
"sha512": "xrfNmunsPhBx+vStTxLonq/aHkRrDH77c9tG/x3m5eejrKe5B0nf7cJPRRt6x330sGI0bLaPTtygdeHUgvI3wQ==",
"type": "package",
"path": "bepinex.analyzers/1.0.7",
"path": "bepinex.analyzers/1.0.8",
"hasTools": true,
"files": [
".nupkg.metadata",
"analyzers/dotnet/cs/BepInEx.Analyzers.CodeFixes.dll",
"analyzers/dotnet/cs/BepInEx.Analyzers.dll",
"bepinex.analyzers.1.0.7.nupkg.sha512",
"bepinex.analyzers.1.0.8.nupkg.sha512",
"bepinex.analyzers.nuspec",
"tools/install.ps1",
"tools/uninstall.ps1"
Expand Down
2 changes: 1 addition & 1 deletion GalacticScale2/obj/project.nuget.cache
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"success": true,
"projectFilePath": "E:\\code\\GalacticScale2\\GalacticScale2\\DSP_Plugins.GalacticScale.csproj",
"expectedPackageFiles": [
"C:\\Users\\inno\\.nuget\\packages\\bepinex.analyzers\\1.0.7\\bepinex.analyzers.1.0.7.nupkg.sha512",
"C:\\Users\\inno\\.nuget\\packages\\bepinex.analyzers\\1.0.8\\bepinex.analyzers.1.0.8.nupkg.sha512",
"C:\\Users\\inno\\.nuget\\packages\\bepinex.baselib\\5.4.17\\bepinex.baselib.5.4.17.nupkg.sha512",
"C:\\Users\\inno\\.nuget\\packages\\bepinex.core\\5.4.17\\bepinex.core.5.4.17.nupkg.sha512",
"C:\\Users\\inno\\.nuget\\packages\\harmonyx\\2.5.5\\harmonyx.2.5.5.nupkg.sha512",
Expand Down
2 changes: 1 addition & 1 deletion GalacticScale2/obj/rider.project.restore.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16427529176811194
16433724626720096
Binary file added Galactic_Scale-GalacticScale-2.2.26.zip
Binary file not shown.
5 changes: 5 additions & 0 deletions Package/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# DSP Galactic Scale 2.0 Mod
- Version 2.2.0.26 - Hopefully Geothermal is working on every planet now :)

- Version 2.2.0.25 - Fixed Geothermal for Vanilla, Fixed Error on New Game. Added Debug Option to revert Scarlet Ice Lake

- Version 2.2.0.24 - Fixed Geothermal. Fixed Scarlet Ice Lake. Added some planet info to loading screen.

- Version 2.2.0.23 - Fixed Planet Detail Panel. Fixed Ghost Planets. Broke Nebula compatibility. (Nebula isn't updated yet afaik so no big deal here)

Expand Down
4 changes: 2 additions & 2 deletions thunderstore.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ schemaVersion = "0.0.1"
[package]
namespace = "Galactic_Scale"
name = "GalacticScale"
versionNumber = "2.2.23"
description = "v2.2.0.23 Minor Fixes"
versionNumber = "2.2.26"
description = "v2.2.0.26 Geothermal Fix (Hopefully the last one)"
websiteUrl = "https://github.com/Touhma/DSP_Plugins"
containsNsfwContent = false

Expand Down

0 comments on commit 9a70852

Please sign in to comment.