commit e217ee89fe8a99a0448e010f4a03e49924090aa4 Author: Marc Philipp Burgmann Date: Sat Apr 4 01:38:38 2026 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..ee24f1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.git/ +.vs/ +bin/ +obj/ +*.sln diff --git a/AutoLight.csproj b/AutoLight.csproj new file mode 100755 index 0000000..ddf88b7 --- /dev/null +++ b/AutoLight.csproj @@ -0,0 +1,49 @@ + + + + net6.0 + AutoLight + AutoLight + 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 + + + ..\lib\UnityEngine.InputLegacyModule.dll + + + diff --git a/Behaviour.cs b/Behaviour.cs new file mode 100644 index 0000000..f8f3fb8 --- /dev/null +++ b/Behaviour.cs @@ -0,0 +1,29 @@ +using MyBox; +using UnityEngine; + +namespace AutoLight; +public class Behaviour : MonoBehaviour +{ + private LightSwitch[] LightSwitches; + private void Start() + { + LightSwitches = Object.FindObjectsOfType(); + } + + private void Update() + { + DayCycleManager __instance = Singleton.Instance; + StoreLightManager __storelightmanager = Singleton.Instance; + if (__instance.CurrentHour == 6 && __instance.CurrentMinute == 0 && __instance.AM == false) + { + for (int i = 0; i < LightSwitches.Length; i++) + { + LightSwitch lightSwitch = LightSwitches[i]; + if (!__storelightmanager.m_IsOn) + { + lightSwitch.InstantInteract(); + } + } + } + } +} \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..6cad5ab --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,12 @@ +# 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.0] - 2026-04-04 + +### Added +- Initial release +- turns on the lights at 6:00 PM \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2667006 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Marc Philipp Burgmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs new file mode 100755 index 0000000..d57eb15 --- /dev/null +++ b/Plugin.cs @@ -0,0 +1,46 @@ +using BepInEx; +using BepInEx.Logging; +using BepInEx.Unity.IL2CPP; +using Il2CppInterop.Runtime.Injection; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.SceneManagement; + +namespace AutoLight; + +[BepInPlugin(PLUGIN_GUID, PLUGIN_NAME, PLUGIN_VERSION)] +public class Plugin : BasePlugin +{ + public const string PLUGIN_GUID = "de.mpburgmann.AutoLight"; + public const string PLUGIN_NAME = "AutoLight"; + public const string PLUGIN_VERSION = "1.0.0"; + internal static new ManualLogSource Log; + + public override void Load() + { + Log = base.Log; + Log.LogInfo($"Plugin {PLUGIN_GUID} is loaded!"); + + SceneManager.sceneLoaded += (UnityAction) OnSceneLoaded; + } + + private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + if (scene.name == "Main Scene") + { + ClassInjector.RegisterTypeInIl2Cpp(); + GameObject gameObject = new("AutoLightBehaviour"); + Object.DontDestroyOnLoad(gameObject); + gameObject.AddComponent(); + } + + if(scene.name == "Main Menu") + { + Object gameObject = GameObject.Find("AutoLightBehaviour"); + if(gameObject != null) + { + Object.Destroy(gameObject); + } + } + } +} \ No newline at end of file