Skip to content

Instantly share code, notes, and snippets.

@ronyx69
Created August 4, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronyx69/086dbfa867b3f3c0a701f3258a973eb6 to your computer and use it in GitHub Desktop.
Save ronyx69/086dbfa867b3f3c0a701f3258a973eb6 to your computer and use it in GitHub Desktop.
Source code for the Rotors FlipXZ mod.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICities;
using UnityEngine;
namespace FlipXZ
{
public class FlipXZMod : LoadingExtensionBase, IUserMod
{
public string Name => "Rotors FlipXZ";
public string Description => "Loads FlipXZ parameter for rotors shader vehicle sub meshes.";
public override void OnLevelLoaded(LoadMode mode)
{
base.OnLevelLoaded(mode);
ApplyParams();
}
public override void OnLevelUnloading()
{
base.OnLevelUnloading();
}
private void ApplyParams()
{
foreach (VehicleInfoSub prefab in Resources.FindObjectsOfTypeAll<VehicleInfoSub>())
{
var shader = Shader.Find("Custom/Vehicles/Vehicle/Rotors");
if (prefab.m_UIPriority == 120122 && prefab.m_material.shader == shader) prefab.m_material.SetFloat("_FlipTyreRotationXZ", 1.0f);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment