Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / Railway_PropTagger.cs
Last active May 22, 2021 11:16
Tag props for selection in Railway Replacer prop UI.
var styleName = "Sugondese"; // Name which will be visible in the UI
var type = "cat1n"; // The type of prop:
// cat1n single normal catenary
// cat1e single end-catenary
// cat1t single tunnel catenary
// cat2n double normal catenary
// cat2e double end-catenary
// cat2t double tunnel catenary
@ronyx69
ronyx69 / RotorsShader_VehicleGlass.cs
Created November 24, 2018 19:06
Use static rotors shader sub meshes on vehicles for glass.
// Rotors Shader for Vehicle Glass
// Limited to 32 vertices per sub mesh.
// All vertex normals should be straight on the chosen axis.
var subMesh = 1; // vehicle sub mesh id starting from 1, as seen in the asset editor ui
var axis = "y"; // axis explanations:
// x - facing to the side, spins like a wheel
// y - facing up or down, spins like a heli propeller
// z - facing forward or backward, spins like a plane propeller, requires Rotors FlipXZ mod
@ronyx69
ronyx69 / TrafficLightRailwayBarrier_Script.cs
Last active April 10, 2021 13:21
Script for saving Traffic Light Shader params in props, for Railway Barriers. (Added modless shader parameter saving method by boformer.)
// Traffic Light Shader - Railway Crossing Barriers
// Control rotation axis and pivot.
// Run in asset editor.
// (This used to require the PropRotating mod but that is no longer necessary)
// (added modless shader parameter saving method by boformer)
// Rotating parts must be vertex painted black! The rest reimains white.
@ronyx69
ronyx69 / AssetEditor_RecalculateTangents.cs
Created September 12, 2018 13:23
Recalculates tangents for mesh and lod mesh, necessary if you used the mesh rotation feature in the importer, since that results in broken tangents which makes the normal map behave incorrectly. The normal map must +X +Y which means you DO NOT need to flip any channels.
// prop
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_mesh != null) asset.m_mesh.RecalculateTangents();
if(asset.m_lodMesh != null) asset.m_lodMesh.RecalculateTangents();
@ronyx69
ronyx69 / LightEffectEdit_Ingame.cs
Created August 26, 2018 12:09
Ingame light effect editing script.
// Ingame light effect editing script.
// Add as many effect changes as necessary.
// Name of the light effect can be found by plopping the prop, and then
// going to [Ctrl+E] Scene Explorer > Tool Controller > Prop Tool >
// m_prefab > m_effects > m_effects.[id] > m_effect
// The light needs to be moved or plopped for the nearby area to update the effects.
@ronyx69
ronyx69 / FlipXZ.cs
Created August 4, 2018 13:14
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
@ronyx69
ronyx69 / Detail.cs
Created July 16, 2018 15:57
Source code for the Detail mod.
using ColossalFramework.IO;
using ColossalFramework.UI;
using ICities;
using System;
using System.IO;
using System.Reflection;
using System.Xml.Serialization;
using UnityEngine;
namespace Detail
@ronyx69
ronyx69 / DetailScripts.cs
Last active July 16, 2018 15:34
Scripts for props and trees for the Detail mod. Mod is not required for creating and saving the asset.
// Detail Script
// Tags a prop as detail prop for custom render distance and optional color matching.
var lod = 100f; // Distance at which LOD appears.
var max = 200f; // Distance at which the prop disappears.
var vegetation = true; // Set to true for color variations override according to Detail mod settings.
@ronyx69
ronyx69 / FlipXZ_Script.cs
Last active July 6, 2018 08:21
Tags a rotors shader vehicle sub mesh for Rotors FlipXZ mod.
// FlipXZ Script
// Tags a rotors shader vehicle sub mesh for Rotors FlipXZ mod.
var subMesh = 1; // vehicle sub mesh id, starting from 1
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as VehicleInfo;
asset.m_subMeshes[subMesh].m_subInfo.m_UIPriority = 120122;
@ronyx69
ronyx69 / Decal_Script.cs
Last active June 8, 2019 14:50
Script for creating decals of any size using a premade mesh you can download here: https://drive.google.com/open?id=1hr6l0HO76g3K7tV3At_Brx29-EHxDVAQ (Based on original script by boformer. Added modless shader parameter saving method by boformer.)
// Decal Script (based on original script by boformer)
// (added modless shader parameter saving method by boformer)
//
// Removes the need for making a mesh, just import the provided decal mesh
// and this script will automatically change the size you set.
//
// Warning: Do not save vehicles after running this script without a game restart!
var size = new Vector2(8.0f, 8.0f); // Size of decal in meters - width and length