Last active
January 31, 2021 12:10
-
-
Save ronyx69/8c1aeea1395f92b7c7dfb7ced184d42c to your computer and use it in GitHub Desktop.
Script to set lane props for a network currently loaded in the asset editor. (for any elevation and lane) And another script which generates a script to set/edit lane props.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script to set lane props. Replaces all lane props! | |
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo; var ai = asset.m_netAI as RoadAI; | |
List<NetLaneProps.Prop>[] basic = new List<NetLaneProps.Prop>[asset.m_lanes.Length]; | |
for (int i = 0; i < basic.Length; i++) basic[i] = new List<NetLaneProps.Prop>(); | |
var elevatedLanes = 0; | |
if(ai.m_elevatedInfo != null) if(ai.m_elevatedInfo.m_lanes != null) if(ai.m_elevatedInfo.m_lanes.Length != 0) elevatedLanes = ai.m_elevatedInfo.m_lanes.Length; | |
List<NetLaneProps.Prop>[] elevated = new List<NetLaneProps.Prop>[elevatedLanes]; | |
for (int i = 0; i < elevated.Length; i++) elevated[i] = new List<NetLaneProps.Prop>(); | |
var bridgeLanes = 0; | |
if(ai.m_bridgeInfo != null) if(ai.m_bridgeInfo.m_lanes != null) if(ai.m_bridgeInfo.m_lanes.Length != 0) bridgeLanes = ai.m_bridgeInfo.m_lanes.Length; | |
List<NetLaneProps.Prop>[] bridge = new List<NetLaneProps.Prop>[bridgeLanes]; | |
for (int i = 0; i < bridge.Length; i++) bridge[i] = new List<NetLaneProps.Prop>(); | |
var slopeLanes = 0; | |
if(ai.m_slopeInfo != null) if(ai.m_slopeInfo.m_lanes != null) if(ai.m_slopeInfo.m_lanes.Length != 0) slopeLanes = ai.m_slopeInfo.m_lanes.Length; | |
List<NetLaneProps.Prop>[] slope = new List<NetLaneProps.Prop>[slopeLanes]; | |
for (int i = 0; i < slope.Length; i++) slope[i] = new List<NetLaneProps.Prop>(); | |
var tunnelLanes = 0; | |
if(ai.m_tunnelInfo != null) if(ai.m_tunnelInfo.m_lanes != null) if(ai.m_tunnelInfo.m_lanes.Length != 0) tunnelLanes = ai.m_tunnelInfo.m_lanes.Length; | |
List<NetLaneProps.Prop>[] tunnel = new List<NetLaneProps.Prop>[tunnelLanes]; | |
for (int i = 0; i < tunnel.Length; i++) tunnel[i] = new List<NetLaneProps.Prop>(); | |
Action<List<NetLaneProps.Prop>[], int, NetLaneProps.Prop> LaneProp = (elevation, lane, laneprop) => { | |
laneprop.m_finalProp = laneprop.m_prop; laneprop.m_finalTree = laneprop.m_tree; elevation[lane].Add(laneprop); }; | |
LaneProp(basic, 0, new NetLaneProps.Prop{ | |
m_flagsRequired = NetLane.Flags.None, | |
m_flagsForbidden = NetLane.Flags.None, | |
m_startFlagsRequired = NetNode.Flags.None, | |
m_startFlagsForbidden = NetNode.Flags.None, | |
m_endFlagsRequired = NetNode.Flags.None, | |
m_endFlagsForbidden = NetNode.Flags.None, | |
m_colorMode = NetLaneProps.ColorMode.Default, | |
m_position = new Vector3(0.0f, 3.0f, 0.0f), m_angle = 0.0f, | |
m_segmentOffset = 0.0f, m_repeatDistance = 0.0f, m_minLength = 0.0f, m_cornerAngle = 0.0f, m_probability = 100, | |
m_prop = PrefabCollection<PropInfo>.FindLoaded("Garbage Bin"), | |
m_tree = null, | |
}); | |
LaneProp(elevated, 0, new NetLaneProps.Prop{ | |
m_flagsRequired = NetLane.Flags.None, | |
m_flagsForbidden = NetLane.Flags.None, | |
m_startFlagsRequired = NetNode.Flags.None, | |
m_startFlagsForbidden = NetNode.Flags.None, | |
m_endFlagsRequired = NetNode.Flags.None, | |
m_endFlagsForbidden = NetNode.Flags.None, | |
m_colorMode = NetLaneProps.ColorMode.Default, | |
m_position = new Vector3(0.0f, 6.0f, 0.0f), m_angle = 0.0f, | |
m_segmentOffset = 0.0f, m_repeatDistance = 0.0f, m_minLength = 0.0f, m_cornerAngle = 0.0f, m_probability = 100, | |
m_prop = PrefabCollection<PropInfo>.FindLoaded("Garbage Bin"), | |
m_tree = null, | |
}); | |
LaneProp(elevated, 1, new NetLaneProps.Prop{ | |
m_flagsRequired = NetLane.Flags.None, | |
m_flagsForbidden = NetLane.Flags.None, | |
m_startFlagsRequired = NetNode.Flags.None, | |
m_startFlagsForbidden = NetNode.Flags.None, | |
m_endFlagsRequired = NetNode.Flags.None, | |
m_endFlagsForbidden = NetNode.Flags.None, | |
m_colorMode = NetLaneProps.ColorMode.Default, | |
m_position = new Vector3(0.0f, 6.0f, 0.0f), m_angle = 0.0f, | |
m_segmentOffset = 0.0f, m_repeatDistance = 0.0f, m_minLength = 0.0f, m_cornerAngle = 0.0f, m_probability = 100, | |
m_prop = PrefabCollection<PropInfo>.FindLoaded("Concrete support"), | |
m_tree = null, | |
}); | |
for(int i = 0; i < asset.m_lanes.Length; i++) asset.m_lanes[i].m_laneProps.m_props = basic[i].ToArray(); | |
if(elevatedLanes != 0) for(int i = 0; i < ai.m_elevatedInfo.m_lanes.Length; i++) ai.m_elevatedInfo.m_lanes[i].m_laneProps.m_props = elevated[i].ToArray(); | |
if(bridgeLanes != 0) for(int i = 0; i < ai.m_bridgeInfo.m_lanes.Length; i++) ai.m_bridgeInfo.m_lanes[i].m_laneProps.m_props = bridge[i].ToArray(); | |
if(slopeLanes != 0) for(int i = 0; i < ai.m_slopeInfo.m_lanes.Length; i++) ai.m_slopeInfo.m_lanes[i].m_laneProps.m_props = slope[i].ToArray(); | |
if(tunnelLanes != 0) for(int i = 0; i < ai.m_tunnelInfo.m_lanes.Length; i++) ai.m_tunnelInfo.m_lanes[i].m_laneProps.m_props = tunnel[i].ToArray(); | |
// Script which generates a script to set lane props. The script is saved in the local addons folder, in the file LaneProps.cs | |
var s = "var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo; var ai = asset.m_netAI as RoadAI;\n"; | |
s = s + "List<NetLaneProps.Prop>[] basic = new List<NetLaneProps.Prop>[asset.m_lanes.Length];\n"; | |
s = s + "for (int i = 0; i < basic.Length; i++) basic[i] = new List<NetLaneProps.Prop>();\n"; | |
s = s + "var elevatedLanes = 0;\n"; | |
s = s + "if(ai.m_elevatedInfo != null) if(ai.m_elevatedInfo.m_lanes != null) if(ai.m_elevatedInfo.m_lanes.Length != 0) elevatedLanes = ai.m_elevatedInfo.m_lanes.Length;\n"; | |
s = s + "List<NetLaneProps.Prop>[] elevated = new List<NetLaneProps.Prop>[elevatedLanes];\n"; | |
s = s + "for (int i = 0; i < elevated.Length; i++) elevated[i] = new List<NetLaneProps.Prop>();\n"; | |
s = s + "var bridgeLanes = 0;\n"; | |
s = s + "if(ai.m_bridgeInfo != null) if(ai.m_bridgeInfo.m_lanes != null) if(ai.m_bridgeInfo.m_lanes.Length != 0) bridgeLanes = ai.m_bridgeInfo.m_lanes.Length;\n"; | |
s = s + "List<NetLaneProps.Prop>[] bridge = new List<NetLaneProps.Prop>[bridgeLanes];\n"; | |
s = s + "for (int i = 0; i < bridge.Length; i++) bridge[i] = new List<NetLaneProps.Prop>();\n"; | |
s = s + "var slopeLanes = 0;\n"; | |
s = s + "if(ai.m_slopeInfo != null) if(ai.m_slopeInfo.m_lanes != null) if(ai.m_slopeInfo.m_lanes.Length != 0) slopeLanes = ai.m_slopeInfo.m_lanes.Length;\n"; | |
s = s + "List<NetLaneProps.Prop>[] slope = new List<NetLaneProps.Prop>[slopeLanes];\n"; | |
s = s + "for (int i = 0; i < slope.Length; i++) slope[i] = new List<NetLaneProps.Prop>();\n"; | |
s = s + "var tunnelLanes = 0;\n"; | |
s = s + "if(ai.m_tunnelInfo != null) if(ai.m_tunnelInfo.m_lanes != null) if(ai.m_tunnelInfo.m_lanes.Length != 0) tunnelLanes = ai.m_tunnelInfo.m_lanes.Length;\n"; | |
s = s + "List<NetLaneProps.Prop>[] tunnel = new List<NetLaneProps.Prop>[tunnelLanes];\n"; | |
s = s + "for (int i = 0; i < tunnel.Length; i++) tunnel[i] = new List<NetLaneProps.Prop>();\n"; | |
s = s + "Action<List<NetLaneProps.Prop>[], int, NetLaneProps.Prop> LaneProp = (elevation, lane, laneprop) => {\n"; | |
s = s + "laneprop.m_finalProp = laneprop.m_prop; laneprop.m_finalTree = laneprop.m_tree; elevation[lane].Add(laneprop); };\n\n"; | |
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo; var ai = asset.m_netAI as RoadAI; | |
if(asset.m_lanes != null) if(asset.m_lanes.Length != null) for(int i = 0; i < asset.m_lanes.Length; i++) { | |
if(asset.m_lanes[i].m_laneProps != null) if(asset.m_lanes[i].m_laneProps != null) { | |
if(asset.m_lanes[i].m_laneProps.m_props != null) if(asset.m_lanes[i].m_laneProps.m_props.Length != null) foreach (var LaneProp in asset.m_lanes[i].m_laneProps.m_props) { | |
if(LaneProp.m_prop != null) { | |
s = s + "LaneProp(basic, "+i+", new NetLaneProps.Prop{\n"; | |
s = s + "m_flagsRequired = NetLane.Flags."+LaneProp.m_flagsRequired.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_flagsForbidden = NetLane.Flags."+LaneProp.m_flagsForbidden.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_startFlagsRequired = NetNode.Flags."+LaneProp.m_startFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+", \n"; | |
s = s + "m_startFlagsForbidden = NetNode.Flags."+LaneProp.m_startFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsRequired = NetNode.Flags."+LaneProp.m_endFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsForbidden = NetNode.Flags."+LaneProp.m_endFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_colorMode = NetLaneProps.ColorMode."+LaneProp.m_colorMode+",\n"; | |
s = s + "m_position = new Vector3("+LaneProp.m_position.x+"f, "+LaneProp.m_position.y+"f, "+LaneProp.m_position.z+"f), m_angle = "+LaneProp.m_angle+"f,\n"; | |
s = s + "m_segmentOffset = "+LaneProp.m_segmentOffset+"f, m_repeatDistance = "+LaneProp.m_repeatDistance+"f, m_minLength = "+LaneProp.m_minLength+"f, m_cornerAngle = "+LaneProp.m_cornerAngle+"f, m_probability = "+LaneProp.m_probability+",\n"; | |
if(LaneProp.m_prop) s = s + "m_prop = PrefabCollection<PropInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n"; else s = s + "m_prop = null,\n"; | |
if(LaneProp.m_tree) s = s + "m_tree = PrefabCollection<TreeInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n";else s = s + "m_tree = null\n"; | |
s = s + "});\n\n"; | |
} | |
} | |
} | |
} | |
if(ai.m_elevatedInfo != null) { asset = ai.m_elevatedInfo; | |
if(asset.m_lanes != null) if(asset.m_lanes.Length != null) for(int i = 0; i < asset.m_lanes.Length; i++) { | |
if(asset.m_lanes[i].m_laneProps != null) if(asset.m_lanes[i].m_laneProps != null) { | |
if(asset.m_lanes[i].m_laneProps.m_props != null) if(asset.m_lanes[i].m_laneProps.m_props.Length != null) foreach (var LaneProp in asset.m_lanes[i].m_laneProps.m_props) { | |
if(LaneProp.m_prop != null) { | |
s = s + "LaneProp(elevated, "+i+", new NetLaneProps.Prop{\n"; | |
s = s + "m_flagsRequired = NetLane.Flags."+LaneProp.m_flagsRequired.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_flagsForbidden = NetLane.Flags."+LaneProp.m_flagsForbidden.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_startFlagsRequired = NetNode.Flags."+LaneProp.m_startFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+", \n"; | |
s = s + "m_startFlagsForbidden = NetNode.Flags."+LaneProp.m_startFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsRequired = NetNode.Flags."+LaneProp.m_endFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsForbidden = NetNode.Flags."+LaneProp.m_endFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_colorMode = NetLaneProps.ColorMode."+LaneProp.m_colorMode+",\n"; | |
s = s + "m_position = new Vector3("+LaneProp.m_position.x+"f, "+LaneProp.m_position.y+"f, "+LaneProp.m_position.z+"f), m_angle = "+LaneProp.m_angle+"f,\n"; | |
s = s + "m_segmentOffset = "+LaneProp.m_segmentOffset+"f, m_repeatDistance = "+LaneProp.m_repeatDistance+"f, m_minLength = "+LaneProp.m_minLength+"f, m_cornerAngle = "+LaneProp.m_cornerAngle+"f, m_probability = "+LaneProp.m_probability+",\n"; | |
if(LaneProp.m_prop) s = s + "m_prop = PrefabCollection<PropInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n"; else s = s + "m_prop = null,\n"; | |
if(LaneProp.m_tree) s = s + "m_tree = PrefabCollection<TreeInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n";else s = s + "m_tree = null\n"; | |
s = s + "});\n\n"; | |
} | |
} | |
} | |
} | |
} | |
if(ai.m_bridgeInfo != null) { asset = ai.m_bridgeInfo; | |
if(asset.m_lanes != null) if(asset.m_lanes.Length != null) for(int i = 0; i < asset.m_lanes.Length; i++) { | |
if(asset.m_lanes[i].m_laneProps != null) if(asset.m_lanes[i].m_laneProps != null) { | |
if(asset.m_lanes[i].m_laneProps.m_props != null) if(asset.m_lanes[i].m_laneProps.m_props.Length != null) foreach (var LaneProp in asset.m_lanes[i].m_laneProps.m_props) { | |
if(LaneProp.m_prop != null) { | |
s = s + "LaneProp(bridge, "+i+", new NetLaneProps.Prop{\n"; | |
s = s + "m_flagsRequired = NetLane.Flags."+LaneProp.m_flagsRequired.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_flagsForbidden = NetLane.Flags."+LaneProp.m_flagsForbidden.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_startFlagsRequired = NetNode.Flags."+LaneProp.m_startFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+", \n"; | |
s = s + "m_startFlagsForbidden = NetNode.Flags."+LaneProp.m_startFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsRequired = NetNode.Flags."+LaneProp.m_endFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsForbidden = NetNode.Flags."+LaneProp.m_endFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_colorMode = NetLaneProps.ColorMode."+LaneProp.m_colorMode+",\n"; | |
s = s + "m_position = new Vector3("+LaneProp.m_position.x+"f, "+LaneProp.m_position.y+"f, "+LaneProp.m_position.z+"f), m_angle = "+LaneProp.m_angle+"f,\n"; | |
s = s + "m_segmentOffset = "+LaneProp.m_segmentOffset+"f, m_repeatDistance = "+LaneProp.m_repeatDistance+"f, m_minLength = "+LaneProp.m_minLength+"f, m_cornerAngle = "+LaneProp.m_cornerAngle+"f, m_probability = "+LaneProp.m_probability+",\n"; | |
if(LaneProp.m_prop) s = s + "m_prop = PrefabCollection<PropInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n"; else s = s + "m_prop = null,\n"; | |
if(LaneProp.m_tree) s = s + "m_tree = PrefabCollection<TreeInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n";else s = s + "m_tree = null\n"; | |
s = s + "});\n\n"; | |
} | |
} | |
} | |
} | |
} | |
if(ai.m_slopeInfo != null) { asset = ai.m_slopeInfo; | |
if(asset.m_lanes != null) if(asset.m_lanes.Length != null) for(int i = 0; i < asset.m_lanes.Length; i++) { | |
if(asset.m_lanes[i].m_laneProps != null) if(asset.m_lanes[i].m_laneProps != null) { | |
if(asset.m_lanes[i].m_laneProps.m_props != null) if(asset.m_lanes[i].m_laneProps.m_props.Length != null) foreach (var LaneProp in asset.m_lanes[i].m_laneProps.m_props) { | |
if(LaneProp.m_prop != null) { | |
s = s + "LaneProp(slope, "+i+", new NetLaneProps.Prop{\n"; | |
s = s + "m_flagsRequired = NetLane.Flags."+LaneProp.m_flagsRequired.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_flagsForbidden = NetLane.Flags."+LaneProp.m_flagsForbidden.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_startFlagsRequired = NetNode.Flags."+LaneProp.m_startFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+", \n"; | |
s = s + "m_startFlagsForbidden = NetNode.Flags."+LaneProp.m_startFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsRequired = NetNode.Flags."+LaneProp.m_endFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsForbidden = NetNode.Flags."+LaneProp.m_endFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_colorMode = NetLaneProps.ColorMode."+LaneProp.m_colorMode+",\n"; | |
s = s + "m_position = new Vector3("+LaneProp.m_position.x+"f, "+LaneProp.m_position.y+"f, "+LaneProp.m_position.z+"f), m_angle = "+LaneProp.m_angle+"f,\n"; | |
s = s + "m_segmentOffset = "+LaneProp.m_segmentOffset+"f, m_repeatDistance = "+LaneProp.m_repeatDistance+"f, m_minLength = "+LaneProp.m_minLength+"f, m_cornerAngle = "+LaneProp.m_cornerAngle+"f, m_probability = "+LaneProp.m_probability+",\n"; | |
if(LaneProp.m_prop) s = s + "m_prop = PrefabCollection<PropInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n"; else s = s + "m_prop = null,\n"; | |
if(LaneProp.m_tree) s = s + "m_tree = PrefabCollection<TreeInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n";else s = s + "m_tree = null\n"; | |
s = s + "});\n\n"; | |
} | |
} | |
} | |
} | |
} | |
if(ai.m_tunnelInfo != null) { asset = ai.m_tunnelInfo; | |
if(asset.m_lanes != null) if(asset.m_lanes.Length != null) for(int i = 0; i < asset.m_lanes.Length; i++) { | |
if(asset.m_lanes[i].m_laneProps != null) if(asset.m_lanes[i].m_laneProps != null) { | |
if(asset.m_lanes[i].m_laneProps.m_props != null) if(asset.m_lanes[i].m_laneProps.m_props.Length != null) foreach (var LaneProp in asset.m_lanes[i].m_laneProps.m_props) { | |
if(LaneProp.m_prop != null) { | |
s = s + "LaneProp(tunnel, "+i+", new NetLaneProps.Prop{\n"; | |
s = s + "m_flagsRequired = NetLane.Flags."+LaneProp.m_flagsRequired.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_flagsForbidden = NetLane.Flags."+LaneProp.m_flagsForbidden.ToString().Replace(", ", " | NetLane.Flags.")+",\n"; | |
s = s + "m_startFlagsRequired = NetNode.Flags."+LaneProp.m_startFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+", \n"; | |
s = s + "m_startFlagsForbidden = NetNode.Flags."+LaneProp.m_startFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsRequired = NetNode.Flags."+LaneProp.m_endFlagsRequired.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_endFlagsForbidden = NetNode.Flags."+LaneProp.m_endFlagsForbidden.ToString().Replace(", ", " | NetNode.Flags.")+",\n"; | |
s = s + "m_colorMode = NetLaneProps.ColorMode."+LaneProp.m_colorMode+",\n"; | |
s = s + "m_position = new Vector3("+LaneProp.m_position.x+"f, "+LaneProp.m_position.y+"f, "+LaneProp.m_position.z+"f), m_angle = "+LaneProp.m_angle+"f,\n"; | |
s = s + "m_segmentOffset = "+LaneProp.m_segmentOffset+"f, m_repeatDistance = "+LaneProp.m_repeatDistance+"f, m_minLength = "+LaneProp.m_minLength+"f, m_cornerAngle = "+LaneProp.m_cornerAngle+"f, m_probability = "+LaneProp.m_probability+",\n"; | |
if(LaneProp.m_prop) s = s + "m_prop = PrefabCollection<PropInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n"; else s = s + "m_prop = null,\n"; | |
if(LaneProp.m_tree) s = s + "m_tree = PrefabCollection<TreeInfo>.FindLoaded(\""+LaneProp.m_prop.name+"\"),\n";else s = s + "m_tree = null\n"; | |
s = s + "});\n\n"; | |
} | |
} | |
} | |
} | |
} | |
s = s + "for(int i = 0; i < asset.m_lanes.Length; i++) asset.m_lanes[i].m_laneProps.m_props = basic[i].ToArray();\n"; | |
s = s + "if(elevatedLanes != 0) for(int i = 0; i < ai.m_elevatedInfo.m_lanes.Length; i++) ai.m_elevatedInfo.m_lanes[i].m_laneProps.m_props = elevated[i].ToArray();\n"; | |
s = s + "if(bridgeLanes != 0) for(int i = 0; i < ai.m_bridgeInfo.m_lanes.Length; i++) ai.m_bridgeInfo.m_lanes[i].m_laneProps.m_props = bridge[i].ToArray();\n"; | |
s = s + "if(slopeLanes != 0) for(int i = 0; i < ai.m_slopeInfo.m_lanes.Length; i++) ai.m_slopeInfo.m_lanes[i].m_laneProps.m_props = slope[i].ToArray();\n"; | |
s = s + "if(tunnelLanes != 0) for(int i = 0; i < ai.m_tunnelInfo.m_lanes.Length; i++) ai.m_tunnelInfo.m_lanes[i].m_laneProps.m_props = tunnel[i].ToArray();"; | |
var path = Path.Combine(ColossalFramework.IO.DataLocation.addonsPath, "LaneProps.cs"); File.WriteAllText(path, s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment