Compare commits

..

No commits in common. "757b9f21f757dc7626decba2b88c59bd307541ed" and "a487a1d521a2f8545b5c02788b83b1576b92137a" have entirely different histories.

18 changed files with 476 additions and 379 deletions

6
.gitignore vendored
View File

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

8
Director.Build.targets Normal file
View File

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

132
README.md
View File

@ -1,11 +1,129 @@
# S282 Tweaks [![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]
Smoke deflectors and a streamlined boiler for the S282.
todo screenshot
## Credits
AEUGH: Streamlined boiler, Witte & Wagner smoke deflectors, code <!-- PROJECT TITLE -->
Tostiman: code <div align="center">
Cypress: Chinese smoke deflectors <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

Binary file not shown.

View File

@ -1,107 +0,0 @@
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

@ -1,32 +0,0 @@
// 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,72 +4,228 @@ using System.Reflection;
using HarmonyLib; using HarmonyLib;
using UnityModManagerNet; using UnityModManagerNet;
using UnityEngine; 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 GameObject wagnerSmokeDeflectorsPrefab; public static class Main {
public static GameObject witteSmokeDeflectorsPrefab; // Variables
public static GameObject chineseSmokeDeflectorsPrefab; public static UnityModManager.ModEntry Instance { get; private set; }
public static dumb282tweaksSettings Settings { get; private set; }
public static GameObject streamlinedBoilerPrefab; public static bool enabled;
private static bool Load(UnityModManager.ModEntry modEntry) private static readonly string[] cabTypeTexts = new[] {
{ "Default",
Harmony harmony = null; "German"
};
public enum CabType {
[Description("Default 282 Cab")]
Default,
[Description("German Cab")]
German
}
try private static readonly string[] smokeDeflectorTypeTexts = new[] {
{ "None",
MyModEntry = modEntry; "Witte",
MySettings = UnityModManager.ModSettings.Load<Settings>(MyModEntry); "Wagner"
};
public enum SmokeDeflectorType {
[Description("No Smoke Deflectors")]
None,
[Description("Witte Smoke Deflectors")]
Witte,
[Description("Wagner Smoke Deflectors")]
Wagner,
}
MyModEntry.OnGUI = entry => MySettings.Draw(entry); private static readonly string[] boilerTypeTexts = new[] {
MyModEntry.OnSaveGUI = entry => MySettings.Save(entry); "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;
string assetPath = Path.Combine(MyModEntry.Path, "assetbundles\\"); public override void Save(UnityModManager.ModEntry modEntry) {
Save(this, modEntry);
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");
streamlinedBoilerPrefab = AssetBundle.LoadFromFile(Path.Combine(assetPath, "streamline"))
.LoadAsset<GameObject>("Assets/Streamline.prefab");
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);
} }
} }
public static string assetPath;
//public static GameObject germanCabLoad;
public static GameObject wagnerSmokeDeflectorsLoad;
public static GameObject witteSmokeDeflectorsLoad;
public static GameObject streamlinedBoilerLoad;
// Load
private static bool Load(UnityModManager.ModEntry modEntry) {
Harmony? harmony = null;
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;
}
}
}
}
// 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);
}
} }

11
dumb282tweaks/Patch282.cs Normal file
View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace dumb282tweaks {
internal class Patch282 {
}
}

View File

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

View File

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

3
sendtomods.ps1 Normal file
View File

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

7
zDerailValley.url Normal file
View File

@ -0,0 +1,7 @@
[{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