Compare commits

...

12 Commits

Author SHA1 Message Date
t0stiman 757b9f21f7 Chinese smoke deflectors 2023-11-25 15:38:56 +01:00
t0stiman ab8a42d98b no nullable 2023-11-23 13:04:06 +01:00
t0stiman a65bc2bf63
Merge pull request #2 from aeughsendhelp/main
yut6t
2023-11-12 20:22:41 +01:00
t0stiman d3927e8d0e a 2023-11-12 19:52:22 +01:00
t0stiman 5f709ea385 make it working, more cleanup 2023-11-12 19:52:22 +01:00
t0stiman 4e4ead80f3 cleanup 2023-11-12 19:51:59 +01:00
ÆUGH 49226d9fdf Update README.md 2023-11-12 19:51:59 +01:00
ÆUGH 024877313c Update README.md 2023-11-12 19:51:59 +01:00
EvilPunkin 0a387eb402 Merge branch 'main' of https://github.com/aeughsendhelp/dumb282tweaks 2023-08-31 17:24:38 -07:00
EvilPunkin 8b0833ad24 i forgor what i added :( but i think things work now 2023-08-31 17:24:32 -07:00
ÆUGH 5c910fd9e0
Update README.md 2023-08-26 18:49:45 -07:00
ÆUGH 1d92468e02
Update README.md 2023-08-26 18:48:36 -07:00
18 changed files with 375 additions and 472 deletions

6
.gitignore vendored
View File

@ -398,3 +398,9 @@ FodyWeavers.xsd
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# ======================================================
*.unitypackage
assetbundles/*.manifest
assetbundles/assetbundles

View File

@ -1,8 +0,0 @@
<Project>
<PropertyGroup>
<ReferencePath>
G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\
</ReferencePath>
<AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath);</AssemblySearchPaths>
</PropertyGroup>
</Project>

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 Derail Valley Modding
Copyright (c) 2023 ÆUGH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

132
README.md
View File

@ -1,129 +1,11 @@
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
# S282 Tweaks
Smoke deflectors and a streamlined boiler for the S282.
todo screenshot
## Credits
<!-- PROJECT TITLE -->
<div align="center">
<h1>Unity Mod Manager Mod Template</h1>
<p>
A template for creating <a href="http://www.derailvalley.com/">Derail Valley</a> mods that load via <a href="https://www.nexusmods.com/site/mods/21">Unity Mod Manager</a>.
<br />
<br />
<a href="https://github.com/derail-valley-modding/template-umm/issues">Report Bug</a>
·
<a href="https://github.com/derail-valley-modding/template-umm/issues">Request Feature</a>
</p>
</div>
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li><a href="#about-the-project">About The Project</a></li>
<li><a href="#building">Building</a></li>
<li><a href="#packaging">Packaging</a></li>
<li><a href="#license">License</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## About The Project
This is a template for Derail Valley mods that load via the Unity Mod Manager mod loader.
TODO: Instructions for how mod creators use this template.
<!-- BUILDING -->
## Building
Building the project requires some initial setup, after which running `dotnet build` will do a Debug build or running `dotnet build -c Release` will do a Release build.
### References Setup
After cloning the repository, some setup is required in order to successfully build the mod DLLs. You will need to create a new [Directory.Build.targets][references-url] file to specify your local reference paths. This file will be located in the main directory, next to MOD_NAME.sln.
Below is an example of the necessary structure. When creating your targets file, you will need to replace the reference paths with the corresponding folders on your system. Make sure to include semicolons **between** each of the paths and no semicolon after the last path. Also note that any shortcuts you might use in file explorer—such as %ProgramFiles%—won't be expanded in these paths. You have to use full, absolute paths.
```xml
<Project>
<PropertyGroup>
<ReferencePath>
C:\Program Files (x86)\Steam\steamapps\common\Derail Valley\DerailValley_Data\Managed\
</ReferencePath>
<AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath);</AssemblySearchPaths>
</PropertyGroup>
</Project>
```
### Line Endings Setup
It's recommended to use Git's [autocrlf mode][autocrlf-url] on Windows. Activate this by running `git config --global core.autocrlf true`.
<!-- PACKAGING -->
## Packaging
To package a build for distribution, you can run the `package.ps1` PowerShell script in the root of the project. If no parameters are supplied, it will create a .zip file ready for distribution in the dist directory. A post build event is configured to run this automatically after each successful Release build.
Linux: `pwsh ./package.ps1`
Windows: `powershell -executionpolicy bypass .\package.ps1`
### Parameters
Some parameters are available for the packaging script.
#### -NoArchive
Leave the package contents uncompressed in the output directory.
#### -OutputDirectory
Specify a different output directory.
For instance, this can be used in conjunction with `-NoArchive` to copy the mod files into your Derail Valley installation directory.
<!-- LICENSE -->
## License
Source code is distributed under the MIT license.
See [LICENSE][license-url] for more information.
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/derail-valley-modding/template-umm.svg?style=for-the-badge
[contributors-url]: https://github.com/derail-valley-modding/template-umm/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/derail-valley-modding/template-umm.svg?style=for-the-badge
[forks-url]: https://github.com/derail-valley-modding/template-umm/network/members
[stars-shield]: https://img.shields.io/github/stars/derail-valley-modding/template-umm.svg?style=for-the-badge
[stars-url]: https://github.com/derail-valley-modding/template-umm/stargazers
[issues-shield]: https://img.shields.io/github/issues/derail-valley-modding/template-umm.svg?style=for-the-badge
[issues-url]: https://github.com/derail-valley-modding/template-umm/issues
[license-shield]: https://img.shields.io/github/license/derail-valley-modding/template-umm.svg?style=for-the-badge
[license-url]: https://github.com/derail-valley-modding/template-umm/blob/master/LICENSE
[references-url]: https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022
[autocrlf-url]: https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace
AEUGH: Streamlined boiler, Witte & Wagner smoke deflectors, code
Tostiman: code
Cypress: Chinese smoke deflectors

Binary file not shown.

107
dumb282tweaks/CarPatch.cs Normal file
View File

@ -0,0 +1,107 @@
using DV.ThingTypes;
using HarmonyLib;
using UnityEngine;
using static dumb282tweaks.Main;
namespace dumb282tweaks;
[HarmonyPatch(typeof(TrainCar), "Start")]
class CarPatch {
static void Postfix(ref TrainCar __instance)
{
if (__instance == null || __instance.carType != TrainCarType.LocoSteamHeavy)
{
return;
}
string bodyPath = "LocoS282A_Body/Static_LOD0/s282_locomotive_body";
Transform s282Body = __instance.transform.Find(bodyPath);
if (s282Body == null)
{
Error($"Couldn't find S282 body on '{__instance.transform.gameObject.name}' -> {bodyPath}");
return;
}
Material s282Mat = s282Body.GetComponent<MeshRenderer>().material;
// Smoke Deflector
Log($"Applying {MySettings.smokeDeflectorType.ToString()}");
switch(MySettings.smokeDeflectorType) {
case Settings.SmokeDeflectorType.Witte:
{
GameObject witteSmokeDeflector = Object.Instantiate(witteSmokeDeflectorsPrefab, __instance.transform);
witteSmokeDeflector.transform.localPosition = new Vector3(0.0f, 2.1f, 5f);
witteSmokeDeflector.transform.localRotation = Quaternion.identity;
foreach (var aMeshRenderer in witteSmokeDeflector.GetComponentsInChildren<MeshRenderer>())
{
aMeshRenderer.material = s282Mat;
}
break;
}
case Settings.SmokeDeflectorType.Wagner:
{
GameObject wagnerSmokeDeflector = Object.Instantiate(wagnerSmokeDeflectorsPrefab, __instance.transform);
wagnerSmokeDeflector.transform.localPosition = new Vector3(0.0f, 2.1f, 5f);
wagnerSmokeDeflector.transform.localRotation = Quaternion.identity;
foreach (var aMeshRenderer in wagnerSmokeDeflector.GetComponentsInChildren<MeshRenderer>())
{
aMeshRenderer.material = s282Mat;
}
break;
}
case Settings.SmokeDeflectorType.Chinese:
ApplyChineseSmokeDeflector(ref __instance, s282Body);
break;
}
// Boiler
Log($"Applying {MySettings.boilerType.ToString()}");
switch (MySettings.boilerType)
{
case Settings.BoilerType.Streamlined:
GameObject streamlinedBoiler = Object.Instantiate(streamlinedBoilerPrefab, __instance.transform);
streamlinedBoiler.transform.localPosition = new Vector3(0.0f, 2.15f, 5.1f);
streamlinedBoiler.transform.localRotation = Quaternion.identity;
foreach (var aMeshRenderer in streamlinedBoiler.GetComponentsInChildren<MeshRenderer>())
{
aMeshRenderer.material = s282Mat;
}
break;
}
}
private static void ApplyChineseSmokeDeflector(ref TrainCar locomotive, Transform body)
{
//hide smoke box door
var smokeboxDoorPath = "LocoS282A_Body/Static_LOD0/s282_locomotive_smokebox_door";
Transform smokeBoxDoor = locomotive.transform.Find(smokeboxDoorPath);
if (smokeBoxDoor == null)
{
Error($"Couldn't find S282 smoke box door on '{locomotive.transform.gameObject.name}' -> {smokeboxDoorPath}");
return;
}
smokeBoxDoor.gameObject.SetActive(false);
//show deflector and stuff
GameObject chineseSmokeDeflector = Object.Instantiate(chineseSmokeDeflectorsPrefab, body);
chineseSmokeDeflector.transform.localPosition = smokeBoxDoor.localPosition;
//todo apply S282 material?
// foreach (var aMeshRenderer in chineseSmokeDeflector.GetComponentsInChildren<MeshRenderer>())
// {
// if (aMeshRenderer.material.name == "S282") //todo
// {
// aMeshRenderer.material = s282Mat;
// }
// }
}
}

View File

@ -0,0 +1,32 @@
// using HarmonyLib;
// 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,228 +4,72 @@ 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;
namespace dumb282tweaks;
namespace dumb282tweaks
{
[EnableReloading]
public static class Main
{
public static UnityModManager.ModEntry MyModEntry { get; private set; }
public static Settings MySettings { get; private set; }
public static class Main {
// Variables
public static UnityModManager.ModEntry Instance { get; private set; }
public static dumb282tweaksSettings Settings { get; private set; }
public static GameObject wagnerSmokeDeflectorsPrefab;
public static GameObject witteSmokeDeflectorsPrefab;
public static GameObject chineseSmokeDeflectorsPrefab;
public static bool enabled;
public static GameObject streamlinedBoilerPrefab;
private static readonly string[] cabTypeTexts = new[] {
"Default",
"German"
};
public enum CabType {
[Description("Default 282 Cab")]
Default,
[Description("German Cab")]
German
}
private static bool Load(UnityModManager.ModEntry modEntry)
{
Harmony harmony = null;
private 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,
}
try
{
MyModEntry = modEntry;
MySettings = UnityModManager.ModSettings.Load<Settings>(MyModEntry);
private 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;
MyModEntry.OnGUI = entry => MySettings.Draw(entry);
MyModEntry.OnSaveGUI = entry => MySettings.Save(entry);
public override void Save(UnityModManager.ModEntry modEntry) {
Save(this, modEntry);
}
}
string assetPath = Path.Combine(MyModEntry.Path, "assetbundles\\");
public static string assetPath;
//public static GameObject germanCabLoad;
public static GameObject wagnerSmokeDeflectorsLoad;
public static GameObject witteSmokeDeflectorsLoad;
public static GameObject streamlinedBoilerLoad;
wagnerSmokeDeflectorsPrefab = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wagnersmokedeflectors"))
.LoadAsset<GameObject>("Assets/WagnerSmokeDeflectors.prefab");
witteSmokeDeflectorsPrefab = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wittesmokedeflectors"))
.LoadAsset<GameObject>("Assets/WitteSmokeDeflectors.prefab");
chineseSmokeDeflectorsPrefab = AssetBundle.LoadFromFile(Path.Combine(assetPath, "chinesesmokedeflectors"))
.LoadAsset<GameObject>("Assets/Prefab/LocoS282A_Smokebox.prefab");
// Load
private static bool Load(UnityModManager.ModEntry modEntry) {
Harmony? harmony = null;
streamlinedBoilerPrefab = AssetBundle.LoadFromFile(Path.Combine(assetPath, "streamline"))
.LoadAsset<GameObject>("Assets/Streamline.prefab");
try {
Instance = modEntry;
Settings = UnityModManager.ModSettings.Load<dumb282tweaksSettings>(Instance);
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\\");
// Smoke Deflectors
var wagnerSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wagnersmokedeflectors"));
wagnerSmokeDeflectorsLoad = wagnerSmokeDeflectorsBundle.LoadAsset<GameObject>("Assets/WagnerSmokeDeflectors.prefab");
var witteSmokeDeflectorsBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "wittesmokedeflectors"));
witteSmokeDeflectorsLoad = witteSmokeDeflectorsBundle.LoadAsset<GameObject>("Assets/WitteSmokeDeflectors.prefab");
// Boiler
var streamlinedBoilerBundle = AssetBundle.LoadFromFile(Path.Combine(assetPath, "streamline"));
streamlinedBoilerLoad = streamlinedBoilerBundle.LoadAsset<GameObject>("Assets/Streamline.prefab");
} catch(Exception ex) {
Instance.Logger.LogException($"Failed to load {Instance.Info.DisplayName}:", ex);
harmony?.UnpatchAll(Instance.Info.Id);
return false;
}
return true;
}
// GUI Rendering
static void OnGUI(UnityModManager.ModEntry modEntry) {
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("Boiler Type");
Settings.boilerType = (BoilerType) GUILayout.SelectionGrid((int) Settings.boilerType, boilerTypeTexts, 1, "toggle");
GUILayout.EndVertical();
}
static void OnSaveGUI(UnityModManager.ModEntry 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;
}
harmony = new Harmony(MyModEntry.Info.Id);
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
catch (Exception ex)
{
MyModEntry.Logger.LogException($"Failed to load {MyModEntry.Info.DisplayName}:", ex);
harmony?.UnpatchAll(MyModEntry.Info.Id);
return false;
}
return true;
}
// Logger Commands
public static void Log(string message)
{
MyModEntry.Logger.Log(message);
}
public static void Warning(string message)
{
MyModEntry.Logger.Warning(message);
}
public static void Error(string message)
{
MyModEntry.Logger.Error(message);
}
}
// Logger Commands
public static void Log(string message) {
Instance.Logger.Log(message);
}
public static void Warning(string message) {
Instance.Logger.Warning(message);
}
public static void Error(string message) {
Instance.Logger.Error(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 {
}
}

69
dumb282tweaks/Settings.cs Normal file
View File

@ -0,0 +1,69 @@
using System;
using System.ComponentModel;
using UnityEngine;
using UnityModManagerNet;
namespace dumb282tweaks
{
public class Settings : UnityModManager.ModSettings
{
// 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,
[Description("Chinese smoke deflectors and more")]
Chinese,
}
// public CabType cabType = CabType.Default;
public SmokeDeflectorType smokeDeflectorType = SmokeDeflectorType.Wagner;
public BoilerType boilerType = BoilerType.Default;
public void Draw(UnityModManager.ModEntry modEntry)
{
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("Also, reloading a save will currently break things and the tweaks won't load. This isn't good.");
GUILayout.Space(2f);
//todo this is not implemented
// GUILayout.Label("Cab Type");
// Settings.cabType = (Settings.CabType) GUILayout.SelectionGrid((int) Settings.cabType, cabTypeTexts, 1, "toggle");
GUILayout.Label("Smoke Deflector Type");
smokeDeflectorType = (SmokeDeflectorType) GUILayout.SelectionGrid((int) smokeDeflectorType, Enum.GetNames(typeof(SmokeDeflectorType)), 1, "toggle");
GUILayout.Label("Boiler Type");
boilerType = (BoilerType) GUILayout.SelectionGrid((int) boilerType, Enum.GetNames(typeof(BoilerType)), 1, "toggle");
GUILayout.EndVertical();
}
public override void Save(UnityModManager.ModEntry modEntry)
{
Save(this, modEntry);
}
}
}

View File

@ -3,14 +3,9 @@
<AssemblyName>dumb282tweaks</AssemblyName>
<TargetFramework>net48</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<WarningsAsErrors>CS8600;CS8602;CS8603</WarningsAsErrors>
</PropertyGroup>
<!-- Derail Valley -->
<!-- Unity -->
<!-- Mod Loader -->
<ItemGroup>
<PackageReference Include="UnityModManager" Version="0.27.2" />
@ -19,99 +14,101 @@
<!-- Null Checking -->
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityModManager\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="DV.BrakeSystem">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.BrakeSystem.dll</HintPath>
</Reference>
<Reference Include="DV.Common">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Common.dll</HintPath>
</Reference>
<Reference Include="DV.ControllerAnchors">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.ControllerAnchors.dll</HintPath>
</Reference>
<Reference Include="DV.Highlighting">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Highlighting.dll</HintPath>
</Reference>
<Reference Include="DV.Interaction">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Interaction.dll</HintPath>
</Reference>
<Reference Include="DV.Inventory">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Inventory.dll</HintPath>
</Reference>
<Reference Include="DV.Localization">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Localization.dll</HintPath>
</Reference>
<Reference Include="DV.NAudio">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.NAudio.dll</HintPath>
</Reference>
<Reference Include="DV.PointSet">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.PointSet.dll</HintPath>
</Reference>
<Reference Include="DV.RadioPlayer">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.RadioPlayer.dll</HintPath>
</Reference>
<Reference Include="DV.Scenarios.CRUD">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Scenarios.CRUD.dll</HintPath>
</Reference>
<Reference Include="DV.Simulation">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Simulation.dll</HintPath>
</Reference>
<Reference Include="DV.Telemetry">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Telemetry.dll</HintPath>
</Reference>
<Reference Include="DV.TerrainSystem">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.TerrainSystem.dll</HintPath>
</Reference>
<Reference Include="DV.TerrainTools">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.TerrainTools.dll</HintPath>
</Reference>
<Reference Include="DV.ThingTypes">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.ThingTypes.dll</HintPath>
</Reference>
<Reference Include="DV.UI">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.UI.dll</HintPath>
</Reference>
<Reference Include="DV.UIFramework">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.UIFramework.dll</HintPath>
</Reference>
<Reference Include="DV.UserManagement">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.UserManagement.dll</HintPath>
</Reference>
<Reference Include="DV.Utils">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.Utils.dll</HintPath>
</Reference>
<Reference Include="DV.WeatherSystem">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\DV.WeatherSystem.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityModManager">
<HintPath>G:\SteamLibrary\steamapps\common\Derail Valley\DerailValley_Data\Managed\UnityModManager\UnityModManager.dll</HintPath>
</Reference>
<!-- Derail Valley -->
<Reference Include="0Harmony" />
<Reference Include="Assembly-CSharp" />
<Reference Include="DV.BrakeSystem" />
<Reference Include="DV.Common" />
<Reference Include="DV.ControllerAnchors" />
<Reference Include="DV.Highlighting" />
<Reference Include="DV.Interaction" />
<Reference Include="DV.Inventory" />
<Reference Include="DV.Localization" />
<Reference Include="DV.NAudio" />
<Reference Include="DV.PointSet" />
<Reference Include="DV.RadioPlayer" />
<Reference Include="DV.Scenarios.CRUD" />
<Reference Include="DV.Simulation" />
<Reference Include="DV.Telemetry" />
<Reference Include="DV.TerrainSystem" />
<Reference Include="DV.TerrainTools" />
<Reference Include="DV.ThingTypes" />
<Reference Include="DV.UI" />
<Reference Include="DV.UIFramework" />
<Reference Include="DV.UserManagement" />
<Reference Include="DV.Utils" />
<Reference Include="DV.WeatherSystem" />
<!-- Unity -->
<Reference Include="UnityEngine" />
<Reference Include="UnityEngine.AccessibilityModule" />
<Reference Include="UnityEngine.AIModule" />
<Reference Include="UnityEngine.AndroidJNIModule" />
<Reference Include="UnityEngine.AnimationModule" />
<Reference Include="UnityEngine.ARModule" />
<Reference Include="UnityEngine.AssetBundleModule" />
<Reference Include="UnityEngine.AudioModule" />
<Reference Include="UnityEngine.ClothModule" />
<Reference Include="UnityEngine.ClusterInputModule" />
<Reference Include="UnityEngine.ClusterRendererModule" />
<Reference Include="UnityEngine.CoreModule" />
<Reference Include="UnityEngine.CrashReportingModule" />
<Reference Include="UnityEngine.DirectorModule" />
<Reference Include="UnityEngine.DSPGraphModule" />
<Reference Include="UnityEngine.GameCenterModule" />
<Reference Include="UnityEngine.GridModule" />
<Reference Include="UnityEngine.HotReloadModule" />
<Reference Include="UnityEngine.ImageConversionModule" />
<Reference Include="UnityEngine.IMGUIModule" />
<Reference Include="UnityEngine.InputLegacyModule" />
<Reference Include="UnityEngine.InputModule" />
<Reference Include="UnityEngine.JSONSerializeModule" />
<Reference Include="UnityEngine.LocalizationModule" />
<Reference Include="UnityEngine.ParticleSystemModule" />
<Reference Include="UnityEngine.PerformanceReportingModule" />
<Reference Include="UnityEngine.Physics2DModule" />
<Reference Include="UnityEngine.PhysicsModule" />
<Reference Include="UnityEngine.ProfilerModule" />
<Reference Include="UnityEngine.ScreenCaptureModule" />
<Reference Include="UnityEngine.SharedInternalsModule" />
<Reference Include="UnityEngine.SpatialTracking" />
<Reference Include="UnityEngine.SpriteMaskModule" />
<Reference Include="UnityEngine.SpriteShapeModule" />
<Reference Include="UnityEngine.StreamingModule" />
<Reference Include="UnityEngine.SubstanceModule" />
<Reference Include="UnityEngine.SubsystemsModule" />
<Reference Include="UnityEngine.TerrainModule" />
<Reference Include="UnityEngine.TerrainPhysicsModule" />
<Reference Include="UnityEngine.TextCoreModule" />
<Reference Include="UnityEngine.TextRenderingModule" />
<Reference Include="UnityEngine.TilemapModule" />
<Reference Include="UnityEngine.TLSModule" />
<Reference Include="UnityEngine.UI" />
<Reference Include="UnityEngine.UIElementsModule" />
<Reference Include="UnityEngine.UIModule" />
<Reference Include="UnityEngine.UmbraModule" />
<Reference Include="UnityEngine.UNETModule" />
<Reference Include="UnityEngine.UnityAnalyticsModule" />
<Reference Include="UnityEngine.UnityConnectModule" />
<Reference Include="UnityEngine.UnityTestProtocolModule" />
<Reference Include="UnityEngine.UnityWebRequestAssetBundleModule" />
<Reference Include="UnityEngine.UnityWebRequestAudioModule" />
<Reference Include="UnityEngine.UnityWebRequestModule" />
<Reference Include="UnityEngine.UnityWebRequestTextureModule" />
<Reference Include="UnityEngine.UnityWebRequestWWWModule" />
<Reference Include="UnityEngine.VehiclesModule" />
<Reference Include="UnityEngine.VFXModule" />
<Reference Include="UnityEngine.VideoModule" />
<Reference Include="UnityEngine.VRModule" />
<Reference Include="UnityEngine.WindModule" />
<Reference Include="UnityEngine.XR.LegacyInputHelpers" />
<Reference Include="UnityEngine.XRModule" />
<Reference Include="UnityModManager" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
@ -119,7 +116,8 @@
<Copy SourceFiles="$(TargetPath)" DestinationFolder="../build/" />
<!-- Package after Release build -->
<Exec Condition="'$(ConfigurationName)' == 'Release' And '$(OS)' == 'Windows_NT'" Command="powershell -executionpolicy bypass -Command &quot;(../package.ps1)&quot;" />
<Exec Condition="'$(ConfigurationName)' == 'Release' And '$(OS)' != 'Windows_NT'" Command="pwsh -Command &quot;(../package.ps1)&quot;" />
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="powershell -executionpolicy bypass ../package.ps1 -NoArchive -OutputDirectory 'D:\Programs\Derail Valley\Mods'" />
<!-- todo fix linux below-->
<!-- <Exec Condition="'$(ConfigurationName)' == 'Release' And '$(OS)' != 'Windows_NT'" Command="pwsh -Command &quot;(../package.ps1)&quot;" />-->
</Target>
</Project>

View File

@ -4,7 +4,7 @@ param (
)
Set-Location "$PSScriptRoot"
$FilesToInclude = "info.json","build/*","LICENSE"
$FilesToInclude = "info.json","build/*","LICENSE","assetbundles"
$modInfo = Get-Content -Raw -Path "info.json" | ConvertFrom-Json
$modId = $modInfo.Id
@ -20,13 +20,7 @@ $ZipOutDir = "$ZipWorkDir/$modId"
New-Item "$ZipOutDir" -ItemType Directory -Force
Copy-Item -Force -Path $FilesToInclude -Destination "$ZipOutDir"
# Get-ChildItem $sourceDir -filter "*" -recurse | `
# foreach{
# $targetFile = $targetDir + $_.FullName.SubString($sourceDir.Length);
# New-Item -ItemType File -Path $targetFile -Force;
# Copy-Item $_.FullName -destination $targetFile
# }
Copy-Item -Force -Path "assetbundles/*" -Destination "$ZipOutDir/assetbundles"
if (!$NoArchive)
{

View File

@ -1,3 +0,0 @@
powershell -executionpolicy bypass .\package.ps1 -NoArchive -OutputDirectory `'G:\SteamLibrary\steamapps\common\Derail Valley\Mods`'
# Start-Sleep -Seconds 1
# steam steam://rungameid/588030

View File

@ -1,7 +0,0 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,0
[InternetShortcut]
IDList=
IconIndex=0
URL=steam://rungameid/588030
IconFile=C:\Program Files (x86)\Steam\steam\games\ce91a672ac33c3038e50fc02fffa67e7133d2bf1.ico