Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / PropRotating_Multiple_Script.cs
Last active June 23, 2019 16:07
Script for saving PropRotating params in props for multiple rotating parts. (Added modless shader parameter saving method by boformer.)
// Prop Rotating Script for multiple rotating parts.
// Control rotation axis, pivot and speed.
// Run in asset editor and see effects in real time.
// Prop Rotating Params Mod is not required for using the scripts and saving the asset.
// It's only needed to load the data in-game.
// The LODs are not rotating, they are like regular props.
@ronyx69
ronyx69 / AnimUV_Buildings_AssetEditor.cs
Last active November 16, 2020 06:31
Scripts for using AnimUV shader on buildings and building sub meshes.
// Building (and Building Sub Mesh) Anim UV Scripts
// Create scrolling or multi-frame animations for buildings.
// Run in asset editor and see effects in real time.
// Ingame the building might require electricity to animate.
// No mods required, the changes save and load in vanilla.
@ronyx69
ronyx69 / ChangeNetworkVariables_AssetEditor.cs
Last active April 4, 2018 14:59
Change various network variables in asset editor.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo;
// change half width
asset.m_halfWidth = 22.0f;
// enable create pavement
asset.m_createPavement = true;
// change the color of basic segment 0
@ronyx69
ronyx69 / PropIlluminationRange.cs
Created March 21, 2018 13:59
Changes the times when a prop is illuminated.
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
var off = 15.0f; // amount of hours the light is turned off during the day (15 max) (0 means always on)
var random = 0.3f; // adds randomness to time lights turn on/off, if 0 then all lights turn on/off at the same time
asset.m_illuminationOffRange.x = 6*Convert.ToSingle(Math.Pow(Convert.ToDouble((6-off/2.5)/6), Convert.ToDouble(1/1.09)));
asset.m_illuminationOffRange.y = Mathf.Clamp(6*Convert.ToSingle(Math.Pow(Convert.ToDouble((6-off/2.5)/6), Convert.ToDouble(1/1.09)))-random, 0, 6);
@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;
@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 / 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 / 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 / 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 / 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