Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / ThemeIngame.cs
Last active December 17, 2018 20:58
Change theme textures and colors ingame.
// scripts to change map theme textures, colors and other stuff ingame
// textures must be located in gamefolder/textures/
// also applies sharp textures mod default settings
// grass.png
if (File.Exists("textures/" + "grass.png")) { Texture2D texture2D = new Texture2D(1, 1);
texture2D.LoadImage(File.ReadAllBytes("textures/" + "grass.png"));
UnityEngine.Object.FindObjectOfType<TerrainProperties>().m_grassDiffuse = texture2D; }
TerrainManager.instance.m_properties.InitializeShaderProperties();
@ronyx69
ronyx69 / ColorVariations_AssetEditor.cs
Last active November 30, 2017 11:00
Sets color variations in asset editor.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo; // BuildingInfo PropInfo VehicleInfo
var color1 = new Color32(255, 255, 255, 255);
var color2 = new Color32(255, 255, 255, 255);
var color3 = new Color32(255, 255, 255, 255);
var color4 = new Color32(255, 255, 255, 255);
asset.m_material.SetColor("_ColorV0", color1);
asset.m_material.SetColor("_ColorV1", color2);
@ronyx69
ronyx69 / ThemeDecals.cs
Last active August 21, 2017 13:12
Source code of the theme decals mod.
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 / ThemeDecals_Script.cs
Last active April 12, 2017 21:51
Script for creating your own theme decals.
// You MUST use a unique diffuse texture (put whatever texture in it) to avoid unforeseen consequences!
// Import a decal or a big decal as usual and run this script using the texture tag you want:
//themedecal-grass
//themedecal-cliff
//themedecal-sand
//themedecal-gravel
//themedecal-ruined
//themedecal-oil
@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;
@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 / 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 / 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 / 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 / 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;