i forgor what i added :( but i think things work now

master
EvilPunkin 2023-08-31 17:24:32 -07:00
parent a487a1d521
commit 8b0833ad24
5 changed files with 346 additions and 165 deletions

172
dumb282tweaks/CarPatch.cs Normal file
View File

@ -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<MeshRenderer>().material;
s282Body.gameObject.SetActive(false);
if(Main.Settings.regularBody) {
GameObject s282BodyNew = UnityEngine.Object.Instantiate(s282BodyLoad);
s282BodyNew.transform.GetChild(0).GetComponent<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
germanCab.transform.GetChild(1).GetComponent<MeshRenderer>().material = s282Mat;
germanCab.transform.GetChild(2).GetComponent<MeshRenderer>().material = s282Mat;
germanCab.transform.GetChild(3).GetComponent<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
witteSmokeDeflector.transform.GetChild(1).GetComponent<MeshRenderer>().material = s282Mat;
witteSmokeDeflector.transform.GetChild(3).GetComponent<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
wagnerSmokeDeflector.transform.GetChild(1).GetComponent<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
walkway.transform.parent = __instance.transform;
walkway.transform.localPosition = new Vector3(0, -0.15f, 6.98f);
walkway.transform.localRotation = Quaternion.identity;
}
}
}
}

View File

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

View File

@ -4,84 +4,50 @@ using System.Reflection;
using HarmonyLib; using HarmonyLib;
using UnityModManagerNet; using UnityModManagerNet;
using UnityEngine; using UnityEngine;
using System.Collections.Generic; using System.Diagnostics.CodeAnalysis;
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;
namespace dumb282tweaks; namespace dumb282tweaks;
public static class Main { public static class Main {
// Variables // Variables
public static UnityModManager.ModEntry Instance { get; private set; } [AllowNull] public static UnityModManager.ModEntry Instance { get; private set; }
public static dumb282tweaksSettings Settings { get; private set; } [AllowNull] public static dumb282tweaksSettings Settings { get; private set; }
public static bool enabled; public static readonly string[] cabTypeTexts = new[] {
private static readonly string[] cabTypeTexts = new[] {
"Default", "Default",
"German" "German"
}; };
public enum CabType { public static readonly string[] smokeDeflectorTypeTexts = new[] {
[Description("Default 282 Cab")]
Default,
[Description("German Cab")]
German
}
private static readonly string[] smokeDeflectorTypeTexts = new[] {
"None", "None",
"Witte", "Witte",
"Wagner" "Wagner"
}; };
public enum SmokeDeflectorType { public static readonly string[] boilerTypeTexts = new[] {
[Description("No Smoke Deflectors")]
None,
[Description("Witte Smoke Deflectors")]
Witte,
[Description("Wagner Smoke Deflectors")]
Wagner,
}
private static readonly string[] boilerTypeTexts = new[] {
"Default", "Default",
"Streamlined" "Streamlined"
}; };
public enum BoilerType { public static readonly string[] smokeStackTypeTexts = new[] {
[Description("Default Boiler")] "Default",
Default, "Short",
[Description("Streamlined Boiler")] };
Streamlined, // Base
} [AllowNull] public static GameObject s282BodyLoad;
public class dumb282tweaksSettings : UnityModManager.ModSettings { // Boilers
public bool toggleTweaks = true; [AllowNull] public static GameObject streamlineLoad;
public CabType cabType = CabType.Default; // Cabs
public SmokeDeflectorType smokeDeflectorType = SmokeDeflectorType.Wagner; [AllowNull] public static GameObject defaultCabLoad;
public BoilerType boilerType = BoilerType.Default; [AllowNull] public static GameObject germanCabLoad;
public override void Save(UnityModManager.ModEntry modEntry) { [AllowNull] public static GameObject wagnerSmokeDeflectorsLoad;
Save(this, modEntry); [AllowNull] public static GameObject witteSmokeDeflectorsLoad;
}
}
public static string assetPath; [AllowNull] public static GameObject defaultSmokeStackLoad;
//public static GameObject germanCabLoad; [AllowNull] public static GameObject shortSmokeStackLoad;
public static GameObject wagnerSmokeDeflectorsLoad;
public static GameObject witteSmokeDeflectorsLoad; [AllowNull] public static GameObject cowCatcherLoad;
public static GameObject streamlinedBoilerLoad; [AllowNull] public static GameObject frontCoverLoad;
[AllowNull] public static GameObject railingsLoad;
[AllowNull] public static GameObject walkwayLoad;
// Load // Load
private static bool Load(UnityModManager.ModEntry modEntry) { private static bool Load(UnityModManager.ModEntry modEntry) {
@ -93,22 +59,48 @@ public static class Main {
Instance.OnGUI = OnGUI; Instance.OnGUI = OnGUI;
Instance.OnSaveGUI = OnSaveGUI; Instance.OnSaveGUI = OnSaveGUI;
modEntry.Logger.Log("gam");
harmony = new Harmony(Instance.Info.Id); harmony = new Harmony(Instance.Info.Id);
harmony.PatchAll(Assembly.GetExecutingAssembly()); 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<GameObject>("Assets/S282Body.prefab");
// Boilers
string boilersAssetPat = Path.Combine(assetPath, "Boilers\\");
var streamlineBundle = AssetBundle.LoadFromFile(Path.Combine(boilersAssetPat, "streamline"));
streamlineLoad = streamlineBundle.LoadAsset<GameObject>("Assets/Streamline.prefab");
// Cabs
string cabsAssetPath = Path.Combine(assetPath, "Cabs\\");
var defaultCabBundle = AssetBundle.LoadFromFile(Path.Combine(cabsAssetPath, "defaultcab"));
defaultCabLoad = defaultCabBundle.LoadAsset<GameObject>("Assets/DefaultCab.prefab");
var germanCabBundle = AssetBundle.LoadFromFile(Path.Combine(cabsAssetPath, "germancab"));
germanCabLoad = germanCabBundle.LoadAsset<GameObject>("Assets/GermanCab.prefab");
// Smoke Deflectors // 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<GameObject>("Assets/WagnerSmokeDeflectors.prefab"); wagnerSmokeDeflectorsLoad = wagnerSmokeDeflectorsBundle.LoadAsset<GameObject>("Assets/WagnerSmokeDeflectors.prefab");
var witteSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wittesmokedeflectors")); var witteSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(smokeDeflectorsAssetPath, "wittesmokedeflectors"));
witteSmokeDeflectorsLoad = witteSmokeDeflectorsBundle.LoadAsset<GameObject>("Assets/WitteSmokeDeflectors.prefab"); witteSmokeDeflectorsLoad = witteSmokeDeflectorsBundle.LoadAsset<GameObject>("Assets/WitteSmokeDeflectors.prefab");
// Smoke Stacks
// Boiler string smokeStacksAssetPath = Path.Combine(assetPath, "SmokeStacks\\");
var streamlinedBoilerBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "streamline")); var defaultSmokeStackBundle = AssetBundle.LoadFromFile(Path.Combine(smokeStacksAssetPath, "defaultsmokestack"));
streamlinedBoilerLoad = streamlinedBoilerBundle.LoadAsset<GameObject>("Assets/Streamline.prefab"); defaultSmokeStackLoad = defaultSmokeStackBundle.LoadAsset<GameObject>("Assets/DefaultSmokeStack.prefab");
var shortSmokeStackBundle = AssetBundle.LoadFromFile(Path.Combine(smokeStacksAssetPath, "shortsmokestack"));
shortSmokeStackLoad = shortSmokeStackBundle.LoadAsset<GameObject>("Assets/ShortSmokeStack.prefab");
// Extras
string extrasAssetPath = Path.Combine(assetPath, "Extras\\");
var cowCatcherBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "cowcatcher"));
cowCatcherLoad = cowCatcherBundle.LoadAsset<GameObject>("Assets/CowCatcher.prefab");
var frontCoverBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "frontcover"));
frontCoverLoad = frontCoverBundle.LoadAsset<GameObject>("Assets/FrontCover.prefab");
var railingsBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "railings"));
railingsLoad = railingsBundle.LoadAsset<GameObject>("Assets/Railings.prefab");
var walkwayBundle = AssetBundle.LoadFromFile(Path.Combine(extrasAssetPath, "walkway"));
walkwayLoad = walkwayBundle.LoadAsset<GameObject>("Assets/Walkway.prefab");
} catch(Exception ex) { } catch(Exception ex) {
Instance.Logger.LogException($"Failed to load {Instance.Info.DisplayName}:", ex); Instance.Logger.LogException($"Failed to load {Instance.Info.DisplayName}:", ex);
harmony?.UnpatchAll(Instance.Info.Id); harmony?.UnpatchAll(Instance.Info.Id);
@ -123,17 +115,26 @@ public static class Main {
GUILayout.BeginVertical(); 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("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("Also, reloading a save will currently break things and the tweaks won't load. This isn't good.");
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("Boiler Type"); 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(); GUILayout.EndVertical();
} }
@ -141,83 +142,6 @@ public static class Main {
Settings.Save(modEntry); 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<GameObject>("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<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
witteSmokeDeflector.transform.GetChild(1).GetComponent<MeshRenderer>().material = s282Mat;
//Log(smokeDeflector.GetComponent<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
wagnerSmokeDeflector.transform.GetChild(1).GetComponent<MeshRenderer>().material = s282Mat;
//Log(smokeDeflector.GetComponent<MeshRenderer>().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<MeshRenderer>().material = s282Mat;
streamlinedBoiler.transform.GetChild(1).GetComponent<MeshRenderer>().material = s282Mat;
streamlinedBoiler.transform.GetChild(2).GetComponent<MeshRenderer>().material = s282Mat;
streamlinedBoiler.transform.GetChild(3).GetComponent<MeshRenderer>().material = s282Mat;
//Log(smokeDeflector.GetComponent<MeshRenderer>().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 // Logger Commands
public static void Log(string message) { public static void Log(string message) {
Instance.Logger.Log(message); Instance.Logger.Log(message);

View File

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

60
dumb282tweaks/Settings.cs Normal file
View File

@ -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);
}
}