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
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);
// Run with ModTools console while the asset is open in asset editor, then save the asset!
var prefab = ToolsModifierControl.toolController.m_editPrefabInfo;
prefab.m_dlcRequired = SteamHelper.DLC_BitMask.None;
@boformer
boformer / make-pedestrian-connections-editable.cs
Created April 10, 2019 20:20
Make Pedestrian Connections ingame editable/visible
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 / change-building-lod-distance.cs
Last active April 8, 2019 13:54
Change building lod distance script
// Change the LOD distance of building assets. Run this script while the building is loaded in asset editor, then save the building
// It basically "fakes" a mesh in the basement, adds something to the building bounds in negative direction.
// The game thinks that the asset is bigger and gives it a higher LOD distance
// maximum support value is 1000f, minimum is 250f
var lodRenderDistance = 1000f;
// --- end of editable values ---
using Harmony;
using ICities;
using UnityEngine;
namespace NoParkBuildingFires
{
public class Mod : IUserMod
{
private const string HarmonyId = "boformer.NoParkBuildingFires";
private HarmonyInstance _harmony;
@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 / level-crossings.cs
Created March 30, 2019 07:37
Script to save level crossings with shader parameters
// Warning: Do not save vehicles after running this script without a game restart!
// Pivot (X, Y, Z, <ignored>)
var rollLocation0 = new Vector4(-0.137f, 1.497f, 0.0f, 1.0f);
// Rotation Axis (X, Y, Z, <ignored>)
var rollParams0 = new Vector4(0.0f, 0.0f, 1.0f, 10.0f);
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_material.SetVector("_RollLocation0", rollLocation0);
@boformer
boformer / prop-render-distance.cs
Last active March 30, 2019 10:59
Prop max render distance modifier
// run this script in asset editor before saving your prop
// value should be between 100f and 1000f (1000 is the maximum, higher values will have no effect)
var propRenderDistance = 1000f;
var fakeTriangleArea = (propRenderDistance - 100f) / 1.41f;
fakeTriangleArea *= fakeTriangleArea;
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_generatedInfo.m_triangleArea = fakeTriangleArea;
@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
@boformer
boformer / harmon.log.txt
Created March 26, 2019 16:20
CreateSegment patch error
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name Prepare and parameters
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name TargetMethods and parameters
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name TargetMethod and parameters
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name Prefix and parameters
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name Transpiler and parameters
AccessTools.Method: Could not find method for type NetworkSkins.Patches.NetManagerCreateSegmentPatch and name Prepare and parameters
### Patch NetManager, Boolean CreateSegment(UInt16 ByRef, Randomizer ByRef, NetInfo, UInt16, UInt16, Vector3, Vector3, UInt32, UInt32, Boolean)
Exception: Exception from HarmonyInstance "boformer.NetworkSkin