1
0

initial commit

This commit is contained in:
2026-04-04 01:38:38 +02:00
commit e217ee89fe
6 changed files with 162 additions and 0 deletions

5
.gitignore vendored Executable file
View File

@@ -0,0 +1,5 @@
.git/
.vs/
bin/
obj/
*.sln

49
AutoLight.csproj Executable file
View File

@@ -0,0 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>AutoLight</AssemblyName>
<Product>AutoLight</Product>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json;
https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources>
<RootNamespace>UnrestrictedPlacement</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.*" IncludeAssets="compile" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp" Publicize="true">
<HintPath>..\lib\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="MyBox" Publicize="true">
<HintPath>..\lib\MyBox.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib" Publicize="true">
<HintPath>..\lib\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule" Publicize="true">
<HintPath>..\lib\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule" Publicize="true">
<HintPath>..\lib\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem" Publicize="true">
<HintPath>..\lib\Unity.InputSystem.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule" Publicize="true">
<HintPath>..\lib\UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule" Publicize="true">
<HintPath>..\lib\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

29
Behaviour.cs Normal file
View File

@@ -0,0 +1,29 @@
using MyBox;
using UnityEngine;
namespace AutoLight;
public class Behaviour : MonoBehaviour
{
private LightSwitch[] LightSwitches;
private void Start()
{
LightSwitches = Object.FindObjectsOfType<LightSwitch>();
}
private void Update()
{
DayCycleManager __instance = Singleton<DayCycleManager>.Instance;
StoreLightManager __storelightmanager = Singleton<StoreLightManager>.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();
}
}
}
}
}

12
CHANGELOG Normal file
View File

@@ -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

21
LICENSE Normal file
View File

@@ -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.

46
Plugin.cs Executable file
View File

@@ -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<Scene, LoadSceneMode>) OnSceneLoaded;
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (scene.name == "Main Scene")
{
ClassInjector.RegisterTypeInIl2Cpp<Behaviour>();
GameObject gameObject = new("AutoLightBehaviour");
Object.DontDestroyOnLoad(gameObject);
gameObject.AddComponent<Behaviour>();
}
if(scene.name == "Main Menu")
{
Object gameObject = GameObject.Find("AutoLightBehaviour");
if(gameObject != null)
{
Object.Destroy(gameObject);
}
}
}
}