From 8b0833ad24f22da023529340fb64e82a92e55175 Mon Sep 17 00:00:00 2001 From: EvilPunkin <82129788+EvilPunkin@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:24:32 -0700 Subject: [PATCH] i forgor what i added :( but i think things work now --- dumb282tweaks/CarPatch.cs | 172 ++++++++++++++++++++++++ dumb282tweaks/InteriorPatch.cs | 36 +++++ dumb282tweaks/Main.cs | 232 +++++++++++---------------------- dumb282tweaks/Patch282.cs | 11 -- dumb282tweaks/Settings.cs | 60 +++++++++ 5 files changed, 346 insertions(+), 165 deletions(-) create mode 100644 dumb282tweaks/CarPatch.cs create mode 100644 dumb282tweaks/InteriorPatch.cs delete mode 100644 dumb282tweaks/Patch282.cs create mode 100644 dumb282tweaks/Settings.cs diff --git a/dumb282tweaks/CarPatch.cs b/dumb282tweaks/CarPatch.cs new file mode 100644 index 0000000..a9205cf --- /dev/null +++ b/dumb282tweaks/CarPatch.cs @@ -0,0 +1,172 @@ +using DV.ThingTypes; +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static dumb282tweaks.Main; +using UnityEngine; + +namespace dumb282tweaks; + +[HarmonyPatch(typeof(TrainCar), "Start")] +class CarPatch { + static void Postfix(ref TrainCar __instance) { + // Smoke Deflector Type + if(__instance != null && __instance.carType == TrainCarType.LocoSteamHeavy) { + // This is a terrible way to get the mesh of the locomotive since a simple gameobject reordering will break it, but it's alright for now. If something breaks, just note that this is likely the reason + Transform s282Body = __instance.transform.GetChild(5).transform.GetChild(0).transform.GetChild(0); + // This is a better way of getting the mesh, but I don't feel like trying to understand transform.Find, so I'll come back this later.I think the directory with slashes needs to be exactly parents and children, no skipping levels + //Transform s282Mesh = __instance.transform.Find("LocoS282A_Body/s282_locomotive_body"); + Material s282Mat = s282Body.GetComponent().material; + s282Body.gameObject.SetActive(false); + + if(Main.Settings.regularBody) { + GameObject s282BodyNew = UnityEngine.Object.Instantiate(s282BodyLoad); + + s282BodyNew.transform.GetChild(0).GetComponent().material = s282Mat; + + s282BodyNew.transform.parent = __instance.transform; + s282BodyNew.transform.localPosition = new Vector3(0, -0.13f, 6.98f); + s282BodyNew.transform.localRotation = Quaternion.identity; + } + + //switch(Main.Settings.boilerType) { + // case Settings.BoilerType.Default: + // break; + // case Settings.BoilerType.Streamlined: + // GameObject streamlinedBoiler = UnityEngine.Object.Instantiate(streamlineLoad); + + // streamlinedBoiler.transform.GetChild(0).GetComponent().material = s282Mat; + + // streamlinedBoiler.transform.parent = __instance.transform; + // streamlinedBoiler.transform.localPosition = new Vector3(0, 2.15f, 5.1f); + // streamlinedBoiler.transform.localRotation = Quaternion.identity; + // break; + //} + + // Cab Type + switch(Main.Settings.cabType) { + case Settings.CabType.Default: + GameObject defaultCab = UnityEngine.Object.Instantiate(defaultCabLoad); + + defaultCab.transform.GetChild(0).GetComponent().material = s282Mat; + + defaultCab.transform.parent = __instance.transform; + defaultCab.transform.localPosition = new Vector3(0, -0.13f, 6.98f); + defaultCab.transform.localRotation = Quaternion.identity; + break; + case Settings.CabType.German: + GameObject germanCab = UnityEngine.Object.Instantiate(germanCabLoad); + + germanCab.transform.GetChild(0).GetComponent().material = s282Mat; + germanCab.transform.GetChild(1).GetComponent().material = s282Mat; + germanCab.transform.GetChild(2).GetComponent().material = s282Mat; + germanCab.transform.GetChild(3).GetComponent().material = s282Mat; + + germanCab.transform.parent = __instance.transform; + germanCab.transform.localPosition = new Vector3(0, -0.13f, 6.98f); + germanCab.transform.localRotation = Quaternion.identity; + //Log(externalInteractables.name); + + //externalInteractables.gameObject.SetActive(false); + break; + } + + // Smoke Deflector + switch(Main.Settings.smokeDeflectorType) { + case Settings.SmokeDeflectorType.None: + break; + case Settings.SmokeDeflectorType.Witte: + GameObject witteSmokeDeflector = UnityEngine.Object.Instantiate(witteSmokeDeflectorsLoad); + + //This is a terrible way to set the material of the smoke deflectors, but oh well + witteSmokeDeflector.transform.GetChild(0).GetComponent().material = s282Mat; + witteSmokeDeflector.transform.GetChild(1).GetComponent().material = s282Mat; + witteSmokeDeflector.transform.GetChild(3).GetComponent().material = s282Mat; + + witteSmokeDeflector.transform.parent = __instance.transform; + witteSmokeDeflector.transform.localPosition = new Vector3(0, -0.15f, 6.9f); + witteSmokeDeflector.transform.localRotation = Quaternion.identity; + Log("witte"); + if(Main.Settings.bluetooth) { + witteSmokeDeflector.transform.GetChild(0).gameObject.SetActive(false); + } + break; + case Settings.SmokeDeflectorType.Wagner: + GameObject wagnerSmokeDeflector = UnityEngine.Object.Instantiate(wagnerSmokeDeflectorsLoad); + + // This is still a terrible way to set the material of the smoke deflectors + wagnerSmokeDeflector.transform.GetChild(0).GetComponent().material = s282Mat; + wagnerSmokeDeflector.transform.GetChild(1).GetComponent().material = s282Mat; + + wagnerSmokeDeflector.transform.parent = __instance.transform; + wagnerSmokeDeflector.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + wagnerSmokeDeflector.transform.localRotation = Quaternion.identity; + Log("witten't"); + break; + } + + // Smoke Stack + switch(Main.Settings.smokeStackType) { + case Settings.SmokeStackType.Default: + GameObject defaultSmokeStack = UnityEngine.Object.Instantiate(defaultSmokeStackLoad); + + defaultSmokeStack.transform.GetChild(0).GetComponent().material = s282Mat; + + defaultSmokeStack.transform.parent = __instance.transform; + defaultSmokeStack.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + defaultSmokeStack.transform.localRotation = Quaternion.identity; + break; + case Settings.SmokeStackType.Short: + GameObject shortSmokeStack = UnityEngine.Object.Instantiate(shortSmokeStackLoad); + + shortSmokeStack.transform.GetChild(0).GetComponent().material = s282Mat; + + shortSmokeStack.transform.parent = __instance.transform; + shortSmokeStack.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + shortSmokeStack.transform.localRotation = Quaternion.identity; + break; + } + + // Extras + if(Main.Settings.cowCatcher) { + GameObject cowCatcher = UnityEngine.Object.Instantiate(cowCatcherLoad); + + cowCatcher.transform.GetChild(0).GetComponent().material = s282Mat; + + cowCatcher.transform.parent = __instance.transform; + cowCatcher.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + cowCatcher.transform.localRotation = Quaternion.identity; + } + if(Main.Settings.frontCover) { + GameObject frontCover = UnityEngine.Object.Instantiate(frontCoverLoad); + + frontCover.transform.GetChild(0).GetComponent().material = s282Mat; + + frontCover.transform.parent = __instance.transform; + frontCover.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + frontCover.transform.localRotation = Quaternion.identity; + } + if(Main.Settings.railings) { + GameObject railings = UnityEngine.Object.Instantiate(railingsLoad); + + railings.transform.GetChild(0).GetComponent().material = s282Mat; + + railings.transform.parent = __instance.transform; + railings.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + railings.transform.localRotation = Quaternion.identity; + } + if(Main.Settings.walkway) { + GameObject walkway = UnityEngine.Object.Instantiate(walkwayLoad); + + walkway.transform.GetChild(0).GetComponent().material = s282Mat; + + walkway.transform.parent = __instance.transform; + walkway.transform.localPosition = new Vector3(0, -0.15f, 6.98f); + walkway.transform.localRotation = Quaternion.identity; + } + } + } +} diff --git a/dumb282tweaks/InteriorPatch.cs b/dumb282tweaks/InteriorPatch.cs new file mode 100644 index 0000000..4919e28 --- /dev/null +++ b/dumb282tweaks/InteriorPatch.cs @@ -0,0 +1,36 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static dumb282tweaks.Main; + +namespace dumb282tweaks; + +[HarmonyPatch(typeof(TrainCar), "LoadInterior")] +class InteriorPatch { + static void Postfix(ref TrainCar __instance) { + Transform s282Interior = __instance.interior; + Transform externalInteractables = s282Interior.transform.Find("LocoS282A_ExternalInteractables(Clone)"); + // The fact that in game it actually is called "things" is funny to me + Transform cab = s282Interior.transform.Find("LocoS282A_Interior(Clone)/Static/Cab"); + Transform things = s282Interior.transform.Find("LocoS282A_Interior(Clone)/Static/Things"); + Transform windowRMove = externalInteractables.transform.Find("Interactables/WindowR"); + Transform windowLMove = externalInteractables.transform.Find("Interactables/WindowL"); + + Log(externalInteractables.name); + + switch(Main.Settings.cabType) { + case Settings.CabType.Default: + break; + case Settings.CabType.German: + cab.gameObject.SetActive(false); + things.gameObject.SetActive(false); + windowRMove.gameObject.SetActive(false); + windowLMove.gameObject.SetActive(false); + break; + } + } +} diff --git a/dumb282tweaks/Main.cs b/dumb282tweaks/Main.cs index 8f51653..518e045 100644 --- a/dumb282tweaks/Main.cs +++ b/dumb282tweaks/Main.cs @@ -4,84 +4,50 @@ using System.Reflection; using HarmonyLib; using UnityModManagerNet; using UnityEngine; -using System.Collections.Generic; -using DV; -using DV.Utils; -using DV.Simulation; -using DV.Common; -using System.Linq; -using System.Threading.Tasks; -using DV.RemoteControls; -using DV.Wheels; -using DV.Simulation.Cars; -using DV.ThingTypes; -using LocoSim.Implementations; -using static Oculus.Avatar.CAPI; -using UnityEngine.UI; -using System.ComponentModel; -using static UnityModManagerNet.UnityModManager.Param; -using static dumb282tweaks.Main; +using System.Diagnostics.CodeAnalysis; namespace dumb282tweaks; public static class Main { // Variables - public static UnityModManager.ModEntry Instance { get; private set; } - public static dumb282tweaksSettings Settings { get; private set; } + [AllowNull] public static UnityModManager.ModEntry Instance { get; private set; } + [AllowNull] public static dumb282tweaksSettings Settings { get; private set; } - public static bool enabled; - - private static readonly string[] cabTypeTexts = new[] { + public static readonly string[] cabTypeTexts = new[] { "Default", "German" }; - public enum CabType { - [Description("Default 282 Cab")] - Default, - [Description("German Cab")] - German - } - - private static readonly string[] smokeDeflectorTypeTexts = new[] { + public static readonly string[] smokeDeflectorTypeTexts = new[] { "None", "Witte", "Wagner" }; - public enum SmokeDeflectorType { - [Description("No Smoke Deflectors")] - None, - [Description("Witte Smoke Deflectors")] - Witte, - [Description("Wagner Smoke Deflectors")] - Wagner, - } - - private static readonly string[] boilerTypeTexts = new[] { + public static readonly string[] boilerTypeTexts = new[] { "Default", "Streamlined" }; - public enum BoilerType { - [Description("Default Boiler")] - Default, - [Description("Streamlined Boiler")] - Streamlined, - } - public class dumb282tweaksSettings : UnityModManager.ModSettings { - public bool toggleTweaks = true; - public CabType cabType = CabType.Default; - public SmokeDeflectorType smokeDeflectorType = SmokeDeflectorType.Wagner; - public BoilerType boilerType = BoilerType.Default; + public static readonly string[] smokeStackTypeTexts = new[] { + "Default", + "Short", + }; + // Base + [AllowNull] public static GameObject s282BodyLoad; + // Boilers + [AllowNull] public static GameObject streamlineLoad; + // Cabs + [AllowNull] public static GameObject defaultCabLoad; + [AllowNull] public static GameObject germanCabLoad; - public override void Save(UnityModManager.ModEntry modEntry) { - Save(this, modEntry); - } - } + [AllowNull] public static GameObject wagnerSmokeDeflectorsLoad; + [AllowNull] public static GameObject witteSmokeDeflectorsLoad; - public static string assetPath; - //public static GameObject germanCabLoad; - public static GameObject wagnerSmokeDeflectorsLoad; - public static GameObject witteSmokeDeflectorsLoad; - public static GameObject streamlinedBoilerLoad; + [AllowNull] public static GameObject defaultSmokeStackLoad; + [AllowNull] public static GameObject shortSmokeStackLoad; + + [AllowNull] public static GameObject cowCatcherLoad; + [AllowNull] public static GameObject frontCoverLoad; + [AllowNull] public static GameObject railingsLoad; + [AllowNull] public static GameObject walkwayLoad; // Load private static bool Load(UnityModManager.ModEntry modEntry) { @@ -93,22 +59,48 @@ public static class Main { Instance.OnGUI = OnGUI; Instance.OnSaveGUI = OnSaveGUI; - modEntry.Logger.Log("gam"); harmony = new Harmony(Instance.Info.Id); harmony.PatchAll(Assembly.GetExecutingAssembly()); - modEntry.Logger.Log("gamer"); - assetPath = Path.Combine(Instance.Path.ToString(), "assets\\"); + string assetPath = Path.Combine(Instance.Path.ToString(), "assets\\"); + + // Base + string baseAssetPath = Path.Combine(assetPath, "Base\\"); + var s282BodyBundle = AssetBundle.LoadFromFile(Path.Combine(baseAssetPath, "s282body")); + s282BodyLoad = s282BodyBundle.LoadAsset("Assets/S282Body.prefab"); + // Boilers + string boilersAssetPat = Path.Combine(assetPath, "Boilers\\"); + var streamlineBundle = AssetBundle.LoadFromFile(Path.Combine(boilersAssetPat, "streamline")); + streamlineLoad = streamlineBundle.LoadAsset("Assets/Streamline.prefab"); + // Cabs + string cabsAssetPath = Path.Combine(assetPath, "Cabs\\"); + var defaultCabBundle = AssetBundle.LoadFromFile(Path.Combine(cabsAssetPath, "defaultcab")); + defaultCabLoad = defaultCabBundle.LoadAsset("Assets/DefaultCab.prefab"); + var germanCabBundle = AssetBundle.LoadFromFile(Path.Combine(cabsAssetPath, "germancab")); + germanCabLoad = germanCabBundle.LoadAsset("Assets/GermanCab.prefab"); // Smoke Deflectors - var wagnerSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wagnersmokedeflectors")); + string smokeDeflectorsAssetPath = Path.Combine(assetPath, "SmokeDeflectors\\"); + var wagnerSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(smokeDeflectorsAssetPath, "wagnersmokedeflectors")); wagnerSmokeDeflectorsLoad = wagnerSmokeDeflectorsBundle.LoadAsset("Assets/WagnerSmokeDeflectors.prefab"); - var witteSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wittesmokedeflectors")); + var witteSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(smokeDeflectorsAssetPath, "wittesmokedeflectors")); witteSmokeDeflectorsLoad = witteSmokeDeflectorsBundle.LoadAsset("Assets/WitteSmokeDeflectors.prefab"); - - // Boiler - var streamlinedBoilerBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "streamline")); - streamlinedBoilerLoad = streamlinedBoilerBundle.LoadAsset("Assets/Streamline.prefab"); + // Smoke Stacks + string smokeStacksAssetPath = Path.Combine(assetPath, "SmokeStacks\\"); + var defaultSmokeStackBundle = AssetBundle.LoadFromFile(Path.Combine(smokeStacksAssetPath, "defaultsmokestack")); + defaultSmokeStackLoad = defaultSmokeStackBundle.LoadAsset("Assets/DefaultSmokeStack.prefab"); + var shortSmokeStackBundle = AssetBundle.LoadFromFile(Path.Combine(smokeStacksAssetPath, "shortsmokestack")); + shortSmokeStackLoad = shortSmokeStackBundle.LoadAsset("Assets/ShortSmokeStack.prefab"); + // Extras + string extrasAssetPath = Path.Combine(assetPath, "Extras\\"); + var cowCatcherBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "cowcatcher")); + cowCatcherLoad = cowCatcherBundle.LoadAsset("Assets/CowCatcher.prefab"); + var frontCoverBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "frontcover")); + frontCoverLoad = frontCoverBundle.LoadAsset("Assets/FrontCover.prefab"); + var railingsBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "railings")); + railingsLoad = railingsBundle.LoadAsset("Assets/Railings.prefab"); + var walkwayBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "walkway")); + walkwayLoad = walkwayBundle.LoadAsset("Assets/Walkway.prefab"); } catch(Exception ex) { Instance.Logger.LogException($"Failed to load {Instance.Info.DisplayName}:", ex); harmony?.UnpatchAll(Instance.Info.Id); @@ -123,17 +115,26 @@ public static class Main { GUILayout.BeginVertical(); GUILayout.Label("These settings are applied on train spawn, meaning rejoining the game will refresh all 282 locos to the settings specified here, but if you don't unload the train it will keep whatever settings were there previously. This is a temporary solution until I have a proper GUI implemented."); - - GUILayout.Label("Cab Type"); - Settings.cabType = (CabType)GUILayout.SelectionGrid((int) Settings.cabType, cabTypeTexts, 1, "toggle"); - GUILayout.Space(2); - - GUILayout.Label("Smoke Deflector Type"); - Settings.smokeDeflectorType = (SmokeDeflectorType) GUILayout.SelectionGrid((int) Settings.smokeDeflectorType, smokeDeflectorTypeTexts, 1, "toggle"); + GUILayout.Label("Also, reloading a save will currently break things and the tweaks won't load. This isn't good."); GUILayout.Label("Boiler Type"); - Settings.boilerType = (BoilerType) GUILayout.SelectionGrid((int) Settings.boilerType, boilerTypeTexts, 1, "toggle"); + Settings.boilerType = (Settings.BoilerType) GUILayout.SelectionGrid((int) Settings.boilerType, boilerTypeTexts, 1, "toggle"); + GUILayout.Label("Cab Type"); + Settings.cabType = (Settings.CabType)GUILayout.SelectionGrid((int) Settings.cabType, cabTypeTexts, 1, "toggle"); + GUILayout.Label("Smoke Deflector Type"); + Settings.smokeDeflectorType = (Settings.SmokeDeflectorType) GUILayout.SelectionGrid((int) Settings.smokeDeflectorType, smokeDeflectorTypeTexts, 1, "toggle"); + GUILayout.Label("Smoke Stack Type"); + Settings.smokeStackType = (Settings.SmokeStackType) GUILayout.SelectionGrid((int) Settings.smokeStackType, smokeStackTypeTexts, 1, "toggle"); + GUILayout.Label("Extras"); + Settings.cowCatcher = GUILayout.Toggle(Settings.cowCatcher, "Cow Catcher"); + Settings.frontCover = GUILayout.Toggle(Settings.frontCover, "Front Cover"); + Settings.railings = GUILayout.Toggle(Settings.railings, "Railings"); + Settings.walkway = GUILayout.Toggle(Settings.walkway, "Walkway"); + + GUILayout.Label("The dumb in Dumb S282 Tweaks"); + Settings.bluetooth = GUILayout.Toggle(Settings.bluetooth, "Bluetooth"); + Settings.flattensyour282 = GUILayout.Toggle(Settings.flattensyour282, "Flattens Your 282"); GUILayout.EndVertical(); } @@ -141,83 +142,6 @@ public static class Main { Settings.Save(modEntry); } - - [HarmonyPatch(typeof(TrainCar), "Start")] - class CarPatch { - static void Postfix(ref TrainCar __instance) { - //switch(Settings.cabType) { - // case CabType.Default: - // break; - // case CabType.German: - // if(__instance != null && __instance.carType == TrainCarType.LocoSteamHeavy) { - - // var fullCabBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "fullcab")); - // var fullCabLoad = fullCabBundle.LoadAsset("Assets/FullCab.prefab"); - - // GameObject fullCab = UnityEngine.Object.Instantiate(fullCabLoad); - // fullCab.transform.parent = __instance.transform; - // fullCab.transform.localPosition = new Vector3(0, 3, 0); - // fullCab.transform.localRotation = Quaternion.identity; - // } - // break; - //} - // Smoke Deflector Type - if(__instance != null && __instance.carType == TrainCarType.LocoSteamHeavy) { - // This is a terrible way to get the material of the locomotive since a simple gameobject reordering will break it, but it's alright for now. If something breaks, just note that this is likely the reason - Material s282Mat = __instance.transform.GetChild(5).transform.GetChild(0).transform.GetChild(0).GetComponent().material; - - Log(Path.Combine(assetPath, "wittesmokedeflectors")); - - switch(Settings.smokeDeflectorType) { - case SmokeDeflectorType.None: - break; - case SmokeDeflectorType.Witte: - GameObject witteSmokeDeflector = UnityEngine.Object.Instantiate(witteSmokeDeflectorsLoad); - - // This is also a terrible way to set the material of the smoke deflectors, but oh well - witteSmokeDeflector.transform.GetChild(0).GetComponent().material = s282Mat; - witteSmokeDeflector.transform.GetChild(1).GetComponent().material = s282Mat; - - //Log(smokeDeflector.GetComponent().material.name.ToString()); - witteSmokeDeflector.transform.parent = __instance.transform; - witteSmokeDeflector.transform.localPosition = new Vector3(0, 2.1f, 5f); - witteSmokeDeflector.transform.localRotation = Quaternion.identity; - break; - case SmokeDeflectorType.Wagner: - GameObject wagnerSmokeDeflector = UnityEngine.Object.Instantiate(wagnerSmokeDeflectorsLoad); - - // This is also a terrible way to set the material of the smoke deflectors, but oh well - wagnerSmokeDeflector.transform.GetChild(0).GetComponent().material = s282Mat; - wagnerSmokeDeflector.transform.GetChild(1).GetComponent().material = s282Mat; - - //Log(smokeDeflector.GetComponent().material.name.ToString()); - wagnerSmokeDeflector.transform.parent = __instance.transform; - wagnerSmokeDeflector.transform.localPosition = new Vector3(0, 2.1f, 5f); - wagnerSmokeDeflector.transform.localRotation = Quaternion.identity; - break; - } - - switch(Settings.boilerType) { - case BoilerType.Default: - break; - case BoilerType.Streamlined: - GameObject streamlinedBoiler = UnityEngine.Object.Instantiate(streamlinedBoilerLoad); - - // This is also a terrible way to set the material of the smoke deflectors, but oh well - streamlinedBoiler.transform.GetChild(0).GetComponent().material = s282Mat; - streamlinedBoiler.transform.GetChild(1).GetComponent().material = s282Mat; - streamlinedBoiler.transform.GetChild(2).GetComponent().material = s282Mat; - streamlinedBoiler.transform.GetChild(3).GetComponent().material = s282Mat; - - //Log(smokeDeflector.GetComponent().material.name.ToString()); - streamlinedBoiler.transform.parent = __instance.transform; - streamlinedBoiler.transform.localPosition = new Vector3(0, 2.15f, 5.1f); - streamlinedBoiler.transform.localRotation = Quaternion.identity; - break; - } - } - } - } // Logger Commands public static void Log(string message) { Instance.Logger.Log(message); diff --git a/dumb282tweaks/Patch282.cs b/dumb282tweaks/Patch282.cs deleted file mode 100644 index 0f93678..0000000 --- a/dumb282tweaks/Patch282.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace dumb282tweaks { - internal class Patch282 { - - } -} diff --git a/dumb282tweaks/Settings.cs b/dumb282tweaks/Settings.cs new file mode 100644 index 0000000..c9c5a31 --- /dev/null +++ b/dumb282tweaks/Settings.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityModManagerNet; +using static dumb282tweaks.Settings; + +namespace dumb282tweaks; + +public static class Settings { + public enum CabType { + [Description("Default 282 Cab")] + Default, + [Description("German Cab")] + German + } + public enum BoilerType { + [Description("Default Boiler")] + Default, + [Description("Streamlined Boiler")] + Streamlined, + } + public enum SmokeDeflectorType { + [Description("No Smoke Deflectors")] + None, + [Description("Witte Smoke Deflectors")] + Witte, + [Description("Wagner Smoke Deflectors")] + Wagner, + } + public enum SmokeStackType { + [Description("Default Smoke Stack")] + Default, + [Description("Short Smoke Stack")] + Short, + } +} + +public class dumb282tweaksSettings : UnityModManager.ModSettings { + public bool bluetooth = false; + public bool flattensyour282 = false; + + public bool regularBody = true; + public BoilerType boilerType = BoilerType.Default; + public CabType cabType = CabType.Default; + public SmokeDeflectorType smokeDeflectorType = SmokeDeflectorType.Wagner; + public SmokeStackType smokeStackType = SmokeStackType.Default; + + public bool cowCatcher = true; + public bool frontCover = false; + public bool railings = true; + public bool walkway = true; + + public override void Save(UnityModManager.ModEntry modEntry) { + Save(this, modEntry); + } +} +