Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / AdditiveShader_mod.cs
Last active August 4, 2018 13:10
Source code for the Additive Shader mod.
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 / CitizenWalkSpeed.cs
Created June 5, 2018 17:31
Change walk speed of all citizens.
for (uint i = 0; i < PrefabCollection<CitizenInfo>.LoadedCount(); i++) {
var prefab = PrefabCollection<CitizenInfo>.GetLoaded(i);
if (prefab == null) continue; prefab.m_walkSpeed = 0.5f; }
@ronyx69
ronyx69 / AnimUV_VehicleSubMesh.cs
Created June 5, 2018 14:36
Copy vertex paint from a prop to a vehicle sub mesh. Apply and save AnimUV params.
// Anim UV Scripts
// Create scrolling or multi-frame animations for vehicle sub meshes.
// Run in asset editor and see effects in real time.
// AnimUV Params Mod is not required for using the scripts and saving the asset.
// It's only needed to load the data in-game.
// Animated faces must be vertex painted black! The rest reimains white.
@ronyx69
ronyx69 / Rotors_VehicleSubMesh.cs
Last active January 9, 2019 12:46
Copy vertex paint from prop to vehicle sub mesh, use rotors shader on a vehicle sub mesh, adjust shader and tyre parameters.
// reminder: the y axis ingame represents height
// (as opposed to z, usually used in 3d software)
// copy vertex paint from prop to vehicle sub mesh
// vertex color explanation
// RED for blimps(visibility): 0 visible when spinning, 255 visible when stopped
// IDK what red will do on other vehicles
@ronyx69
ronyx69 / Flags_VehicleSubMesh.cs
Created May 29, 2018 17:28
Change the flags of a vehicle sub mesh in asset editor.
var subMesh = 0; // sub mesh id, order as in ui, starting from 1 (0 is main mesh)
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as VehicleInfo;
// required and forbidden flags, use | to set multiple flags
asset.m_subMeshes[subMesh].m_vehicleFlagsRequired = Vehicle.Flags.Created | Vehicle.Flags.Flying;
asset.m_subMeshes[subMesh].m_vehicleFlagsForbidden = Vehicle.Flags.Reversed;
// parked flags
asset.m_subMeshes[subMesh].m_parkedFlagsRequired = VehicleParked.Flags.CustomName;
@ronyx69
ronyx69 / Flags_BuildingSubMesh.cs
Created May 29, 2018 17:17
Change the flags of a building sub mesh in asset editor.
var subMesh = 0; // sub mesh id, order as in ui, starting from 0
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
// required and forbidden flags, use | to set multiple flags
asset.m_subMeshes[subMesh].m_flagsRequired = Building.Flags.Created | Building.Flags.Active;
asset.m_subMeshes[subMesh].m_flagsForbidden = Building.Flags.Abandoned;
// all building flags:
/*
@ronyx69
ronyx69 / ShaderChange_VehicleSubMesh_PropDefault.cs
Created May 29, 2018 17:03
Change the shader of a vehicle sub mesh to prop default in asset editor.
var subMesh = 1; // sub mesh id, order as in ui, starting from 1
var shader = Shader.Find("Custom/Props/Prop/Default"); // the shader to use
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as VehicleInfo;
asset.m_subMeshes[subMesh].m_subInfo.m_material.shader = shader;
asset.m_subMeshes[subMesh].m_subInfo.m_lodMaterial.shader = shader;
@ronyx69
ronyx69 / ShaderChange_BuildingSubMesh_PropDefault.cs
Created May 29, 2018 16:56
Change the shader of a building sub mesh to prop default in asset editor.
var subMesh = 0; // sub mesh id, order as in ui, starting from 0
var shader = Shader.Find("Custom/Props/Prop/Default"); // the shader to use
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
asset.m_subMeshes[subMesh].m_subInfo.m_material.shader = shader;
asset.m_subMeshes[subMesh].m_subInfo.m_lodMaterial.shader = shader;
@ronyx69
ronyx69 / TreeVariations_AssetEditor.cs
Created May 22, 2018 15:28
Sets amount of tree variations and calculates equal probability. Thanks to TPB for making it work.
//----------------------------------------------------------------
// Tree Variation Amount Changer
// Set amount of Tree variations.
// If you are increasing the amount, previous variations will be preserved.
// If decreasing, all variations will be removed!
var variations = 12; //CHANGE THIS
@ronyx69
ronyx69 / TreeWindSwayCentral_AssetEditor.cs
Last active May 20, 2018 10:22
Calculates custom center-outwards tree wind sway with an adjustable multiplier.
// Tree Wind Sway Recalculator (Central)
// Recalculates vertex colors based on the proximity to center.
// Allows limiting sway with an adjustable multiplier.
var sway = 0.2f; // Sway multiplier 0.0 (none) to 1.0 (max)
var bias = 1.6f; // "Contrast" between center and outer parts,
// increasing this will make the middle more static,
// and the outside move more.