diff --git a/README.md b/README.md index b93104ab..3d68e213 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ by deleting the directory itself. | Cheats | UI/QoL | Other | |---|---|---| -| [Asteroid Landing Position Override](#cheat-asteroid-landing-position-override)
[Auto Consume Oxygen-Water-Food](#cheat-auto-consume-oxygen-water-food)
[Highlight Nearby Resources](#cheat-highlight-nearby-resources)
[Inventory Capacity Override](#cheat-inventory-capacity-override)
[Machines Deposit Into Remote Containers](#cheat-machines-deposit-into-remote-containers)
[Minimap](#cheat-minimap)
[Photomode Hide Water](#cheat-photomode-hide-water)
[Teleport to Nearest Minable](#cheat-teleport-to-nearest-minable) | [Craft Equipment Inplace](#ui-craft-equipment-inplace)
[Customize Inventory Sort Order](#ui-customize-inventory-sort-order)
[Don't Close Craft Window](#ui-dont-close-craft-window)
[Grower Grab Vegetable Only](#ui-grower-grab-vegetable-only)
[Hide Beacons in Photomode](#ui-hide-beacons-in-photomode)
[Inventory Move Multiple Items](#ui-inventory-move-multiple-items)
[Show Container Content Info](#ui-show-container-content-info)
[Show Player Inventory Counts](#ui-show-player-inventory-counts)
[Show Player Tooltip Item Count](#ui-show-player-tooltip-item-count)
[Show Rocket Counts](#ui-show-rocket-counts)
[Pin Recipe to Screen](#ui-pin-recipe-to-screen) | [Load Inventories Faster](#perf-load-inventories-faster)
[Reduce Save Size](#perf-reduce-save-size)
[Support Mods with Load n Save](#lib-support-mods-with-load-n-save) | +| [Asteroid Landing Position Override](#cheat-asteroid-landing-position-override)
[Auto Consume Oxygen-Water-Food](#cheat-auto-consume-oxygen-water-food)
[Highlight Nearby Resources](#cheat-highlight-nearby-resources)
[Inventory Capacity Override](#cheat-inventory-capacity-override)
[Machines Deposit Into Remote Containers](#cheat-machines-deposit-into-remote-containers)
[Minimap](#cheat-minimap)
[Photomode Hide Water](#cheat-photomode-hide-water)
[Teleport to Nearest Minable](#cheat-teleport-to-nearest-minable) | [Craft Equipment Inplace](#ui-craft-equipment-inplace)
[Customize Inventory Sort Order](#ui-customize-inventory-sort-order)
[Don't Close Craft Window](#ui-dont-close-craft-window)
[Grower Grab Vegetable Only](#ui-grower-grab-vegetable-only)
[Hide Beacons in Photomode](#ui-hide-beacons-in-photomode)
[Inventory Move Multiple Items](#ui-inventory-move-multiple-items)
[Save When Quitting](#ui-save-when-quitting)
[Show Container Content Info](#ui-show-container-content-info)
[Show Player Inventory Counts](#ui-show-player-inventory-counts)
[Show Player Tooltip Item Count](#ui-show-player-tooltip-item-count)
[Show Rocket Counts](#ui-show-rocket-counts)
[Pin Recipe to Screen](#ui-pin-recipe-to-screen) | [Load Inventories Faster](#perf-load-inventories-faster)
[Reduce Save Size](#perf-reduce-save-size)
[Support Mods with Load n Save](#lib-support-mods-with-load-n-save) | ## (Cheat) Asteroid Landing Position Override @@ -397,6 +397,14 @@ the crafting action will succeed if the rest of the materials are in your backpa None. +## (UI) Save When Quitting + +Automatically saves the game when clicking the "Exit to main menu" button. + +### Configuration + +None. + ## (Lib) Support Mods with Load n Save This mod alters the loading and saving of the game by parsing/appending custom information based on diff --git a/ThePlanetCrafterMods.sln b/ThePlanetCrafterMods.sln index 6f6ff871..35a7128f 100644 --- a/ThePlanetCrafterMods.sln +++ b/ThePlanetCrafterMods.sln @@ -54,6 +54,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UICraftEquipmentInplace", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CheatMinimap", "CheatMinimap\CheatMinimap.csproj", "{99714257-AC6F-4EE3-8321-713808D00B93}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UISaveOnQuit", "UISaveOnQuit\UISaveOnQuit.csproj", "{B38DD082-BCBF-4A0B-8EFC-3095F1FC9496}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -152,6 +154,10 @@ Global {99714257-AC6F-4EE3-8321-713808D00B93}.Debug|Any CPU.Build.0 = Debug|Any CPU {99714257-AC6F-4EE3-8321-713808D00B93}.Release|Any CPU.ActiveCfg = Release|Any CPU {99714257-AC6F-4EE3-8321-713808D00B93}.Release|Any CPU.Build.0 = Release|Any CPU + {B38DD082-BCBF-4A0B-8EFC-3095F1FC9496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B38DD082-BCBF-4A0B-8EFC-3095F1FC9496}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B38DD082-BCBF-4A0B-8EFC-3095F1FC9496}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B38DD082-BCBF-4A0B-8EFC-3095F1FC9496}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UISaveOnQuit/NuGet.Config b/UISaveOnQuit/NuGet.Config new file mode 100644 index 00000000..1864ded5 --- /dev/null +++ b/UISaveOnQuit/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/UISaveOnQuit/Plugin.cs b/UISaveOnQuit/Plugin.cs new file mode 100644 index 00000000..f8de47d4 --- /dev/null +++ b/UISaveOnQuit/Plugin.cs @@ -0,0 +1,31 @@ +using BepInEx; +using MijuTools; +using BepInEx.Configuration; +using SpaceCraft; +using UnityEngine.InputSystem; +using HarmonyLib; +using UnityEngine.EventSystems; +using System.Collections.Generic; + +namespace UISaveOnQuit +{ + [BepInPlugin("akarnokd.theplanetcraftermods.saveonquit", "(UI) Save When Quitting", "1.0.0.0")] + public class Plugin : BaseUnityPlugin + { + + private void Awake() + { + // Plugin startup logic + Logger.LogInfo($"Plugin is loaded!"); + + Harmony.CreateAndPatchAll(typeof(Plugin)); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(UiWindowPause), nameof(UiWindowPause.OnQuit))] + static void UiWindowPause_OnQuit(UiWindowPause __instance) + { + __instance.OnSave(); + } + } +} diff --git a/UISaveOnQuit/UISaveOnQuit.csproj b/UISaveOnQuit/UISaveOnQuit.csproj new file mode 100644 index 00000000..aee1b33e --- /dev/null +++ b/UISaveOnQuit/UISaveOnQuit.csproj @@ -0,0 +1,66 @@ + + + + net462 + UISaveOnQuit + (UI) Save When Quitting + 1.0.0.0 + true + latest + AnyCPU + AnyCPU + + + c:\Program Files (x86)\Steam\steamapps\common\The Planet Crafter\ + $(GameDir)Planet Crafter_Data\Managed\ + $(GameDir)\BepInEx\plugins + + + e:\Steam\steamapps\common\The Planet Crafter\ + $(GameDir)Planet Crafter_Data\Managed\ + $(GameDir)\BepInEx\plugins + + + + + + + + + + + + + + + + False + $(GameManaged)\Assembly-CSharp.dll + False + + + False + $(GameManaged)com.mijugames.miju-tools.dll + False + + + False + $(GameManaged)unity.inputsystem.dll + False + + + False + $(GameManaged)unityengine.ui.dll + False + + + + + + + + +