Skip to content

Instantly share code, notes, and snippets.

Ronyx69 ronyx69

Block or report user

Report or block ronyx69

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ronyx69
ronyx69 / Vehicle_PropMesh_Copy.cs
Last active May 19, 2019
Copies mesh from a prop to a vehicle, don't use for vehicles with tyres.
View Vehicle_PropMesh_Copy.cs
// Copies mesh from a prop to a vehicle, don't use for vehicles with tyres.
var propname = "filename.Asset Name"; // filename.Asset Name
var prop = PrefabCollection<PropInfo>.FindLoaded(propname + "_Data");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as VehicleInfo;
asset.m_mesh.vertices = prop.m_mesh.vertices; asset.m_mesh.triangles = prop.m_mesh.triangles;
asset.m_mesh.tangents = prop.m_mesh.tangents; asset.m_mesh.normals = prop.m_mesh.normals;
asset.m_mesh.uv = prop.m_mesh.uv; asset.m_mesh.bounds = prop.m_mesh.bounds;
@ronyx69
ronyx69 / BuildingBaseMeshDelete.cs
Last active Jun 18, 2019
Script for deleting the automatically generated base mesh for buildings or building sub meshes.
View BuildingBaseMeshDelete.cs
// Deletes automatically generated base mesh based on vertex colors.
// Changes shader to NoBase, enables noBase boolean, raises or lowers vertices too close to 0.
var subMesh = -1; // sub mesh id, order as in ui, starting from 0 (-1 means main building mesh)
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
var m = asset.m_mesh; var shader = Shader.Find("Custom/Buildings/Building/NoBase"); var newVertCount = 0;
if(subMesh >= 0) { m = asset.m_subMeshes[subMesh].m_subInfo.m_mesh;
if(asset.m_subMeshes[subMesh].m_subInfo.m_material != null) asset.m_subMeshes[subMesh].m_subInfo.m_material.shader = shader;
if(asset.m_subMeshes[subMesh].m_subInfo.m_lodMaterial != null) asset.m_subMeshes[subMesh].m_subInfo.m_lodMaterial.shader = shader;
@ronyx69
ronyx69 / BuildingSubMesh_FloorParams.cs
Created May 1, 2019
Change building floor parameters for a sub-mesh.
View BuildingSubMesh_FloorParams.cs
var subMesh = 0;
var vec = new Vector4(0.0f, 3.1f, 3.0f, 900.1f);
var asset = (ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo).m_subMeshes[subMesh].m_subInfo;
asset.m_material.SetVector("_FloorParams", vec);
@ronyx69
ronyx69 / Building_PlacementMode_AssetEditor.cs
Created Mar 24, 2019
Script for changing the placement mode for buildings.
View Building_PlacementMode_AssetEditor.cs
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
// Possible placement modes:
// Roadside
// Shoreline
// OnWater
// OnGround
// OnSurface
// OnTerrain
@ronyx69
ronyx69 / Vehicle_CustomWheels.cs
Created Mar 18, 2019
Copy vertex paint from prop to vehicle, set tire parameters.
View Vehicle_CustomWheels.cs
// Copy vertex paint from prop to vehicle and set tire parameters.
var asset2 = PrefabCollection<PropInfo>.FindLoaded("filename.Asset Name_Data"); // CHANGE TO PROP NAME
Vector4[] tyres = new Vector4[] { // Tire parameter vectors (X, Y, Z, diameter), add/remove lines if necessary.
new Vector4(-0.739f, 0.328f, 1.421f, 0.328f),
new Vector4(0.739f, 0.328f, 1.421f, 0.328f),
new Vector4(-0.739f, 0.331f, -1.93f, 0.331f),
@ronyx69
ronyx69 / Thirty_Fifteen_Curb.cs
Last active Mar 10, 2019
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.
View Thirty_Fifteen_Curb.cs
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 Jan 22, 2019
Network segment and node reorder scripts. Refreshes UI automatically.
View Network_SegmentNode_Reorder.cs
// 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 Jun 8, 2019
Script for saving Flag shader params in vehicle sub meshes. Still requires the Flag Params mod.
View FlagParams_Vehicle_Script.cs
// 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 Jan 15, 2019
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
View ConvertTextureDump.cs
// 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 Jan 15, 2019
Refreshes building color variations ingame.
View UpdateBuildingColors_Ingame.cs
BuildingManager.instance.UpdateBuildingColors();
You can’t perform that action at this time.