Skip to content

Instantly share code, notes, and snippets.

@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 / PloppableAsphaltPlus_Props.cs
Last active January 5, 2018 12:10
For decal compatible ploppable asphalt + props. Tags props, disables ruining and automatically edits normals, scales mesh and paints vertices for main and LOD meshes.
// Ploppable Apshalt + (RoadBridge) used for asphalt and pavement.
// Automatic normal editing, mesh scaling and vertex painting for main and LOD meshes.
// Also removes ruining, and tags as ploppable asphalt prop.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_UIPriority = 0; // Set your UI priority!
var triangles = asset.m_mesh.triangles;
int[] triangleArray = new int[triangles.Length];
@ronyx69
ronyx69 / SpecialPlaces_AssetEditor.cs
Created November 16, 2017 15:02
Sets the amount, direction and position of sitting places for benches.
// m_specialPlaces (SittingDown)
// Sets the amount, direction and position of sitting places for benches.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
var specialPlaces = 1; // amount of sitting positions
PropInfo.SpecialPlace[] temp = new PropInfo.SpecialPlace[specialPlaces];
@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 / Mods
Created November 24, 2017 17:31
List of the mods I have enabled.
Unlimited Money
Unlimited Oil And Ore
Unlock All
ModTools
Asset Prefab AI Changer
Toggle Asset Properties Panel
Asset Item Class Changer
Asset UICategory Changer
More Network Stuff
Prefab Hook
@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
@ronyx69
ronyx69 / NetworkTiling_Script.cs
Last active March 2, 2019 14:07
Script for saving tiling values for network segment and node textures. Visible instantly in road editor, mod not required for saving the asset, only for loading it ingame. If you load a road with tiling applied in the asset editor, the tiling won't be visible but it's still saved, unless a segment/node is reimported.
// Network Tiling Script
//
// Script for saving tiling values for network segment and node textures.
// Visible instantly in road editor, mod not required for saving the asset, only for loading it ingame.
//
// If you load a road with tiling in the asset editor, the tiling won't be visible,
// but it's still saved, unless a segment/node is reimported.
// Don't touch this part, scroll below it.
@ronyx69
ronyx69 / ParkingSpaces_AssetEditor.cs
Last active December 4, 2020 09:32
Sets the amount, type, flags, direction and position of parking spaces for props. Not tested or researched.
// m_parkingSpaces
// Sets the amount, type, flags, direction and position of parking spaces for props.
// I haven't tested or researched this at all.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
var parkingSpaces = 1; // amount of parking spaces
PropInfo.ParkingSpace[] temp = new PropInfo.ParkingSpace[parkingSpaces];
@ronyx69
ronyx69 / NaturalResourceTexture.cs
Last active April 5, 2018 15:11
Imports a natural resource texture and applies the resource values to all cells on the map.
// Natural Resource Texture Importer
// Imports a natural resource texture and applies the resource values to all cells on the map.
// Texture name and location must be gamefolder/textures/res.png
// Resolution is 512x512
//
// Channel explanation:
// Default value for all channels is 128.
//
// Red (128-0) Oil (inverted)
@ronyx69
ronyx69 / ShaderChange_Building_NoBase.cs
Last active May 14, 2018 14:20
Change the shader of a building to NoBase in asset editor.
var shader = Shader.Find("Custom/Buildings/Building/NoBase");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
asset.m_requireHeightMap = false;