using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using LabFusion.Network;
using MelonLoader;
using StartServerOnStart;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class1), "StartServerOnStart", "1.0.0", "Hazzy", null)]
[assembly: AssemblyTitle("StartServerOnStart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StartServerOnStart")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E3C0F4BC-7550-4B10-9B90-3DD33051614F")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StartServerOnStart;
public class Class1 : MelonMod
{
public bool isInServer = false;
public override void OnInitializeMelon()
{
Hooking.OnLevelInitialized += HookingOnOnLevelInitialized;
}
private void HookingOnOnLevelInitialized(LevelInfo obj)
{
if (!NetworkInfo.HasServer && !isInServer)
{
NetworkHelper.StartServer();
isInServer = true;
}
}
}