Skip to content

Instantly share code, notes, and snippets.

View boformer's full-sized avatar

boformer boformer

  • Ruhr-Universität Bochum
  • Bochum, Germany
View GitHub Profile
@boformer
boformer / large-decals.cs
Last active May 13, 2021 23:57
Large Decal Script without "Decal Prop Fix" mod (based on script by Ronyx69, which is again based on my script)
// Warning: Do not save vehicles after running this script without a game restart!
// Size of decal in meters - width and length
// (texture width and height will be stretched to match this)
var size = new Vector2(16.0f, 8.0f);
// Tiling amount
var tile = new Vector3(1.0f, 1.0f);
// Box mesh height, leave at a negative value to calculate automatically
var prefab = PrefabCollection<NetInfo>.FindLoaded("Metro Station Track Elevated 01");
prefab.m_availableIn = ItemClass.Availability.AssetEditor;
prefab.m_placementStyle = ItemClass.Placement.Manual;
@boformer
boformer / SofterShadowsMod.cs
Created November 8, 2017 20:06
Softer Shadows Mod for Cities: Skylines
using System.Reflection;
using ICities;
using UnityEngine;
namespace SofterShadows
{
public class SofterShadowsMod : LoadingExtensionBase, IUserMod
{
public string Name => "Softer Shadows";
public string Description => "Brightens up the shadows of the game";
@boformer
boformer / flag-params.cs
Created March 30, 2019 11:02
Flags without "Flag Params" mod (based on a script by Ronyx69)
// Warning: Do not save vehicles after running this script without a game restart!
// 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.
//
@boformer
boformer / StreetLightReplacerMod.cs
Last active April 3, 2020 14:00
Cities: Skylines - Street Light Replacer Mod
using ICities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using UnityEngine;
using PrefabHook;
using ColossalFramework.UI;
using ColossalFramework.Plugins;
var prefabNames = new string[]
{
"Pedestrian Connection",
"Pedestrian Connection Surface",
"Pedestrian Connection Inside",
"Pedestrian Connection Underground"
};
foreach (var prefabName in prefabNames)
{
var prefab = PrefabCollection<NetInfo>.FindLoaded(prefabName);
@boformer
boformer / replace-basic-road-texture.cs
Last active December 1, 2019 04:32
Network Texture Experiments (Mod Tools Console Scripts)
var networkName = "Basic Road"; // replace with the one you want to edit
var segmentMaterial = PrefabCollection<NetInfo>.FindLoaded(networkName).m_segments[0].m_segmentMaterial;
Texture2D texture2D;
if (File.Exists("tt/" + networkName + "_D.png"))
{
texture2D = new Texture2D(1, 1);
texture2D.LoadImage(File.ReadAllBytes("tt/" + networkName + "_D.png"));
texture2D.anisoLevel = 0;
segmentMaterial.SetTexture("_MainTex", texture2D);
var netManager = NetManager.instance;
for (ushort n = 0; n < NetManager.MAX_NODE_COUNT; n++)
{
if ((netManager.m_nodes.m_buffer[n].m_flags & NetNode.Flags.Created) != NetNode.Flags.None)
{
var segmentCount = netManager.m_nodes.m_buffer[n].CountSegments();
if (segmentCount == 0)
{
Debug.Log("Releasing ghost node " + n);
netManager.ReleaseNode(n);
@boformer
boformer / prop-rotating-single.cs
Last active April 25, 2019 09:19
Rotating props without PropRotatingParams mod (based on a script by Ronyx69) - Single rotating part
// Warning: Do not save vehicles after running this script without a game restart!
// Prop Rotating Script
// Control rotation axis, pivot and speed.
// Run in asset editor and see effects in real time.
// Animated faces must be vertex painted black! The rest reimains white.
// Google how to do vertex color painting in your 3d software of choice!
@boformer
boformer / prop-rotating-multi.cs
Created April 25, 2019 09:19
Rotating props without PropRotatingParams mod (based on a script by Ronyx69) - Multiple rotating parts
// Warning: Do not save vehicles after running this script without a game restart!
// Prop Rotating Script for multiple rotating parts.
// Control rotation axis, pivot and speed.
// Run in asset editor and see effects in real time.
// The LODs are not rotating, they are like regular props.
// Vertex color blue channel for rotating parts must be 0.