master
t0stiman 2023-11-15 20:16:46 +01:00
parent 711f8433ca
commit 6cc730bb5b
6 changed files with 151 additions and 14 deletions

87
.gitattributes vendored Normal file
View File

@ -0,0 +1,87 @@
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
*.physicsMaterial2D merge=unityyamlmerge eol=lf
*.physicMaterial merge=unityyamlmerge eol=lf
*.asset merge=unityyamlmerge eol=lf
*.meta merge=unityyamlmerge eol=lf
*.controller merge=unityyamlmerge eol=lf
## git-lfs ##
#Image
*.bmp filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.hdr filter=lfs diff=lfs merge=lfs -text
*.iff filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.pict filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
#Audio
*.aif filter=lfs diff=lfs merge=lfs -text
*.aiff filter=lfs diff=lfs merge=lfs -text
*.it filter=lfs diff=lfs merge=lfs -text
*.mod filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.s3m filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.xm filter=lfs diff=lfs merge=lfs -text
#Video
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
#3D Object
*.3dm filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.c4d filter=lfs diff=lfs merge=lfs -text
*.collada filter=lfs diff=lfs merge=lfs -text
*.dae filter=lfs diff=lfs merge=lfs -text
*.dxf filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.jas filter=lfs diff=lfs merge=lfs -text
*.lws filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text
*.ma filter=lfs diff=lfs merge=lfs -text
*.max filter=lfs diff=lfs merge=lfs -text
*.mb filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.ply filter=lfs diff=lfs merge=lfs -text
*.skp filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.ztl filter=lfs diff=lfs merge=lfs -text
# Fonts
*.otf filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
#ETC
*.a filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.unitypackage filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.reason filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text
*.bundle filter=lfs diff=lfs merge=lfs -text

View File

@ -1,11 +1,18 @@
todo
# Locomotive faces for Derail Valley
Puts faces on the steam locos. They might remind you of a certain TV show.
![screenshot.png](screenshot.png)
## Installation instructions
todo
1. Install Unity Mod Manager
2. Yeet this mod's zip into Unity Mod Manager
## Credits
This mod's code is based on the mod '[Dumb S282 Tweaks](https://github.com/aeughsendhelp/dumb282tweaks)' by [ÆUGH](https://github.com/aeughsendhelp).
todo model
"Henry the Green Engine" (https://skfb.ly/oxJEv) by Sea Land Air is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
"Gordon the Big Engine" (https://skfb.ly/oxYC7) by Sea Land Air is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
"Thomas The Tank Engine" (https://skfb.ly/onSzS) by HarrisonHag1 is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).

View File

@ -8,6 +8,8 @@ namespace dv_locofaces
[HarmonyPatch(typeof(TrainCar), "Start")]
class CarPatch
{
private static System.Random myRandom = new System.Random();
static void Postfix(ref TrainCar __instance)
{
if (__instance == null)
@ -28,15 +30,54 @@ namespace dv_locofaces
}
}
private static void ApplyS282Face(ref TrainCar trainCar)
private static void ApplyS282Face(ref TrainCar locomotive)
{
switch (Main.MySettings.S282FaceType)
if(Main.MySettings.S282FaceType == Settings.S282Face.None)
{
return;
}
//hide smoke box door
var smokeboxDoorPath = "LocoS282A_Body/Static_LOD0/s282_locomotive_smokebox_door";
Transform smokeBoxDoor = locomotive.transform.Find(smokeboxDoorPath);
if (smokeBoxDoor == null)
{
Main.Error($"Couldn't find S282 smoke box door on '{locomotive.transform.gameObject.name}' -> {smokeboxDoorPath}");
return;
}
smokeBoxDoor.gameObject.SetActive(false);
//show face
var bodyPath = "LocoS282A_Body/Static_LOD0";
Transform body = locomotive.transform.Find(bodyPath);
if (body == null)
{
Main.Error($"Couldn't find S282 body on '{locomotive.transform.gameObject.name}' -> {bodyPath}");
return;
}
Settings.S282Face whatFace = Main.MySettings.S282FaceType;
if (whatFace == Settings.S282Face.Mixed)
{
whatFace = (Settings.S282Face) myRandom.Next((int)Settings.S282Face.Gordon, ((int)Settings.S282Face.Henry)+1);
}
GameObject face;
switch (whatFace)
{
case Settings.S282Face.Gordon:
face = Main.GordonObj;
break;
case Settings.S282Face.Henry:
face = Main.HenryObj;
break;
default:
Main.Error("Unreachable code reached");
return;
}
GameObject.Instantiate(face, body);
}
private static void ApplyS060Face(ref TrainCar locomotive)

View File

@ -14,6 +14,8 @@ namespace dv_locofaces
public static Settings MySettings { get; private set; }
public static GameObject S060FaceObj;
public static GameObject HenryObj;
public static GameObject GordonObj;
private static bool Load(UnityModManager.ModEntry modEntry)
{
@ -25,14 +27,14 @@ namespace dv_locofaces
MyModEntry.OnGUI = entry => MySettings.Draw(entry);
MyModEntry.OnSaveGUI = entry => MySettings.Save(entry);
string bundlePath = Path.Combine(MyModEntry.Path, "bundles\\");
var facesBundle = AssetBundle.LoadFromFile(Path.Combine(MyModEntry.Path, "facesbundle"));
S060FaceObj = AssetBundle.LoadFromFile(Path.Combine(bundlePath, "s060face"))
.LoadAsset<GameObject>("assets/tobuild/s060face/s060face.prefab");
S060FaceObj = facesBundle.LoadAsset<GameObject>("assets/tobuild/s060face/s060face.prefab");
HenryObj = facesBundle.LoadAsset<GameObject>("assets/tobuild/henry/henry.prefab");
GordonObj = facesBundle.LoadAsset<GameObject>("assets/tobuild/gordon/gordon.prefab");
var harmony = new Harmony(MyModEntry.Info.Id);
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
catch (Exception ex)
{

View File

@ -11,11 +11,12 @@ namespace dv_locofaces
public enum S282Face
{
None,
Mixed,
Gordon,
Henry,
Gordon
}
public S282Face S282FaceType = S282Face.Gordon;
public S282Face S282FaceType = S282Face.Mixed;
public void Draw(UnityModManager.ModEntry modEntry)
{

View File

@ -4,7 +4,7 @@ param (
)
Set-Location "$PSScriptRoot"
$FilesToInclude = "info.json","build/*","LICENSE","bundles"
$FilesToInclude = "info.json","build/*","LICENSE","facesbundle"
$modInfo = Get-Content -Raw -Path "info.json" | ConvertFrom-Json
$modId = $modInfo.Id
@ -20,7 +20,6 @@ $ZipOutDir = "$ZipWorkDir/$modId"
New-Item "$ZipOutDir" -ItemType Directory -Force
Copy-Item -Force -Path $FilesToInclude -Destination "$ZipOutDir"
Copy-Item -Force -Path "bundles/*" -Destination "$ZipOutDir/bundles"
if (!$NoArchive)
{