Skip to content

Instantly share code, notes, and snippets.

Avatar

boformer boformer

  • Ruhr-Universität Bochum
  • Bochum, Germany
View GitHub Profile
View unlock-station-track.cs
var prefab = PrefabCollection<NetInfo>.FindLoaded("Metro Station Track Elevated 01");
prefab.m_availableIn = ItemClass.Availability.AssetEditor;
prefab.m_placementStyle = ItemClass.Placement.Manual;
@boformer
boformer / Mod.cs
Last active Jul 15, 2021
Example Harmony 2.x Cities: Skylines Mod (Harmony provided by CitiesHarmony mod)
View Mod.cs
using ICities;
using System;
using ColossalFramework.PlatformServices;
using ColossalFramework.Plugins;
namespace HarmonyMod {
public class Mod : IUserMod {
// You can add Harmony 1.2.0.8 as a dependency, but make sure that 0Harmony.dll is not copied to the output directory!
// (0Harmony.dll is provided by CitiesHarmony workshop item)
@boformer
boformer / cel-documentation.md
Last active Feb 28, 2021
Custom Effect Loader Documentation
View cel-documentation.md

Custom Effect Loader

The mod allows you to define your own light effects. Those light effects can be added to props to create all kinds of street lights, lamps and spots.

Vehicles are also supported, but the asset editor does not provide a UI for adding light effects to a vehicle, so it is a bit more difficult.

In the future, it is also planned to support particle effects and possibly sound effects.

Vanilla-compatibility

@boformer
boformer / EffectsDefinition.xml
Last active Oct 6, 2019
CustomEffectLoader Definition File
View EffectsDefinition.xml
<?xml version="1.0" encoding="utf-8"?>
<EffectsDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Effects>
<LightEffect
name="boformer.MY CUSTOM EFFECT"
type="Spot"
intensity="6.2"
range="500"
spotAngle="10"
spotLeaking="0.5"
View release-ghost-nodes.cs
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-multi.cs
Created Apr 25, 2019
Rotating props without PropRotatingParams mod (based on a script by Ronyx69) - Multiple rotating parts
View prop-rotating-multi.cs
// 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.
@boformer
boformer / prop-rotating-single.cs
Last active Apr 25, 2019
Rotating props without PropRotatingParams mod (based on a script by Ronyx69) - Single rotating part
View prop-rotating-single.cs
// 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!
View post-build-harmony.bat
mkdir "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)"
del "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)\$(TargetFileName)"
xcopy /y "$(TargetPath)" "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)"
xcopy /y "$(TargetDir)0Harmony.dll" "%LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)"
View NoParkBuildingFires.cs
using Harmony;
using ICities;
using UnityEngine;
namespace NoParkBuildingFires
{
public class Mod : IUserMod
{
private const string HarmonyId = "boformer.NoParkBuildingFires";
private HarmonyInstance _harmony;
View make-pedestrian-connections-editable-and-visible.cs
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);