Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / TextureReplacer.cs
Last active April 12, 2017 22:13
Replace textures in real time ingame.
// Texture Replacer script by Ronyx69
// INGAME not ASSET EDITOR
// Replaces textures ingame in real time!
// Much thanks to SamsamTS for explaining Actions to me and being helpful.
// D, ACI, XYS textures for buildings, props, vehicles and D, XYCA for trees.
// Unfortunately CANNOT replace LOD textures.
// Technically I know how to replace LOD textures,
@ronyx69
ronyx69 / TextureReplacer_AssetEditor.cs
Last active May 18, 2017 02:58
Replace textures in real time in asset editor.
// Texture Replacer script by Ronyx69
// ASSET EDITOR, not ingame
// Replaces textures in asset editor in real time!
// Much thanks to SamsamTS for explaining Actions to me and being helpful.
// D, ACI, XYS textures for buildings, props, vehicles and D, XYCA for trees.
// Unfortunately CANNOT replace LOD textures.
// Technically I know how to replace LOD textures,
@ronyx69
ronyx69 / PloppableAsphaltPlus.cs
Last active July 22, 2018 22:52
Source code for Ploppable Asphalt + mod.
using ColossalFramework.IO;
using ColossalFramework.Plugins;
using ColossalFramework.UI;
using ICities;
using System;
using System.IO;
using System.Reflection;
using System.Xml.Serialization;
using UnityEngine;
@ronyx69
ronyx69 / Vehicle_to_Prop.cs
Last active April 12, 2017 22:08
A first draft at converting a vehicle to a prop ingame.
var vehicle = PrefabCollection<VehicleInfo>.FindLoaded("Sedan"); //get the vehicle
var prop = PrefabCollection<PropInfo>.FindLoaded("Cargo container"); //get the prop
prop.m_mesh=vehicle.m_mesh; //apply vehicle mesh to the prop
prop.m_material.SetTexture("_MainTex", vehicle.m_material.GetTexture("_MainTex")); //apply vehicle diffuse to prop
prop.m_material.SetTexture("_XYSMap", vehicle.m_material.GetTexture("_XYSMap")); //apply vehicle XYS to prop
Texture2D aci; aci = new Texture2D(1, 1); //make new empty texture
aci = vehicle.m_material.GetTexture("_ACIMap"); //WRONG!!! ACI should be made unique/instantiated!? idk
@ronyx69
ronyx69 / ShaderChange_Additive_Prop.cs
Last active April 6, 2018 09:04
Changes the shader of a prop to additive in asset editor.
var shader = Shader.Find("Custom/Particles/Additive (Soft)");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
@ronyx69
ronyx69 / NetworkList.cs
Last active November 15, 2020 23:21
Lists all networks in a text file.
var prefabNames = new List<string>();
for (uint i = 0; i < PrefabCollection<NetInfo>.LoadedCount(); i++)
{
var prefab = PrefabCollection<NetInfo>.GetLoaded(i);
if (prefab == null) continue;
Debug.Log(prefab);
prefabNames.Add(prefab.ToString());
}
prefabNames.Sort();
var s="\n";
@ronyx69
ronyx69 / ShaderList
Last active June 5, 2018 16:23
A list of all shaders.
Custom/Buildings/Building/AnimUV
Custom/Buildings/Building/Basement
Custom/Buildings/Building/Construction
Custom/Buildings/Building/Default
Custom/Buildings/Building/Fence
Custom/Buildings/Building/Floating
Custom/Buildings/Building/NoBase
Custom/Buildings/Building/Water
Custom/Buildings/Building/WaterFlow
Custom/Buildings/Building/WindTurbine
@ronyx69
ronyx69 / PloppableAsphalt_Script.cs
Last active April 12, 2017 22:03
Sets tags for props/decals for ploppable asphalt.
//asphalt props
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_mesh.name="ploppableasphalt-prop";
//asphalt decal
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_mesh.name="ploppableasphalt-decal";
@ronyx69
ronyx69 / EmptyMod_Delayed.cs
Last active April 12, 2017 22:04
An empty mod which waits for all mods to be loaded.
using ColossalFramework.Plugins;
using ColossalFramework.UI;
using ICities;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml.Serialization;
using UnityEngine;
namespace ThemeDecals
@ronyx69
ronyx69 / ShaderChange_Rotors.cs
Last active August 17, 2020 12:11
Change the shader of a prop, building, or building sub mesh to rotors in asset editor. Also deletes LOD.
// Rotors Shader
// Also deletes LOD.
// Prop
var shader = Shader.Find("Custom/Vehicles/Vehicle/Rotors");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_material != null) asset.m_material.shader = shader;