Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / Thirty_Fifteen_Curb.cs
Last active March 31, 2020 10:42
Attempts to find all -30cm roads and lifts them to -15cm. Doesn't work for LOD. Also updates all segments (therefore lanes too) so vehicles jump up to the new height.
var networks = Resources.FindObjectsOfTypeAll<NetInfo>();
for(uint i = 0; i < networks.Length; i++)
{
var network = networks[i];
if(network == null) continue;
if(network.m_netAI == null) continue;
if(network.m_netAI.GetType().Name != "RoadAI" &&
network.m_netAI.GetType().Name != "RoadBridgeAI" &&
network.m_netAI.GetType().Name != "RoadTunnelAI") continue;
{
@ronyx69
ronyx69 / Network_SegmentNode_Reorder.cs
Last active September 13, 2020 21:13
Network segment and node reorder scripts. Refreshes UI automatically.
// Network segment and node reorder scripts. Refreshes UI automatically.
// SEGMENTS
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo;
@ronyx69
ronyx69 / FlagParams_Vehicle_Script.cs
Last active June 8, 2019 15:24
Script for saving Flag shader params in vehicle sub meshes. Still requires the Flag Params mod.
// for vehicles, vertex colors get generated and overwritten on import
// therefore you need to import the rotors sub mesh as a prop, save, reload
// and then import the vehicle sub mesh,
// and copy the vertex paint from the prop to the vehicle sub mesh using this script:
var subMesh = 1; // vehicle sub mesh id, starting from 1
var asset2 = PrefabCollection<PropInfo>.FindLoaded("filename.Asset Name_Data"); // CHANGE TO PROP NAME
@ronyx69
ronyx69 / ConvertTextureDump.cs
Created January 15, 2019 13:44
Converts a texture to a different format for dumping with mod tools, for cases where some textures can't be dumped normally. Puts the converted texture in Sunny Properties > Sunny Net > NetProperties >m_downwardDiffuse
// map theme texture
var source = UnityEngine.Object.FindObjectOfType<TerrainProperties>().m_grassDiffuse;
var target = new Texture2D(source.width, source.height, TextureFormat.RGBAFloat, true);
target.SetPixels(source.GetPixels());
target.anisoLevel = source.anisoLevel; target.filterMode = source.filterMode;
target.wrapMode = source.wrapMode; target.Apply();
UnityEngine.Object.FindObjectOfType<NetProperties>().m_downwardDiffuse = target;
@ronyx69
ronyx69 / UpdateBuildingColors_Ingame.cs
Created January 15, 2019 12:14
Refreshes building color variations ingame.
BuildingManager.instance.UpdateBuildingColors();
@ronyx69
ronyx69 / FlagParams_Mod.cs
Last active January 21, 2019 12:24
Source code for the Flag Params mod.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICities;
using UnityEngine;
namespace FlagParams
{
public class FlagParamsMod : LoadingExtensionBase, IUserMod
@ronyx69
ronyx69 / Flag_Script.cs
Last active August 26, 2020 00:04
Script for saving Flag shader params in props. (Added modless shader parameter saving method by boformer.)
// The script will not work properly if you have no texture imported.
//
// The vertex paint of the mesh controls the amount of movement:
// white means no movement and black means maximum movement.
//
// If you're using multiple "flag" textures in one prop, (like vanilla flags)
// the flag must be entirely black and everything else should be white,
// and you can't use the strength variable, otherwise the UV mapping will break.
// The flag should be UV mapped onto the flag on the bottom right of the texture.
@ronyx69
ronyx69 / SteamWorkshopStatsSheetString.js
Last active December 28, 2018 13:08
Prints out a string of workshop stats (name, days, visitors, subs (current), subs (total), favs (current), favs (total), positive ratings, negative ratings), ready to be pasted into google sheets and must be automatically seperated by @ character. Run in developer console while item stats page is open.
(function(){ 'use strict';
var headingNodes = [], results, link, tags = ['td'];
tags.forEach(function(tag) {
results = document.getElementsByTagName(tag);
Array.prototype.push.apply(headingNodes, results);
});
console.log(
document.getElementsByClassName("workshopItemTitle")[0].innerHTML + '@' +
document.getElementsByClassName("littleNum")[0].innerHTML.split(" ")[1] + '@' +
results[1].innerHTML + '@' + results[3].innerHTML + '@' + results[5].innerHTML +
@ronyx69
ronyx69 / HDRIH1.cs
Created December 10, 2018 14:14
Source code for the HDRI Haven Cubemap Pack.
using ICities;
using System;
namespace HDRIH1Cubemap
{
public class HDRIH1Cubemap : IUserMod
{
public string Name
{
get
@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)