Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / Relight.cs
Last active July 28, 2023 01:56
Source code for Relight mod. Rebalanced and customizable lighting and tonemapping. UI / saving and preset system by Simon Royer. Shadow bias change by saki7. Shadow smoothing change by TPB.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICities;
using UnityEngine;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Xml.Serialization;
@ronyx69
ronyx69 / AnimUV_Scripts.cs
Last active April 10, 2023 12:33
Scripts for saving AnimUV params in props. (Added modless shader parameter saving method by boformer.)
// Anim UV Scripts
// Create scrolling or multi-frame animations for props.
// Run in asset editor and see effects in real time.
// Animated faces must be vertex painted black! The rest reimains white.
// Shades of gray animate slower, don't use unless you know what you're doing.
// Google how to do vertex color painting in your 3d software of choice!
@ronyx69
ronyx69 / Realtime.cs
Last active August 31, 2022 15:31
Source code for Realtime mod. Ingame texture and mesh replacement. UI by Simon Royer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using System.IO;
using ColossalFramework.IO;
using ObjUnity3D;
using ICities;
@ronyx69
ronyx69 / PropRotating_Script.cs
Last active May 29, 2022 16:00
Script for saving PropRotating params in props. (Added modless shader parameter saving method by boformer.)
// Prop Rotating Script
// Control rotation axis, pivot and speed.
// Run in asset editor and see effects in real time.
// Animated faces must be vertex painted black! The rest reimains white.
// Google how to do vertex color painting in your 3d software of choice!
// The LODs are not rotating, they are like regular props.
@ronyx69
ronyx69 / replace_net_with_net.cs
Last active May 18, 2022 17:57
Replace target networks with replacement networks. Could break everything idk.
// replace all target nets with replacement net
var target = PrefabCollection<NetInfo>.FindLoaded("Pedestrian Connection Surface");
var replacement = PrefabCollection<NetInfo>.FindLoaded("Pedestrian Connection");
var b = NetManager.instance.m_segments.m_buffer;
for(var i=0;i<b.Length;i++) if(b[i].m_flags!=0) if(b[i].Info==target) b[i].Info=replacement;
var b2 = NetManager.instance.m_nodes.m_buffer;
for(var i=0;i<b2.Length;i++) if(b2[i].m_flags!=0) if(b2[i].Info==target) b2[i].Info=replacement;
for(var i=0;i<b.Length;i++) if(b[i].m_flags!=0) NetManager.instance.UpdateSegment((ushort)i);
@ronyx69
ronyx69 / PropBufferReadSet.cs
Last active July 18, 2021 09:57
Reads the prop buffer and generates a script to set it. Intended for reading/setting props for buildings in the asset editor. Generated example below the actual script.
// You must place the exact amount of props (any kind of props anywhere) before running the prop set script, otherwise it will not work properly.
// Generate a script to place props, located in local addons folder.
var s = "PropInstance[] nb = new PropInstance[65536];\n\n";
var buffer = PropManager.instance.m_props.m_buffer;
for(var i = 0; i < buffer.Length; i++) if (buffer[i].m_flags!=0) {
s = s + "nb[" + i + "].Angle = " + buffer[i].Angle + "f;\n";
s = s + "nb[" + i + "].Blocked = " + buffer[i].Blocked.ToString().ToLower() + ";\n";
@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 / Railway_StationTrackTagger.cs
Last active May 22, 2021 11:13
Tag station tracks for usage in Railway track replacer UI.
var stationTrackType = "r69rwst-double"; // The type of station track:
// r69rwst-double (normal double station track)
// r69rwst-edouble (elevated double station track)
// r69rwst-single2 (single station track - two sided boarding)
// r69rwst-single1 (single station track - left sided boarding)
// r69rwst-singler (single station track - right sided boarding)
// r69rwst-esingle2 (elevated single station track - two sided boarding (shinkansen only afaik))
// r69rwst-esinglel (elevated single station track - left sided boarding)
@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 / NetworkTiling.cs
Last active February 27, 2021 13:26
Source code for Network Tiling mod. Allows controlling the tiling of network segment and node textures.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICities;
using UnityEngine;
namespace NetworkTiling
{
public class NetworkTilingMod : LoadingExtensionBase, IUserMod