From 8830516607c7a7fa318d092a140a2f115caf334d Mon Sep 17 00:00:00 2001 From: Marc Philipp Burgmann Date: Sat, 4 Apr 2026 00:06:22 +0200 Subject: [PATCH] updated to newest game version --- .gitignore | 7 +- CHANGELOG | 16 ++++ Plugin.cs | 176 +++++++++++++++++++---------------- UnrestrictedPlacement.csproj | 95 ++++++++++--------- 4 files changed, 165 insertions(+), 129 deletions(-) create mode 100644 CHANGELOG diff --git a/.gitignore b/.gitignore index 6af359e..e591375 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -.git/ -bin/ -lib/ -obj/ +.git/ +bin/ +obj/ *.sln \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..e5b642d --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.1] - 2026-04-04 + +### Fixed +- fixed to work with the latest game version + +## [1.0.0] - 2026-01-10 + +### Added +- Initial release \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs index 7026c22..7fbbb7d 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,79 +1,97 @@ -using BepInEx; -using BepInEx.Configuration; -using BepInEx.Logging; -using BepInEx.Unity.IL2CPP; -using BepInEx.Unity.IL2CPP.UnityEngine; -using HarmonyLib; -using Il2CppInterop.Runtime.Injection; -using UnityEngine; -using KeyCode = BepInEx.Unity.IL2CPP.UnityEngine.KeyCode; - -namespace UnrestrictedPlacement; - -[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] -public class Plugin : BasePlugin -{ - internal static new ManualLogSource Log; - public static ConfigEntry Enabled {get; set;} - private static bool Once = false; - public static ConfigEntry SwitchKey {get; set;} - - public override void Load() - { - Log = base.Log; - Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!"); - Harmony harmony = new(MyPluginInfo.PLUGIN_GUID); - harmony.PatchAll(); - - ClassInjector.RegisterTypeInIl2Cpp(); - GameObject gameObject = new("UnrestrictedPlacementBehaviour"); - Object.DontDestroyOnLoad(gameObject); - gameObject.AddComponent(); - - Enabled = Config.Bind("Settings", "Enabled", true); - SwitchKey = Config.Bind("Settings", "SwitchKey", KeyCode.F8, "The key with which to enable and disable the mod."); - } - - public static class UnrestrictedPlacementPatch - { - [HarmonyPatch(typeof(FurniturePlacer), "PlacingRaycast")] - public static class FurniturePlacer_PlacingRaycast_Patch - { - [HarmonyPostfix] - public static void Postfix(FurniturePlacer __instance) - { - if (!Plugin.Enabled.Value) return; - __instance.m_CurrentPlacingMode.PlacedOnCorrectSurface = true; - } - } - - [HarmonyPatch(typeof(IPlacingMode), "UpdateHologramColor")] - public static class IPlacingMode_UpdateHologramColor_Patch - { - [HarmonyPostfix] - public static void Postfix(IPlacingMode __instance) - { - if (!Plugin.Enabled.Value) return; - __instance.HologramColor = Color.green; - __instance.m_Triggers.Clear(); - } - } - } - - public class Behaviour : MonoBehaviour - { - internal void Update() - { - if(Input.GetKeyInt(Plugin.SwitchKey.Value) && !Once) - { - Enabled.Value = !Enabled.Value; - Log.LogError($"Plugin {MyPluginInfo.PLUGIN_GUID} is enabled: {Enabled}"); - Once = true; - } - else if(!Input.GetKeyInt(Plugin.SwitchKey.Value) && Once) - { - Once = false; - } - } - } -} +using BepInEx; +using BepInEx.Configuration; +using BepInEx.Logging; +using BepInEx.Unity.IL2CPP; +using HarmonyLib; +using Il2CppInterop.Runtime.Injection; +using UnityEngine; + +namespace UnrestrictedPlacement; + +[BepInPlugin(PLUGIN_GUID, PLUGIN_NAME, PLUGIN_VERSION)] +public class Plugin : BasePlugin +{ + public const string PLUGIN_GUID = "de.mpburgmann.UnrestrictedPlacement"; + public const string PLUGIN_NAME = "Unrestricted Placement"; + public const string PLUGIN_VERSION = "1.0.1"; + internal static new ManualLogSource Log; + public static ConfigEntry Enabled; + public static ConfigEntry SwitchKey; + + public override void Load() + { + Log = base.Log; + Log.LogInfo($"Plugin {PLUGIN_GUID} is loaded!"); + + ClassInjector.RegisterTypeInIl2Cpp(); + GameObject gameObject = new("UnrestrictedPlacementBehaviour"); + Object.DontDestroyOnLoad(gameObject); + gameObject.AddComponent(); + + Enabled = Config.Bind("Settings", "Enabled", true); + SwitchKey = Config.Bind("Settings", "SwitchKey", KeyCode.F8, "The key with which to enable and disable the mod."); + + Harmony harmony = new(PLUGIN_GUID); + harmony.PatchAll(); + } + + public static class UnrestrictedPlacementPatch + { + [HarmonyPatch(typeof(FurniturePlacer), "PlaceFurniture")] + public static class FurniturePlacer_PlaceFurniture_Patch + { + [HarmonyPrefix] + public static void Prefix(FurniturePlacer __instance) + { + if (!Enabled.Value) return; + __instance.m_CurrentPlacingMode.PlacedOnCorrectSurface = true; + } + } + + [HarmonyPatch(typeof(FurniturePlacer), "PlacingRaycast")] + public static class FurniturePlacer_PlacingRaycast_Patch + { + [HarmonyPostfix] + public static void Postfix(FurniturePlacer __instance) + { + if (!Enabled.Value) return; + __instance.m_CurrentPlacingMode.PlacedOnCorrectSurface = true; + } + } + + [HarmonyPatch(typeof(IPlacingMode), "OverlapBoxes")] + public static class IPlacingMode_OverlapsBoxes_Patch + { + [HarmonyPrefix] + public static bool Prefix(IPlacingMode __instance) + { + if (!Enabled.Value) return true; + __instance.m_Triggers.Clear(); + return false; + } + } + + [HarmonyPatch(typeof(IPlacingMode), "UpdateHologramColor")] + public static class IPlacingMode_UpdateHologramColor_Patch + { + [HarmonyPostfix] + public static void Postfix(IPlacingMode __instance) + { + if (!Enabled.Value) return; + __instance.HologramColor = Color.green; + } + } + } + + public class Behaviour : MonoBehaviour + { + internal void Update() + { + if(Input.GetKeyDown(SwitchKey.Value)) + { + Enabled.Value = !Enabled.Value; + Log.LogError($"Plugin {PLUGIN_GUID} is enabled: {Enabled.Value}"); + } + } + } +} diff --git a/UnrestrictedPlacement.csproj b/UnrestrictedPlacement.csproj index c404a29..57ffde2 100644 --- a/UnrestrictedPlacement.csproj +++ b/UnrestrictedPlacement.csproj @@ -1,46 +1,49 @@ - - - - net6.0 - UnrestrictedPlacement - Unrestricted Placement - 1.0.0 - true - latest - - https://api.nuget.org/v3/index.json; - https://nuget.bepinex.dev/v3/index.json; - https://nuget.samboy.dev/v3/index.json - - UnrestrictedPlacement - - - - - - - - - - ..\lib\Assembly-CSharp.dll - - - ..\lib\MyBox.dll - - - ..\lib\Il2Cppmscorlib.dll - - - ..\lib\UnityEngine.PhysicsModule.dll - - - ..\lib\UnityEngine.CoreModule.dll - - - ..\lib\Unity.InputSystem.dll - - - ..\lib\UnityEngine.AIModule.dll - - - + + + + net6.0 + UnrestrictedPlacement + Unrestricted Placement + 1.0.1 + true + latest + + https://api.nuget.org/v3/index.json; + https://nuget.bepinex.dev/v3/index.json; + https://nuget.samboy.dev/v3/index.json + + UnrestrictedPlacement + + + + + + + + + + ..\lib\Assembly-CSharp.dll + + + ..\lib\MyBox.dll + + + ..\lib\Il2Cppmscorlib.dll + + + ..\lib\UnityEngine.PhysicsModule.dll + + + ..\lib\UnityEngine.CoreModule.dll + + + ..\lib\Unity.InputSystem.dll + + + ..\lib\UnityEngine.AIModule.dll + + + ..\lib\UnityEngine.InputLegacyModule.dll + + +