From b20ac98410728c36f23c504bd5ae5f6449de3c38 Mon Sep 17 00:00:00 2001 From: Marc Philipp Burgmann Date: Fri, 3 Apr 2026 20:55:43 +0200 Subject: [PATCH] Version 1.2.0 --- Behavior.cs | 22 +++++++++++++ CHANGELOG | 15 ++++++++- Plugin.cs | 91 +++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 Behavior.cs diff --git a/Behavior.cs b/Behavior.cs new file mode 100644 index 0000000..7d27f9d --- /dev/null +++ b/Behavior.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace BetterStuff; +public class Behaviour : MonoBehaviour +{ + private float timer = 2f; + private void Update() + { + timer += Time.deltaTime; + if(timer >= 2f) + { + timer = 0f; + foreach (SecurityGuardAnimationController controller in Resources.FindObjectsOfTypeAll()) + { + controller.m_Agent.speed = Plugin.securityGuardSpeed.Value; + controller.m_Agent.acceleration *= Plugin.acceleration; + controller.m_Agent.angularSpeed *= Plugin.angularSpeed; + controller.m_AnimationWalkingSpeed = Plugin.securityGuardSpeed.Value; + } + } + } +} \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index 3928789..60a6418 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,19 @@ 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.2.0] - 2026-04-03 + +### Added +- Increased the walk speed of backer + +### Fixed +- Fix securityguard walkspeed don't work + +## [1.1.1] - 2026-03-31 + +### Fixed +- Fix janitor walkspeed don't work + ## [1.1.0] - 2026-01-25 ### Added @@ -19,4 +32,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Increased the scanning speed of cashiers - Increased the time until the paymentprocess is finished - Increased the time between scanningprocess an paymentprocess -- Increased the walk speed of Restockers \ No newline at end of file +- Increased the walk speed of restockers \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs index 9994b9c..983a553 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -4,6 +4,10 @@ using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; +using Il2CppInterop.Runtime.Injection; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.SceneManagement; namespace BetterStuff; @@ -12,9 +16,12 @@ public class Plugin : BasePlugin { public const string PLUGIN_GUID = "de.mpburgmann.BetterStuff"; public const string PLUGIN_NAME = "Better Stuff"; - public const string PLUGIN_VERSION = "1.1.1"; + public const string PLUGIN_VERSION = "1.2.0"; internal static new ManualLogSource Log; + public const float acceleration = 200f; + public const float angularSpeed = 200f; + private static ConfigEntry scanTime; private static ConfigEntry finishDuration; private static ConfigEntry timeAfterScans; @@ -23,8 +30,9 @@ public class Plugin : BasePlugin private static ConfigEntry selfcheckoutPlayerSpeed; private static ConfigEntry customerHelperScanningSpeed; private static ConfigEntry customerHelperSpeed; - private static ConfigEntry securityGuardSpeed; + public static ConfigEntry securityGuardSpeed; private static ConfigEntry janitorSpeed; + private static ConfigEntry bakerSpeed; public override void Load() @@ -43,15 +51,19 @@ public class Plugin : BasePlugin selfcheckoutPlayerSpeed = Config.Bind("Selfcheckout", "Player Speed", 0.3f, "Default vanilla value is 0.6."); customerHelperScanningSpeed = Config.Bind("Customer Helper", "Scanning Speed", 0.5f, "Default vanilla value is 1.5."); - customerHelperSpeed = Config.Bind("Customer Helper", "Speed", 5f, "Default value is 2."); + customerHelperSpeed = Config.Bind("Customer Helper", "Speed", 5f, "Default vanilla value is 2."); - securityGuardSpeed = Config.Bind("Security Guard", "Speed", 5f, "Default value is 2."); + securityGuardSpeed = Config.Bind("Security Guard", "Speed", 5f, "Default vanilla value is 2."); - janitorSpeed = Config.Bind("Janitor", "Speed", 5f, "Default value is 2."); + janitorSpeed = Config.Bind("Janitor", "Speed", 5f, "Default vanilla value is 2."); + + bakerSpeed = Config.Bind("Baker", "Speed", 5f, "Default vanilla value is 2."); Harmony harmony = new(PLUGIN_GUID); harmony.PatchAll(); + + SceneManager.sceneLoaded += (UnityAction) OnSceneLoaded; } [HarmonyPatch(typeof(Cashier), "Start")] @@ -85,8 +97,8 @@ public class Plugin : BasePlugin public static void Postfix(Restocker __instance) { __instance.m_Agent.speed = restockerSpeed.Value; - __instance.m_Agent.acceleration *= 200f; - __instance.m_Agent.angularSpeed *= 200f; + __instance.m_Agent.acceleration *= acceleration; + __instance.m_Agent.angularSpeed *= angularSpeed; } } @@ -114,33 +126,66 @@ public class Plugin : BasePlugin __instance.m_CustomerHelperScanIntervals = new Il2CppSystem.Collections.Generic.List(1); __instance.m_CustomerHelperScanIntervals.Add(customerHelperScanningSpeed.Value); __instance.m_Agent.speed = customerHelperSpeed.Value; - __instance.m_Agent.acceleration *= 200f; - __instance.m_Agent.angularSpeed *= 200f; + __instance.m_Agent.acceleration *= acceleration; + __instance.m_Agent.angularSpeed *= angularSpeed; } } - [HarmonyPatch(typeof(SecurityGuard), "Start")] - public static class SecurityGuard_Start_Patch - { - [HarmonyPostfix] - public static void Postfix(SecurityGuard __instance) - { - __instance.m_AnimController.m_Agent.speed = securityGuardSpeed.Value; - __instance.m_AnimController.m_Agent.acceleration *= 200f; - __instance.m_AnimController.m_Agent.angularSpeed *= 200f; - } - } + // [HarmonyPatch(typeof(SecurityGuardAnimationController), "Start")] + // public static class SecurityGuardAnimationController_Start_Patch + // { + // [HarmonyPostfix] + // public static void Postfix(SecurityGuardAnimationController __instance) + // { + // __instance.m_Agent.speed = securityGuardSpeed.Value; + // __instance.m_Agent.acceleration *= acceleration; + // __instance.m_Agent.angularSpeed *= angularSpeed; - [HarmonyPatch(typeof(Janitor), "Start")] + // } + // } + + [HarmonyPatch(typeof(Janitor), "Start")] public static class Janitor_Start_Patch { [HarmonyPostfix] public static void Postfix(Janitor __instance) { __instance.m_Agent.speed = janitorSpeed.Value; - __instance.m_Agent.acceleration *= 200f; - __instance.m_Agent.angularSpeed *= 200f; + __instance.m_Agent.acceleration *= acceleration; + __instance.m_Agent.angularSpeed *= angularSpeed; } } + [HarmonyPatch(typeof(Baker), "Start")] + public static class Baker_Start_Patch + { + [HarmonyPostfix] + public static void Postfix(Baker __instance) + { + __instance.m_Agent.speed = bakerSpeed.Value; + __instance.m_Agent.acceleration *= acceleration; + __instance.m_Agent.angularSpeed *= angularSpeed; + + } + } + + private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + if (scene.name == "Main Scene") + { + ClassInjector.RegisterTypeInIl2Cpp(); + GameObject gameObject = new("BetterStuffBehaviour"); + Object.DontDestroyOnLoad(gameObject); + gameObject.AddComponent(); + } + + if(scene.name == "Main Menu") + { + Object gameObject = GameObject.Find("BetterStuffBehaviour"); + if(gameObject != null) + { + Object.Destroy(gameObject); + } + } + } } \ No newline at end of file