using MSCLoader;
using UnityEngine;
namespace MSCO
{
public class MSCO : Mod
{
///
/// Version der Mod (MSCLoader / MSC Launcher). Kleine Updates: nur die dritte Stelle erhöhen (2.8.1, 2.8.2 ...) -
/// sie bleiben mit 2.8-Servern und -Mitspielern kompatibel.
///
public const string ModVersion = "2.8.1";
///
/// Netzwerk-Version (die ersten beiden Stellen). Nur erhöhen, wenn sich das Protokoll inkompatibel ändert - dann
/// auch GameServer.ModVersion im Server und eine neue Mod-Version 2.9.0 o.ä.
///
public const string ProtocolVersion = "2.8";
/// Passt eine andere Version (Server, Host, Mitspieler) zu uns? Verglichen werden nur die ersten zwei Stellen.
public static bool Compatible(string other)
{
return Protocol(other) == ProtocolVersion;
}
/// "2.8.3" -> "2.8"
public static string Protocol(string version)
{
if (string.IsNullOrEmpty(version)) return "";
string[] parts = version.Trim().Split('.');
return parts.Length >= 2 ? parts[0] + "." + parts[1] : version.Trim();
}
public override string ID => "MSCO"; // Your (unique) mod ID
public override string Name => "MSCO"; // Your mod name
public override string Author => "MBM"; // Name of the Author (your name)
public override string Version => ModVersion; // Version
public override string Description => "Online mod by mbm.wtf"; // Short description of your mod
public override Game SupportedGames => Game.MySummerCar;
// Logo in der MSCLoader-Modliste (branding/logo-128.png, in die DLL eingebettet)
public override byte[] Icon { get { return Branding.LogoPng; } set { } }
bool commandAdded;
public override void ModSetup()
{
SetupFunction(Setup.OnMenuLoad, Mod_OnMenuLoad);
SetupFunction(Setup.OnLoad, Mod_OnLoad);
SetupFunction(Setup.PostLoad, Mod_PostLoad);
SetupFunction(Setup.OnSave, Mod_OnSave);
SetupFunction(Setup.OnGUI, Mod_OnGUI);
SetupFunction(Setup.Update, Mod_Update);
SetupFunction(Setup.FixedUpdate, Mod_FixedUpdate);
SetupFunction(Setup.ModSettings, Mod_Settings);
}
/// Taste zum Ein-/Aussteigen als Beifahrer (in den MSCLoader-Einstellungen änderbar).
internal static SettingsKeybind PassengerKey;
/// MSCO-Konsole (Standard F7) und Chat (Standard T), ebenfalls änderbar.
internal static SettingsKeybind ConsoleKey, ChatKey;
private void Mod_Settings()
{
// All settings should be created here.
// DO NOT put anything that isn't settings or keybinds in here!
PassengerKey = Keybind.Add("passenger", "Ride as passenger (toggle)", KeyCode.P);
ChatKey = Keybind.Add("chat", "Open chat", KeyCode.T);
// Nicht F8: im Pausenmenü öffnet F8 ein Test-Menü des Spiels. Neue ID, damit alte F8-Belegungen nicht übernommen werden
ConsoleKey = Keybind.Add("console_f7", "Open MSCO console", KeyCode.F7);
}
private void Mod_OnMenuLoad()
{
MscoLog.Info("Welcome to MSCO by mbm.wtf");
// Netzwerk + Lobby leben in einem eigenen Objekt, das Szenenwechsel überlebt
MultiplayerManager.Ensure();
if (!commandAdded)
{
ConsoleCommand.Add(new MpCommand());
commandAdded = true;
}
}
private void Mod_OnLoad()
{
// Called once, when mod is loading after game is fully loaded
}
private void Mod_PostLoad()
{
// Called once, after all mods finished OnLoad
}
private void Mod_OnSave()
{
// Called once, when save and quit
}
private void Mod_OnGUI()
{
// Lobby/Status zeichnet der MultiplayerManager
}
private void Mod_Update()
{
// Netzwerk läuft im MultiplayerManager
}
private void Mod_FixedUpdate()
{
// FixedUpdate is called once per fixed frame
}
}
}