public void LateBuildUp(NetInfo info, NetInfoVersion version) { var plPropInfo = PrefabCollection <PropInfo> .FindLoaded("RailwayPowerline Singular"); var oldPlPropInfo = Prefabs.Find <PropInfo>("RailwayPowerline"); NetInfoExtensions.ReplaceProps(info, plPropInfo, oldPlPropInfo); for (int i = 0; i < info.m_lanes.Count(); i++) { var powerLineProp = info.m_lanes[i].m_laneProps.m_props.Where(p => p.m_prop == plPropInfo).ToList(); for (int j = 0; j < powerLineProp.Count(); j++) { powerLineProp[j].m_position = new Vector3(2.4f, -0.15f, 0); powerLineProp[j].m_angle = 0; } } if (version == NetInfoVersion.Elevated) { var epPropInfo = PrefabCollection <BuildingInfo> .FindLoaded($"{Util.PackageName("Rail1LElevatedPillar")}.Rail1LElevatedPillar_Data"); if (epPropInfo == null) { throw new Exception($"{info.name}: Rail1LElevatedPillar prop not found!"); } if (epPropInfo != null) { var bridgeAI = info.GetComponent <TrainTrackBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_doubleLength = false; bridgeAI.m_bridgePillarInfo = epPropInfo; bridgeAI.m_bridgePillarOffset = 1; bridgeAI.m_middlePillarInfo = null; } } } else if (version == NetInfoVersion.Bridge) { var bpPropInfo = PrefabCollection <BuildingInfo> .FindLoaded($"{Util.PackageName("Rail1LBridgePillar")}.Rail1LBridgePillar_Data"); if (bpPropInfo == null) { throw new Exception($"{info.name}: Rail1LBridgePillar prop not found!"); } if (bpPropInfo != null) { var bridgeAI = info.GetComponent <TrainTrackBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_bridgePillarInfo = bpPropInfo; } } } }
public virtual void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var railVersionName = SharedHelpers.NameBuilder(SharedHelpers.TRAIN_TRACK, version); var railInfo = Prefabs.Find <NetInfo>(railVersionName); info.m_class = railInfo.m_class.Clone("APT" + railVersionName); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; //info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); if (version == NetInfoVersion.Slope || version == NetInfoVersion.Tunnel) { info.m_halfWidth = 4; info.m_pavementWidth = 2; } else { info.m_halfWidth = 3; } //if (version == NetInfoVersion.Tunnel) //{ // info.m_setVehicleFlags = Vehicle.Flags.Transition; // info.m_setCitizenFlags = CitizenInstance.Flags.Transition; //} info.SetRoadLanes(version, new LanesConfiguration() { IsTwoWay = false, LanesToAdd = -1, }); info.m_connectGroup = NetInfo.ConnectGroup.SingleTrain; info.m_nodeConnectGroups = NetInfo.ConnectGroup.SingleTrain | NetInfo.ConnectGroup.DoubleTrain | NetInfo.ConnectGroup.TrainStation; var owPlayerNetAI = railInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 1 / 2; playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 1 / 2; } var trainTrackAI = info.GetComponent <TrainTrackAI>(); if (trainTrackAI != null) { } }
public virtual void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var railInfo = Prefabs.Find <NetInfo>(Mod.TRAIN_STATION_TRACK); info.m_class = railInfo.m_class.Clone("NExtSingleStationTrack"); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup6m2WMesh(version); /////////////////////////// // Texturing // /////////////////////////// info.Setup6m2WTextures(version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; //info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); info.m_halfWidth = 1; info.m_availableIn = ItemClass.Availability.AssetEditor; info.m_placementStyle = ItemClass.Placement.Manual; info.SetRoadLanes(version, new LanesConfiguration() { IsTwoWay = false, LanesToAdd = -1, }); var railLane = info.m_lanes.FirstOrDefault(l => l.m_laneType == NetInfo.LaneType.Vehicle); railLane.m_direction = NetInfo.Direction.AvoidForward; info.m_connectGroup = NetInfo.ConnectGroup.SingleTrain; info.m_nodeConnectGroups = NetInfo.ConnectGroup.SingleTrain | NetInfo.ConnectGroup.DoubleTrain | NetInfo.ConnectGroup.TrainStation; var owPlayerNetAI = railInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3 / 2; playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 3 / 2; } var trainTrackAI = info.GetComponent <TrainTrackAI>(); if (trainTrackAI != null) { } }
public static void SetVersion(NetInfo versionedPrefab, NetInfo prefab, NetInfoVersion version) { var trainTrackAi = prefab?.GetComponent <TrainTrackAI>(); if (trainTrackAi == null) { return; } switch (version) { case NetInfoVersion.Tunnel: trainTrackAi.m_tunnelInfo = versionedPrefab; break; case NetInfoVersion.Slope: trainTrackAi.m_slopeInfo = versionedPrefab; break; case NetInfoVersion.Bridge: trainTrackAi.m_bridgeInfo = versionedPrefab; break; case NetInfoVersion.Elevated: trainTrackAi.m_elevatedInfo = versionedPrefab; break; } }
private static void SetupSunkenPrefab(NetInfo sunkenPrefab) { var stationAI = sunkenPrefab.GetComponent <TrainTrackAI>(); stationAI.m_tunnelInfo = sunkenPrefab; sunkenPrefab.m_clipTerrain = false; sunkenPrefab.m_createGravel = false; sunkenPrefab.m_createPavement = false; sunkenPrefab.m_createRuining = false; sunkenPrefab.m_flattenTerrain = false; sunkenPrefab.m_followTerrain = false; sunkenPrefab.m_intersectClass = null; sunkenPrefab.m_maxHeight = -1; sunkenPrefab.m_minHeight = -3; sunkenPrefab.m_requireSurfaceMaps = false; sunkenPrefab.m_snapBuildingNodes = false; sunkenPrefab.m_placementStyle = ItemClass.Placement.Procedural; sunkenPrefab.m_useFixedHeight = true; sunkenPrefab.m_lowerTerrain = false; sunkenPrefab.m_availableIn = ItemClass.Availability.GameAndAsset; }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = false; info.m_createPavement = true; info.m_setVehicleFlags = 0; /////////////////////////// // AI // /////////////////////////// var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = playerNetAI.m_constructionCost * 3 / 2; playerNetAI.m_maintenanceCost = playerNetAI.m_maintenanceCost * 3 / 2; } }
public void LateBuildUp(NetInfo info, NetInfoVersion version) { if (version == NetInfoVersion.Bridge) { foreach (var building in BuildingCollection.FindObjectsOfType <BuildingInfo>()) { if (building.name.ToLower().Contains("pillar")) { Debug.Log($"PILLARNAME = {building.name}"); } } var bridgePillar = PrefabCollection <BuildingInfo> .FindLoaded($"{Tools.PackageName("BridgePillar")}.CableStay32m_Data"); if (bridgePillar == null) { Debug.Log($"{info.name}: CableStay32m Pillar not found!"); } else { var bridgeAI = info.GetComponent <RoadBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_doubleLength = true; bridgeAI.m_bridgePillarInfo = null; bridgeAI.m_middlePillarInfo = bridgePillar; bridgeAI.m_middlePillarOffset = 58; } } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = false; info.m_createPavement = true; info.m_setVehicleFlags = 0; /////////////////////////// // AI // /////////////////////////// var playerNetAI = info.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = playerNetAI.m_constructionCost * 3 / 2; playerNetAI.m_maintenanceCost = playerNetAI.m_maintenanceCost * 3 / 2; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { info.Setup8mNoSWMesh(version); } else { info.Setup8mNoSwWoodMesh(version); } /////////////////////////// // Texturing // /////////////////////////// if (version == NetInfoVersion.Ground) { info.SetupGroundNakedTextures(version); } else { info.SetupBoardWalkTextures(version); } /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = true; info.m_createPavement = false; info.SetupTinyPed(version); if (version == NetInfoVersion.Ground) { info.m_setVehicleFlags = Vehicle.Flags.OnGravel; } /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find <NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost; } } break; } }
public static void SetupSunken(NetInfo prefab) { if (prefab == null) { return; } prefab.m_flattenTerrain = false; prefab.GetComponent <RoadAI>().m_tunnelInfo = prefab; }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8mNoSwWoodMesh(version); /////////////////////////// // Texturing // /////////////////////////// info.SetupBoardWalkTextures(version); /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = version == NetInfoVersion.Ground; info.m_createPavement = false; info.m_connectGroup = NetInfo.ConnectGroup.CenterTram; info.m_nodeConnectGroups = NetInfo.ConnectGroup.CenterTram; info.m_surfaceLevel = 0.6f; info.m_pavementWidth = 1; info.m_clipTerrain = false; info.SetupTinyPed(version); var lanes = new List <NetInfo.Lane>(); lanes.AddRange(info.m_lanes); for (int i = 0; i < info.m_lanes.Length; i++) { lanes[i].m_verticalOffset = 0.6f; } info.m_lanes = lanes.ToArray(); /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find <NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost; } } break; } }
public static void BuildUp(NetInfo prefab, NetInfoVersion version) { var smallWord = prefab.name.ToLower().Contains("small") ? "Small" : ""; switch (version) { case NetInfoVersion.Elevated: { var epBuildingInfo = PrefabCollection <BuildingInfo> .FindLoaded($"{Util.PackageName($"MetroElevatedPillar{smallWord}")}.MetroElevatedPillar{smallWord}_Data"); if (epBuildingInfo == null) { throw new Exception($"{prefab.name}: MetroElevatedPillar not found!"); } var bridgeAI = prefab.GetComponent <TrainTrackBridgeAIMetro>(); if (bridgeAI != null) { bridgeAI.m_bridgePillarInfo = epBuildingInfo; bridgeAI.m_bridgePillarOffset = -0.75f; } break; } case NetInfoVersion.Bridge: { var bpPropInfo = PrefabCollection <BuildingInfo> .FindLoaded($"{Util.PackageName($"MetroBridgePillar{smallWord}")}.MetroBridgePillar{smallWord}_Data"); if (bpPropInfo == null) { throw new Exception($"{prefab.name}: MetroBridgePillar not found!"); } var bridgeAI = prefab.GetComponent <TrainTrackBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_bridgePillarInfo = bpPropInfo; } break; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8mNoSwWoodMesh(version); /////////////////////////// // Texturing // /////////////////////////// if (version == NetInfoVersion.Ground) { info.SetupGroundNakedTextures(version); } else { info.SetupElevatedBoardWalkTextures(version); } /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = true; info.m_createPavement = false; info.SetupTinyPed(version); if (version == NetInfoVersion.Ground) { info.m_setVehicleFlags = Vehicle.Flags.OnGravel; } /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find<NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost; } } break; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8mNoSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// if (version == NetInfoVersion.Ground) { info.SetupGroundNakedTextures(version); } else { info.SetupElevatedPavedTextures(version); } /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = false; info.m_createPavement = true; info.SetupTinyPed(version); info.m_availableIn = ItemClass.Availability.None; /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find <NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost * 3 / 2; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost * 3 / 2; } } break; } }
private static void RevertBuilding(ref BuildingInfo info) { if (m_CpmNetDict != null) { for (int j = 0; j < info.m_paths.Count(); j++) { NetInfo ninfo = info.m_paths[j].m_netInfo; if (m_CpmNetDict.ContainsKey(ninfo.name)) { if (ninfo.m_netAI != null) { PlayerNetAI pnai = ninfo.GetComponent <PlayerNetAI>(); if (pnai != null) { pnai.m_createPassMilestone = m_CpmNetDict[ninfo.name]; } } } } } if (m_CpmBuildingDict != null) { if (m_CpmBuildingDict.ContainsKey(info.name)) { PlayerBuildingAI pbai = info.GetComponent <PlayerBuildingAI>(); if (pbai != null) { pbai.m_createPassMilestone = m_CpmBuildingDict[info.name][0]; pbai.m_createPassMilestone2 = m_CpmBuildingDict[info.name][1]; pbai.m_createPassMilestone3 = m_CpmBuildingDict[info.name][2]; info.m_buildingAI = pbai; if (info.m_subBuildings != null && info.m_subBuildings.Count() > 0) { foreach (BuildingInfo.SubInfo subBuilding in info.m_subBuildings) { if (subBuilding.m_buildingInfo != null) { RevertBuilding(ref subBuilding.m_buildingInfo); } } } } } } }
private static void RemoveCreatePassMileStone(NetInfo info) { PlayerNetAI pnai = info.GetComponent <PlayerNetAI>(); if (pnai != null) { if (pnai.m_createPassMilestone != null) { if (m_CpmNetDict == null) { m_CpmNetDict = new Dictionary <string, ManualMilestone>(); } if (m_CpmNetDict.ContainsKey(info.name) == false) { m_CpmNetDict.Add(info.name, pnai.m_createPassMilestone); } pnai.m_createPassMilestone = null; } } }
private static void SetupElevatedPrefab(NetInfo elevatedPrefab, bool concrete) { var stationAI = elevatedPrefab.GetComponent <TrainTrackAI>(); stationAI.m_elevatedInfo = elevatedPrefab; elevatedPrefab.m_followTerrain = false; elevatedPrefab.m_flattenTerrain = false; elevatedPrefab.m_createGravel = false; elevatedPrefab.m_createPavement = false; elevatedPrefab.m_createRuining = false; elevatedPrefab.m_requireSurfaceMaps = false; elevatedPrefab.m_clipTerrain = false; elevatedPrefab.m_snapBuildingNodes = false; elevatedPrefab.m_placementStyle = ItemClass.Placement.Procedural; elevatedPrefab.m_useFixedHeight = true; elevatedPrefab.m_lowerTerrain = true; elevatedPrefab.m_availableIn = ItemClass.Availability.GameAndAsset; var elevatedTrack = FindOriginalPrefab("Train Track Elevated"); if (elevatedTrack == null) { return; } var etstMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR.obj"), "ETST "); var etstSegmentLodMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR_LOD.obj"), "ETST_SLOD"); var etstNodeLodMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR_Node_LOD.obj"), "ETST_NLOD"); elevatedPrefab.m_segments[0].m_segmentMaterial = ModifyRailMaterial(elevatedTrack.m_segments[0].m_segmentMaterial, concrete); elevatedPrefab.m_segments[0].m_material = ModifyRailMaterial(elevatedTrack.m_segments[0].m_material, concrete); elevatedPrefab.m_segments[0].m_mesh = etstMesh; elevatedPrefab.m_segments[0].m_segmentMesh = etstMesh; elevatedPrefab.m_segments[0].m_lodMaterial = ModifyRailMaterial(elevatedTrack.m_segments[0].m_lodMaterial, concrete); elevatedPrefab.m_segments[0].m_lodMesh = etstSegmentLodMesh; elevatedPrefab.m_nodes[0].m_material = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_material, concrete); elevatedPrefab.m_nodes[0].m_nodeMaterial = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_nodeMaterial, concrete); elevatedPrefab.m_nodes[0].m_lodMaterial = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_lodMaterial, concrete); elevatedPrefab.m_nodes[0].m_lodMesh = etstNodeLodMesh; elevatedPrefab.m_nodes[0].m_nodeMesh = etstMesh; elevatedPrefab.m_nodes[0].m_mesh = etstMesh; }
private static void SetupTunnelPrefab(NetInfo prefab) { var trainStationTrack = FindOriginalPrefab("Train Station Track"); prefab.m_class = ScriptableObject.CreateInstance <ItemClass>(); prefab.m_class.m_subService = ItemClass.SubService.PublicTransportTrain; prefab.m_class.m_service = ItemClass.Service.PublicTransport; prefab.m_class.m_layer = ItemClass.Layer.MetroTunnels | ItemClass.Layer.Default; prefab.m_canCollide = false; var metroAI = prefab.GetComponent <MetroTrackAI>(); GameObject.DestroyImmediate(metroAI); var trackAI = prefab.gameObject.AddComponent <UndergroundTrainStationTrackAI>(); trackAI.m_transportInfo = PrefabCollection <TransportInfo> .FindLoaded("Train"); prefab.m_netAI = trackAI; trackAI.m_createPassMilestone = trainStationTrack.GetComponent <TrainTrackAI>().m_createPassMilestone; trackAI.m_info = prefab; var field = typeof(PrefabInfo).GetField("m_UICategory", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(prefab, field.GetValue(trainStationTrack)); prefab.m_averageVehicleLaneSpeed = trainStationTrack.m_averageVehicleLaneSpeed; prefab.m_vehicleTypes = VehicleInfo.VehicleType.Train; prefab.m_buildHeight = 0; foreach (var lane in prefab.m_lanes) { if (lane.m_vehicleType == VehicleInfo.VehicleType.None) { lane.m_stopType = VehicleInfo.VehicleType.Train; } else { lane.m_vehicleType = VehicleInfo.VehicleType.Train; } } }
public override void InitializePrefab() { base.InitializePrefab(); this.m_constructionCost = 2000; this.m_maintenanceCost = 250; try { NetInfo zonablePath = PrefabCollection <NetInfo> .FindLoaded("Zonable Pedestrian Pavement"); if (zonablePath == null) { throw new KeyNotFoundException("Can't find Zonable Pedestrian Pavement in PrefabCollection."); } ZonablePedestrianPathAI zonablePathAI = zonablePath.GetComponent <ZonablePedestrianPathAI>(); if (zonablePathAI == null) { throw new KeyNotFoundException("Zonable Pedestrian Pavement prefab does not have a ZonablePedestrianPathAI."); } zonablePathAI.m_elevatedInfo = this.m_info; zonablePathAI.m_bridgeInfo = this.m_info; GameObject pillarPrefab = Resources.FindObjectsOfTypeAll <GameObject>().Where(g => g.name == "Pedestrian Elevated Pillar").FirstOrDefault(); if (pillarPrefab == null) { throw new KeyNotFoundException("Can't find Pedestrian Elevated Pillar."); } this.m_bridgePillarInfo = pillarPrefab.GetComponent <BuildingInfo>(); Debug.Log("Traffic++: " + name + " initialized."); } catch (KeyNotFoundException knf) { Debug.Log("Traffic++: Error initializing Zonable Pedestrian Bridge AI: " + knf.Message + "\n"); } catch (Exception e) { Debug.Log("Traffic++: Unexpected " + e.GetType().Name + " initializing Zonable Pedestrian Bridge AI: " + e.Message + "\n" + e.StackTrace + "\n"); } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8mNoSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = false; info.m_createPavement = true; info.SetupTinyPed(version); /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find <NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost * 7 / 4; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost * 7 / 4; } } break; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8mNoSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_createGravel = false; info.m_createPavement = true; info.SetupTinyPed(version); /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find<NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost * 7 / 4; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost * 7 / 4; } } break; } }
private static void SetupElevatedPrefab(NetInfo elevatedPrefab, bool concrete) { var stationAI = elevatedPrefab.GetComponent<TrainTrackAI>(); stationAI.m_elevatedInfo = elevatedPrefab; elevatedPrefab.m_followTerrain = false; elevatedPrefab.m_flattenTerrain = false; elevatedPrefab.m_createGravel = false; elevatedPrefab.m_createPavement = false; elevatedPrefab.m_createRuining = false; elevatedPrefab.m_requireSurfaceMaps = false; elevatedPrefab.m_clipTerrain = false; elevatedPrefab.m_snapBuildingNodes = false; elevatedPrefab.m_placementStyle = ItemClass.Placement.Procedural; elevatedPrefab.m_useFixedHeight = true; elevatedPrefab.m_lowerTerrain = true; elevatedPrefab.m_availableIn = ItemClass.Availability.GameAndAsset; var elevatedTrack = FindOriginalPrefab("Train Track Elevated"); if (elevatedTrack == null) { return; } var etstMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR.obj"), "ETST "); var etstSegmentLodMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR_LOD.obj"), "ETST_SLOD"); var etstNodeLodMesh = Util.LoadMesh(string.Concat(Util.AssemblyDirectory, "/TTNR_Node_LOD.obj"), "ETST_NLOD"); elevatedPrefab.m_segments[0].m_segmentMaterial = ModifyRailMaterial(elevatedTrack.m_segments[0].m_segmentMaterial, concrete); elevatedPrefab.m_segments[0].m_material = ModifyRailMaterial(elevatedTrack.m_segments[0].m_material, concrete); elevatedPrefab.m_segments[0].m_mesh = etstMesh; elevatedPrefab.m_segments[0].m_segmentMesh = etstMesh; elevatedPrefab.m_segments[0].m_lodMaterial = ModifyRailMaterial(elevatedTrack.m_segments[0].m_lodMaterial, concrete); elevatedPrefab.m_segments[0].m_lodMesh = etstSegmentLodMesh; elevatedPrefab.m_nodes[0].m_material = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_material, concrete); elevatedPrefab.m_nodes[0].m_nodeMaterial = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_nodeMaterial, concrete); elevatedPrefab.m_nodes[0].m_lodMaterial = ModifyRailMaterial(elevatedTrack.m_nodes[0].m_lodMaterial, concrete); elevatedPrefab.m_nodes[0].m_lodMesh = etstNodeLodMesh; elevatedPrefab.m_nodes[0].m_nodeMesh = etstMesh; elevatedPrefab.m_nodes[0].m_mesh = etstMesh; }
public void LateBuildUp(NetInfo info, NetInfoVersion version) { if (version == NetInfoVersion.Bridge) { var bridgePillar = PrefabCollection <BuildingInfo> .FindLoaded($"{Tools.PackageName("BridgePillar")}.CableStay32m_Data"); if (bridgePillar == null) { Debug.Log($"{info.name}: CableStay32m Pillar not found!"); } else { var bridgeAI = info.GetComponent <RoadBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_doubleLength = true; bridgeAI.m_bridgePillarInfo = null; bridgeAI.m_middlePillarInfo = bridgePillar; bridgeAI.m_middlePillarOffset = 58; } } } }
public override void InitializePrefab() { base.InitializePrefab(); this.m_constructionCost = 2000; this.m_maintenanceCost = 250; try { NetInfo zonablePath = PrefabCollection <NetInfo> .FindLoaded("Zonable Pedestrian Pavement"); if (zonablePath == null) { throw new KeyNotFoundException("Can't find Zonable Pedestrian Pavement in PrefabCollection."); } PedestrianZoningPathAI zonablePathAI = zonablePath.GetComponent <PedestrianZoningPathAI>(); if (zonablePathAI == null) { throw new KeyNotFoundException("Zonable Pedestrian Pavement prefab does not have a ZonablePedestrianPathAI."); } zonablePathAI.m_elevatedInfo = this.m_info; zonablePathAI.m_bridgeInfo = this.m_info; GameObject pillarPrefab = Resources.FindObjectsOfTypeAll <GameObject>().Where(g => g.name == "Pedestrian Elevated Pillar").FirstOrDefault(); if (pillarPrefab == null) { throw new KeyNotFoundException("Can't find Pedestrian Elevated Pillar."); } this.m_bridgePillarInfo = pillarPrefab.GetComponent <BuildingInfo>(); } catch (KeyNotFoundException knf) { #if DEBUG System.IO.File.AppendAllText("Debug.txt", "Error initializing Zonable Pedestrian Bridge AI: " + knf.Message + "\n"); #endif } }
public void LateBuildUp(NetInfo info, NetInfoVersion version) { if (version == NetInfoVersion.Bridge) { var bridgePillar = PrefabCollection <BuildingInfo> .FindLoaded("478820060.CableStay32m_Data"); if (bridgePillar == null) { bridgePillar = PrefabCollection <BuildingInfo> .FindLoaded("BridgePillar.CableStay32m_Data"); } if (bridgePillar != null) { var bridgeAI = info.GetComponent <RoadBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_doubleLength = true; bridgeAI.m_bridgePillarInfo = null; bridgeAI.m_middlePillarInfo = bridgePillar; bridgeAI.m_middlePillarOffset = 58; } } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L); var roadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L_TUNNEL); var bridgeInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_4L_BRIDGE).Clone("temp"); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup32m5mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = true; info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 5 : 7); info.m_halfWidth = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated ? 14 : 16); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD_TUNNEL); } else if (version == NetInfoVersion.Bridge) { info.m_class = bridgeInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD); } else { info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LanesToAdd = -2, LaneWidth = 3.8f, BusStopOffset = 2.9f, CenterLane = CenterLaneType.Median, CenterLaneWidth = 3.8f }); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); // Fix for T++ legacy support if (version == NetInfoVersion.Ground) { var lanes = info.m_lanes.OrderBy(l => l.m_position).ToArray(); var lanesLegacyOrder = new[] { lanes[2], lanes[3], lanes[4], lanes[5], lanes[0], lanes[7], lanes[1], lanes[6] }; info.m_lanes = lanesLegacyOrder; } //Setting Up Props var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList(); var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList(); if (version != NetInfoVersion.Tunnel) { var leftStreetLight = leftRoadProps.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("new street light")); if (leftStreetLight != null) { leftStreetLight.m_finalProp = leftStreetLight.m_prop = Prefabs.Find<PropInfo>(MediumAvenueSideLightBuilder.NAME); } var rightStreetLight = rightRoadProps.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("new street light")); if (rightStreetLight != null) { rightStreetLight.m_finalProp = rightStreetLight.m_prop = Prefabs.Find<PropInfo>(MediumAvenueSideLightBuilder.NAME); } } if (version == NetInfoVersion.Slope) { leftRoadProps.AddLeftWallLights(info.m_pavementWidth); rightRoadProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray(); rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray(); info.TrimAboveGroundProps(version); info.SetupNewSpeedLimitProps(50, 60); // AI var owPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 2 / 3; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 2 / 3; // Charge by the lane? } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet( @"NewNetwork\Highway6L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_Segment__APRMap.png")); info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Ground_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_Node__APRMap.png"), new TexturesSet (@"NewNetwork\Highway6L\Textures\Ground_NodeLOD__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_NodeLOD__APRMap.png", @"NewNetwork\Highway6L\Textures\Ground_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Elevated_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Elevated_Node__APRMap.png"), new TexturesSet (@"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__MainTex.png", @"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__APRMap.png", @"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Slope: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Slope_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Slope_Node__APRMap.png"), new TexturesSet (@"NewNetwork\Highway6L\Textures\Slope_NodeLOD__MainTex.png", @"NewNetwork\Highway6L\Textures\Slope_NodeLOD__APRMap.png", @"NewNetwork\Highway6L\Textures\Slope_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Tunnel: break; } /////////////////////////// // Set up // /////////////////////////// var highwayInfo = ToolsCSL.FindPrefab<NetInfo>("Highway"); info.m_createPavement = (version != NetInfoVersion.Ground); info.m_createGravel = (version == NetInfoVersion.Ground); info.m_averageVehicleLaneSpeed = 2f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = false; info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; // Activate with a new mesh //info.m_class = highwayInfo.m_class; // Test //info.m_surfaceLevel = 0; // Disabling Parkings and Peds foreach (var l in info.m_lanes) { switch (l.m_laneType) { case NetInfo.LaneType.Parking: l.m_laneType = NetInfo.LaneType.None; break; case NetInfo.LaneType.Pedestrian: l.m_laneType = NetInfo.LaneType.None; break; } } // Setting up lanes var vehiculeLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .OrderBy(l => l.m_similarLaneIndex) .ToArray(); var nbLanes = vehiculeLanes.Count(); // Supposed to be 6 const float laneWidth = 2f; // TODO: Make it 2.5 with new texture const float laneWidthPad = 1f; const float laneWidthTotal = laneWidth + laneWidthPad; var positionStart = (laneWidthTotal * ((1f - nbLanes) / 2f)); for (int i = 0; i < vehiculeLanes.Length; i++) { var l = vehiculeLanes[i]; l.m_allowStop = false; l.m_speedLimit = 2f; //l.m_verticalOffset = 0f; l.m_width = laneWidthTotal; l.m_position = positionStart + i * laneWidthTotal; } if (version == NetInfoVersion.Ground) { var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (hwPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2; playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2; } } else // Same as the original oneway { } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_highwayRules = true; roadBaseAI.m_trafficLights = false; } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; roadAI.m_trafficLights = false; } info.SetHighwayProps(highwayInfo); info.TrimHighwayProps(); }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { info.m_surfaceLevel = 0; var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.SetMeshes (@"NewNetwork\Alley2L\Meshes\Ground.obj", @"NewNetwork\Alley2L\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\Alley2L\Meshes\Ground.obj", @"NewNetwork\Alley2L\Meshes\Ground_Node_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\Alley2L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\Alley2L\Textures\Ground_Segment__AlphaMap.png")); //info.SetNodesTexture( // new TexturesSet // (@"NewNetwork\Alley2L\Textures\Ground_Node__MainTex.png", // @"NewNetwork\Alley2L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_halfWidth = 4f; info.m_pavementWidth = 2f; var vehicleLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian) .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToList(); var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_similarLaneIndex) .ToList(); var parkingLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Parking) .ToList(); foreach (var parkingLane in parkingLanes) { parkingLane.m_laneType = NetInfo.LaneType.None; } var roadHalfWidth = 2f; var pedWidth = 2f; for (var i = 0; i < vehicleLanes.Count; i++) { var multiplier = vehicleLanes[i].m_position / Math.Abs(vehicleLanes[i].m_position); vehicleLanes[i].m_width = roadHalfWidth; vehicleLanes[i].m_position = multiplier * 0.5f * roadHalfWidth; vehicleLanes[i].m_speedLimit = 0.5f; foreach (var prop in vehicleLanes[i].m_laneProps.m_props) { prop.m_position.x = multiplier * 0.4f; } } for (var i = 0; i < pedestrianLanes.Count; i++) { var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position); pedestrianLanes[i].m_width = pedWidth; pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth)); foreach (var prop in pedestrianLanes[i].m_laneProps.m_props) { prop.m_position.x += multiplier * roadHalfWidth; } } var onewayRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); if (version == NetInfoVersion.Ground) { var playerNetAI = info.GetComponent<PlayerNetAI>(); var orPlayerNetAI = onewayRoadInfo.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = orPlayerNetAI.m_constructionCost * 1 / 2; playerNetAI.m_maintenanceCost = orPlayerNetAI.m_maintenanceCost * 1 / 2; } } else // Same as the original oneway { } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = ToolsCSL.FindPrefab<NetInfo>("Highway"); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { info.m_surfaceLevel = 0; info.m_class = highwayInfo.m_class.Clone("LargeHighway"); var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_forwardRequired = NetSegment.Flags.None; var nodes1 = nodes0.ShallowClone(); nodes0.m_flagsForbidden = NetNode.Flags.Transition; nodes0.m_flagsRequired = NetNode.Flags.None; nodes1.m_flagsForbidden = NetNode.Flags.None; nodes1.m_flagsRequired = NetNode.Flags.Transition; var grndMesh = Highway6LMeshes.GetGroundData().CreateMesh("HIGHWAY_6L_GROUND"); var grndTransMesh = Highway6LMeshes.GetGroundTransitionData().CreateMesh("HIGHWAY_6L_GROUND_TRS"); segments0.m_mesh = grndMesh; nodes0.m_mesh = grndMesh; nodes1.m_mesh = grndTransMesh; info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0, nodes1 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet( @"NewNetwork\Highway6L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_Segment__APRMap.png")); info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Ground_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_Node__APRMap.png"), new TexturesSet (@"NewNetwork\Highway6L\Textures\Ground_NodeLOD__MainTex.png", @"NewNetwork\Highway6L\Textures\Ground_NodeLOD__APRMap.png", @"NewNetwork\Highway6L\Textures\Ground_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Elevated_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Elevated_Node__APRMap.png")); // Lets leave the crossings there until we have a fix //new TexturesSet // (@"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__MainTex.png", // @"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__APRMap.png", // @"NewNetwork\Highway6L\Textures\Elevated_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Slope: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway6L\Textures\Slope_Node__MainTex.png", @"NewNetwork\Highway6L\Textures\Slope_Node__APRMap.png"), new TexturesSet (@"NewNetwork\Highway6L\Textures\Slope_NodeLOD__MainTex.png", @"NewNetwork\Highway6L\Textures\Slope_NodeLOD__APRMap.png", @"NewNetwork\Highway6L\Textures\Slope_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Tunnel: break; } /////////////////////////// // Set up // /////////////////////////// info.m_availableIn = ItemClass.Availability.All; info.m_createPavement = (version == NetInfoVersion.Slope); info.m_createGravel = (version == NetInfoVersion.Ground); info.m_averageVehicleLaneSpeed = 2f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = false; info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; // Disabling Parkings and Peds foreach (var l in info.m_lanes) { switch (l.m_laneType) { case NetInfo.LaneType.Parking: l.m_laneType = NetInfo.LaneType.None; break; case NetInfo.LaneType.Pedestrian: l.m_laneType = NetInfo.LaneType.None; break; } } // Setting up lanes var vehiculeLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .OrderBy(l => l.m_similarLaneIndex) .ToArray(); var nbLanes = vehiculeLanes.Count(); // Supposed to be 6 const float laneWidth = 2f; // TODO: Make it 2.5 with new texture const float laneWidthPad = 1f; const float laneWidthTotal = laneWidth + laneWidthPad; var positionStart = (laneWidthTotal * ((1f - nbLanes) / 2f)); for (int i = 0; i < vehiculeLanes.Length; i++) { var l = vehiculeLanes[i]; l.m_allowStop = false; l.m_speedLimit = 2f; if (version == NetInfoVersion.Ground) { l.m_verticalOffset = 0f; } l.m_width = laneWidthTotal; l.m_position = positionStart + i * laneWidthTotal; } if (version == NetInfoVersion.Ground) { var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (hwPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2; playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2; } } else // Same as the original oneway { } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_highwayRules = true; roadBaseAI.m_trafficLights = false; } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } info.SetHighwayProps(highwayInfo); info.TrimHighwayProps(); }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = ToolsCSL.FindPrefab<NetInfo>("Highway"); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { info.m_surfaceLevel = 0; info.m_class = highwayInfo.m_class.Clone("NExtHighway"); var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_forwardRequired = NetSegment.Flags.None; var nodes1 = nodes0.ShallowClone(); nodes0.m_flagsForbidden = NetNode.Flags.Transition; nodes0.m_flagsRequired = NetNode.Flags.None; nodes1.m_flagsForbidden = NetNode.Flags.None; nodes1.m_flagsRequired = NetNode.Flags.Transition; segments0.SetMeshes (@"NewNetwork\Highway2L\Meshes\Ground.obj", @"NewNetwork\Highway2L\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\Highway2L\Meshes\Ground.obj", @"NewNetwork\Highway2L\Meshes\Ground_Node_LOD.obj"); nodes1.SetMeshes (@"NewNetwork\Highway2L\Meshes\Ground_Trans.obj", @"NewNetwork\Highway2L\Meshes\Ground_Trans_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0, nodes1 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\Highway2L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\Highway2L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\Highway2L\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\Highway2L\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\Highway2L\Textures\Ground_SegmentLOD__XYSMap.png")); info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway2L\Textures\Ground_Node__MainTex.png", @"NewNetwork\Highway2L\Textures\Ground_Node__AlphaMap.png"), new TexturesSet (@"NewNetwork\Highway2L\Textures\Ground_NodeLOD__MainTex.png", @"NewNetwork\Highway2L\Textures\Ground_NodeLOD__AlphaMap.png", @"NewNetwork\Highway2L\Textures\Ground_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway2L\Textures\Elevated_Node__MainTex.png", @"NewNetwork\Highway2L\Textures\Elevated_Node__AlphaMap.png")); // Lets leave the crossings there until we have a fix //new TexturesSet // (@"NewNetwork\Highway2L\Textures\Elevated_NodeLOD__MainTex.png", // @"NewNetwork\Highway2L\Textures\Elevated_NodeLOD__AlphaMap.png", // @"NewNetwork\Highway2L\Textures\Elevated_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Slope: info.SetNodesTexture( new TexturesSet (@"NewNetwork\Highway2L\Textures\Slope_Node__MainTex.png", @"NewNetwork\Highway2L\Textures\Slope_Node__AlphaMap.png"), new TexturesSet (@"NewNetwork\Highway2L\Textures\Slope_NodeLOD__MainTex.png", @"NewNetwork\Highway2L\Textures\Slope_NodeLOD__AlphaMap.png", @"NewNetwork\Highway2L\Textures\Slope_NodeLOD__XYSMap.png")); break; case NetInfoVersion.Tunnel: break; } /////////////////////////// // Set up // /////////////////////////// info.m_availableIn = ItemClass.Availability.All; info.m_createPavement = (version == NetInfoVersion.Slope); info.m_createGravel = (version == NetInfoVersion.Ground); info.m_averageVehicleLaneSpeed = 2f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = false; info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; // Disabling Parkings and Peds foreach (var l in info.m_lanes) { switch (l.m_laneType) { case NetInfo.LaneType.Parking: l.m_laneType = NetInfo.LaneType.None; break; case NetInfo.LaneType.Pedestrian: l.m_laneType = NetInfo.LaneType.None; break; } } // Setting up lanes var vehiculeLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .OrderBy(l => l.m_similarLaneIndex) .ToArray(); for (int i = 0; i < vehiculeLanes.Length; i++) { var l = vehiculeLanes[i]; l.m_allowStop = false; l.m_speedLimit = 2f; if (version == NetInfoVersion.Ground) { l.m_verticalOffset = 0f; } } if (version == NetInfoVersion.Ground) { var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (hwPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2 / 3; playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2 / 3; } } else // Same as the original oneway { } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_highwayRules = true; roadBaseAI.m_trafficLights = false; } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } info.SetHighwayProps(highwayInfo); info.TrimHighwayProps(); }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var onewayRoadInfo = ToolsCSL.FindPrefab <NetInfo>("Oneway Road"); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; var grndMesh = OneWay1LSegmentModel.BuildMesh().CreateMesh("OW_1L_GROUND"); segments0.m_mesh = grndMesh; nodes0.m_mesh = grndMesh; info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Segment__AlphaMap.png")); info.SetNodesTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Node__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = onewayRoadInfo.m_class.Clone("SmallOneway"); info.m_hasParkingSpaces = false; info.m_halfWidth = 5.0f; info.m_pavementWidth = 2f; // Setting up lanes var parkingLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Parking) .ToList(); var vehicleLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian) .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToList(); var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_similarLaneIndex) .ToList(); var vehicleLane = vehicleLanes[0]; var parkingLane = parkingLanes[0]; vehicleLanes[1].m_laneType = NetInfo.LaneType.None; parkingLanes[1].m_laneType = NetInfo.LaneType.None; vehicleLane.m_width = 3.5f; vehicleLane.m_verticalOffset = -0.3f; vehicleLane.m_position = -1.25f; vehicleLane.m_speedLimit = 0.7f; parkingLane.m_width = 2.5f; parkingLane.m_verticalOffset = -0.3f; parkingLane.m_position = 1.75f; var roadHalfWidth = 3f; var pedWidth = 2f; for (var i = 0; i < pedestrianLanes.Count; i++) { var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position); pedestrianLanes[i].m_width = pedWidth; pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth)); foreach (var prop in pedestrianLanes[i].m_laneProps.m_props) { prop.m_position.x += multiplier * roadHalfWidth; } } if (version == NetInfoVersion.Ground) { var playerNetAI = info.GetComponent <PlayerNetAI>(); var orPlayerNetAI = onewayRoadInfo.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = orPlayerNetAI.m_constructionCost * 2 / 3; playerNetAI.m_maintenanceCost = orPlayerNetAI.m_maintenanceCost * 2 / 3; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8m2mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TextureSet (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment__MainTex.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment__APRMap.png"), new LODTextureSet (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment_LOD__MainTex.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_Segment_LOD__APRMap.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_LOD__XYSMap.png")); info.SetAllNodesTexture( new TextureSet (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Node__MainTex.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_Node__APRMap.png"), new LODTextureSet (@"Roads\TinyRoads\OneWay1L\Textures\Ground_Node_LOD__MainTex.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_Node_LOD__APRMap.png", @"Roads\TinyRoads\OneWay1L\Textures\Ground_LOD__XYSMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_halfWidth = 4f; info.m_pavementWidth = 2f; info.m_class = roadInfo.m_class.Clone("NExt1LOneway"); info.m_lanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToArray(); info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LaneWidth = 4f, LanesToAdd = -1, SpeedLimit = 0.6f, BusStopOffset = 0f, PedLaneOffset = -0.75f, PedPropOffsetX = 2.25f }); info.SetupNewSpeedLimitProps(30, 40); // left traffic light var newLeftTrafficLight = Prefabs.Find<PropInfo>("Traffic Light 01", false); var oldLeftTrafficLight = Prefabs.Find<PropInfo>("Traffic Light 02 Mirror", false); if (newLeftTrafficLight == null || oldLeftTrafficLight == null) { return; } info.ReplaceProps(newLeftTrafficLight, oldLeftTrafficLight); var originPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (playerNetAI != null && originPlayerNetAI != null) { playerNetAI.m_constructionCost = originPlayerNetAI.m_constructionCost * 1 / 2; playerNetAI.m_maintenanceCost = originPlayerNetAI.m_maintenanceCost * 1 / 2; } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwayTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_TUNNEL); var basicRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16mMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_availableIn = ItemClass.Availability.All; info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L); info.m_surfaceLevel = 0; info.m_createPavement = version != NetInfoVersion.Ground && version != NetInfoVersion.Tunnel; info.m_createGravel = version == NetInfoVersion.Ground; info.m_averageVehicleLaneSpeed = 2f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = false; info.m_halfWidth = 8; info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; info.m_pavementWidth = 2; if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_class = highwayTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L_TUNNEL); } else { info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY1L); } /////////////////////////// // Set up lanes // /////////////////////////// info.SetupHighwayLanes(); var leftHwLane = info.SetHighwayLeftShoulder(highwayInfo, version); var rightHwLane = info.SetHighwayRightShoulder(highwayInfo, version); var vehicleLanes = info.SetHighwayVehicleLanes(); foreach (var lane in vehicleLanes) { lane.m_speedLimit = 1.8f; } /////////////////////////// // Set up props // /////////////////////////// // Shoulder lanes --------------------------------------------------------------------- var leftHwLaneProps = leftHwLane.m_laneProps.m_props.ToList(); var rightHwLaneProps = rightHwLane.m_laneProps.m_props.ToList(); foreach (var prop in leftHwLaneProps.Where(lp => lp.m_flagsForbidden == NetLane.Flags.Inverted)) { prop.m_startFlagsForbidden = NetNode.Flags.None; prop.m_startFlagsRequired = NetNode.Flags.None; prop.m_endFlagsForbidden = NetNode.Flags.None; prop.m_endFlagsRequired = NetNode.Flags.Transition; prop.m_angle = 180; prop.m_position.z *= -1; prop.m_segmentOffset *= -1; } // Set traffic lights leftHwLaneProps.Trim(lp => lp != null && lp.m_prop != null && lp.m_prop.name != null && lp.m_prop.name.Contains("Traffic")); rightHwLaneProps.Trim(lp => lp != null && lp.m_prop != null && lp.m_prop.name != null && lp.m_prop.name.Contains("Traffic")); leftHwLaneProps.AddRange(basicRoadInfo.GetLeftTrafficLights(version)); rightHwLaneProps.AddRange(basicRoadInfo.GetRightTrafficLights(version)); // Lightning rightHwLaneProps.SetHighwayRightLights(version); if (version == NetInfoVersion.Slope) { leftHwLaneProps.AddLeftWallLights(); rightHwLaneProps.AddRightWallLights(); } leftHwLaneProps.RemoveProps("100 Speed Limit"); // Since we dont have the 90km/h limit prop rightHwLaneProps.RemoveProps("100 Speed Limit"); // Since we dont have the 90km/h limit prop leftHwLane.m_laneProps.m_props = leftHwLaneProps.ToArray(); rightHwLane.m_laneProps.m_props = rightHwLaneProps.ToArray(); info.TrimNonHighwayProps(version == NetInfoVersion.Ground); /////////////////////////// // AI // /////////////////////////// var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (hwPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 2 / 3; playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 2 / 3; } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_highwayRules = true; roadBaseAI.m_trafficLights = false; roadBaseAI.m_accumulateSnow = false; } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L); var owRoadTunnelInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16m3mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 3 : 6); info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = owRoadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD_TUNNEL); } else { info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LanesToAdd = 2, SpeedLimit = 1.2f, CenterLane = CenterLaneType.TurningLane }); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); //Setting Up Props var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList(); var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.Slope) { leftRoadProps.AddLeftWallLights(info.m_pavementWidth); rightRoadProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray(); rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray(); info.TrimAboveGroundProps(version); info.SetupNewSpeedLimitProps(50, 40); // AI var owPlayerNetAI = roadInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3 / 2; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 3 / 2; // Charge by the lane? } var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } }
private static void SetupSunkenPrefab(NetInfo sunkenPrefab) { var stationAI = sunkenPrefab.GetComponent<TrainTrackAI>(); stationAI.m_tunnelInfo = sunkenPrefab; sunkenPrefab.m_clipTerrain = false; sunkenPrefab.m_createGravel = false; sunkenPrefab.m_createPavement = false; sunkenPrefab.m_createRuining = false; sunkenPrefab.m_flattenTerrain = false; sunkenPrefab.m_followTerrain = false; sunkenPrefab.m_intersectClass = null; sunkenPrefab.m_maxHeight = -1; sunkenPrefab.m_minHeight = -3; sunkenPrefab.m_requireSurfaceMaps = false; sunkenPrefab.m_snapBuildingNodes = false; sunkenPrefab.m_placementStyle = ItemClass.Placement.Procedural; sunkenPrefab.m_useFixedHeight = true; sunkenPrefab.m_lowerTerrain = false; sunkenPrefab.m_availableIn = ItemClass.Availability.GameAndAsset; }
public void LateBuildUp(NetInfo info, NetInfoVersion version) { if (version == NetInfoVersion.Bridge) { var bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded("478820060.CableStay32m_Data"); if (bridgePillar == null) { bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded("BridgePillar.CableStay32m_Data"); } if (bridgePillar != null) { var bridgeAI = info.GetComponent<RoadBridgeAI>(); if (bridgeAI != null) { bridgeAI.m_doubleLength = true; bridgeAI.m_bridgePillarInfo = null; bridgeAI.m_middlePillarInfo = bridgePillar; bridgeAI.m_middlePillarOffset = 58; } } } }
private static void SetupTunnelPrefab(NetInfo prefab) { var trainStationTrack = FindOriginalPrefab("Train Station Track"); prefab.m_class = ScriptableObject.CreateInstance<ItemClass>(); prefab.m_class.m_subService = ItemClass.SubService.PublicTransportTrain; prefab.m_class.m_service = ItemClass.Service.PublicTransport; prefab.m_class.m_layer = ItemClass.Layer.MetroTunnels | ItemClass.Layer.Default; prefab.m_canCollide = false; var metroAI = prefab.GetComponent<MetroTrackAI>(); GameObject.DestroyImmediate(metroAI); var trackAI = prefab.gameObject.AddComponent<UndergroundTrainStationTrackAI>(); trackAI.m_transportInfo = PrefabCollection<TransportInfo>.FindLoaded("Train"); prefab.m_netAI = trackAI; trackAI.m_createPassMilestone = trainStationTrack.GetComponent<TrainTrackAI>().m_createPassMilestone; trackAI.m_info = prefab; var field = typeof(PrefabInfo).GetField("m_UICategory", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(prefab, field.GetValue(trainStationTrack)); prefab.m_averageVehicleLaneSpeed = trainStationTrack.m_averageVehicleLaneSpeed; prefab.m_vehicleTypes = VehicleInfo.VehicleType.Train; prefab.m_buildHeight = 0; foreach (var lane in prefab.m_lanes) { if (lane.m_vehicleType == VehicleInfo.VehicleType.None) { lane.m_stopType = VehicleInfo.VehicleType.Train; } else { lane.m_vehicleType = VehicleInfo.VehicleType.Train; } } }
private static void OnPreInitializationAssetEditor(NetInfo info) { if (!(info.name?.Contains("Pedestrian Connection") ?? false)) { return; } info.m_class.m_service = ItemClass.Service.Beautification; _uiCategoryfield.SetValue(info, "BeautificationPaths"); var ai = info.GetComponent<PedestrianPathAI>(); ai.m_tunnelInfo = info; ai.m_bridgeInfo = info; ai.m_elevatedInfo = info; ai.m_slopeInfo = info; }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var onewayRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.SetMeshes (@"NewNetwork\OneWay1L\Meshes\Ground.obj", @"NewNetwork\OneWay1L\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\OneWay1L\Meshes\Ground.obj", @"NewNetwork\OneWay1L\Meshes\Ground_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\OneWay1L\Textures\Ground_SegmentLOD__XYSMap.png")); info.SetAllNodesTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Node__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Node__AlphaMap.png"), new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__AlphaMap.png", @"NewNetwork\OneWay1L\Textures\Ground_NodeLOD__XYSMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = onewayRoadInfo.m_class.Clone("SmallOneway"); info.m_hasParkingSpaces = false; info.m_halfWidth = 4f; info.m_pavementWidth = 2f; // Setting up lanes var parkingLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Parking) .ToList(); foreach (var parkingLane in parkingLanes) { parkingLane.m_laneType = NetInfo.LaneType.None; } var vehicleLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian) .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToList(); var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_similarLaneIndex) .ToList(); var vehicleLane = vehicleLanes[0]; vehicleLanes[1].m_laneType = NetInfo.LaneType.None; vehicleLane.m_width = 3f; vehicleLane.m_verticalOffset = -0.3f; vehicleLane.m_position = 0f; vehicleLane.m_speedLimit *= 0.7f; foreach (var prop in vehicleLane.m_laneProps.m_props) { prop.m_position.x = 0f; } var roadHalfWidth = 2f; var pedWidth = 2f; for (var i = 0; i < pedestrianLanes.Count; i++) { var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position); pedestrianLanes[i].m_width = pedWidth; pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth)); foreach (var prop in pedestrianLanes[i].m_laneProps.m_props) { prop.m_position.x += multiplier * roadHalfWidth; } } if (version == NetInfoVersion.Ground) { var playerNetAI = info.GetComponent<PlayerNetAI>(); var orPlayerNetAI = onewayRoadInfo.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = orPlayerNetAI.m_constructionCost * 2 / 3; playerNetAI.m_maintenanceCost = orPlayerNetAI.m_maintenanceCost * 2 / 3; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: { foreach (var segment in info.m_segments) { switch (segment.m_forwardRequired) { case NetSegment.Flags.StopLeft: case NetSegment.Flags.StopRight: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_SegmentLOD_Bus__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_Bus__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; case NetSegment.Flags.StopBoth: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_SegmentLOD_BusBoth__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_BusBoth__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; default: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; } } } break; case NetInfoVersion.GroundGrass: case NetInfoVersion.GroundTrees: { foreach (var segment in info.m_segments) { switch (segment.m_forwardRequired) { case NetSegment.Flags.StopLeft: case NetSegment.Flags.StopRight: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment_Bus__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_SegmentLOD_Bus__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_Bus__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; case NetSegment.Flags.StopBoth: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment_BusBoth__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_SegmentLOD_BusBoth__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_BusBoth__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; default: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures_Grass\Ground_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; } } } break; case NetInfoVersion.Bridge: case NetInfoVersion.Elevated: { foreach (var segment in info.m_segments) { segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Elevated_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Elevated_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_SegmentLOD__XYSMap.png")); } } break; case NetInfoVersion.Slope: { foreach (var segment in info.m_segments) { segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Slope_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Slope_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L1W\Textures\Slope_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Slope_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Slope_SegmentLOD__XYS.png")); } } break; case NetInfoVersion.Tunnel: break; } /////////////////////////// // Templates // /////////////////////////// var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); /////////////////////////// // Set up // /////////////////////////// info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; info.m_lanes = info.m_lanes.Where(l => l.m_laneType != NetInfo.LaneType.Parking).ToArray(); for (int i = 0; i < info.m_lanes.Count(); i++) { var lane = info.m_lanes[i].ShallowClone(); if (lane.m_laneType == NetInfo.LaneType.Vehicle) { if (version == NetInfoVersion.Ground) { if (lane.m_position < 0f) { lane.m_position -= 1f; lane.m_stopOffset += 1f; } else { lane.m_position += 1f; lane.m_stopOffset -= 1f; } } lane.m_speedLimit = 1.6f; lane.m_laneType = NetInfo.LaneType.TransportVehicle; lane.SetBusLaneProps(); info.m_lanes[i] = new ExtendedNetInfoLane(lane, ExtendedVehicleType.Bus | ExtendedVehicleType.EmergencyVehicles); } } var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (roadBaseAI != null) { } var roadAI = info.GetComponent <RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var basicRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.m_forwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.SetMeshes (@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj", @"NewNetwork\SmallHeavyRoads\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj", @"NewNetwork\SmallHeavyRoads\Meshes\Ground_Node_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\SmallAvenue4L\Textures\Ground_SegmentLOD__XYS.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_class = basicRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD); info.m_pavementWidth = 2; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = info.m_lanes .Where(l => l.m_laneType.HasFlag(NetInfo.LaneType.Parking) || vehicleLaneTypes.Contains(l.m_laneType)) .OrderBy(l => l.m_position) .ToArray(); const float outerCarLanePosition = 4.4f; const float innerCarLanePosition = 1.5f; const float pedLanePosition = 8f; const float pedLaneWidth = 1.5f; for (int i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; if (lane.m_laneType.HasFlag(NetInfo.LaneType.Parking)) { int closestVehicleLaneId; if (i - 1 >= 0 && vehicleLaneTypes.Contains(vehicleLanes[i - 1].m_laneType)) { closestVehicleLaneId = i - 1; } else if (i + 1 < vehicleLanes.Length && vehicleLaneTypes.Contains(vehicleLanes[i + 1].m_laneType)) { closestVehicleLaneId = i + 1; } else { continue; // Not supposed to happen } var closestVehicleLane = vehicleLanes[closestVehicleLaneId]; SetLane(lane, closestVehicleLane); } switch (i) { case 0: lane.m_position = -outerCarLanePosition; break; case 1: lane.m_position = -innerCarLanePosition; break; case 2: lane.m_position = innerCarLanePosition; break; case 3: lane.m_position = outerCarLanePosition; break; } } var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_position) .ToArray(); foreach (var lane in pedestrianLanes) { if (lane.m_position < 0) { lane.m_position = -pedLanePosition; } else { lane.m_position = pedLanePosition; } lane.m_width = pedLaneWidth; } if (version == NetInfoVersion.Ground) { var brPlayerNetAI = basicRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (brPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = brPlayerNetAI.m_constructionCost * 125 / 100; // 25% increase playerNetAI.m_maintenanceCost = brPlayerNetAI.m_maintenanceCost * 125 / 100; // 25% increase } } else // Same as the original basic road specs { } // Should we put traffic lights? //var roadBaseAI = info.GetComponent<RoadBaseAI>(); //if (roadBaseAI != null) //{ // roadBaseAI.m_trafficLights = true; //} }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var basicRoadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.m_forwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.SetMeshes (@"Roads\SmallHeavyRoads\Meshes\Ground.obj", @"Roads\SmallHeavyRoads\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"Roads\SmallHeavyRoads\Meshes\Ground.obj", @"Roads\SmallHeavyRoads\Meshes\Ground_Node_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"Roads\SmallAvenue4L\Textures\Ground_Segment__MainTex.png", @"Roads\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"Roads\SmallAvenue4L\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\SmallAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\SmallAvenue4L\Textures\Ground_SegmentLOD__XYS.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_class = basicRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD); info.m_pavementWidth = 2; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = info.m_lanes .Where(l => l.m_laneType.HasFlag(NetInfo.LaneType.Parking) || vehicleLaneTypes.Contains(l.m_laneType)) .OrderBy(l => l.m_position) .ToArray(); const float outerCarLanePosition = 4.4f; const float innerCarLanePosition = 1.5f; const float pedLanePosition = 8f; const float pedLaneWidth = 1.5f; for (int i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; if (lane.m_laneType.HasFlag(NetInfo.LaneType.Parking)) { int closestVehicleLaneId; if (i - 1 >= 0 && vehicleLaneTypes.Contains(vehicleLanes[i - 1].m_laneType)) { closestVehicleLaneId = i - 1; } else if (i + 1 < vehicleLanes.Length && vehicleLaneTypes.Contains(vehicleLanes[i + 1].m_laneType)) { closestVehicleLaneId = i + 1; } else { continue; // Not supposed to happen } var closestVehicleLane = vehicleLanes[closestVehicleLaneId]; SetLane(lane, closestVehicleLane); } switch (i) { case 0: lane.m_position = -outerCarLanePosition; break; case 1: lane.m_position = -innerCarLanePosition; break; case 2: lane.m_position = innerCarLanePosition; break; case 3: lane.m_position = outerCarLanePosition; break; } } var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_position) .ToArray(); foreach (var lane in pedestrianLanes) { if (lane.m_position < 0) { lane.m_position = -pedLanePosition; } else { lane.m_position = pedLanePosition; } lane.m_width = pedLaneWidth; } if (version == NetInfoVersion.Ground) { var brPlayerNetAI = basicRoadInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (brPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = brPlayerNetAI.m_constructionCost * 125 / 100; // 25% increase playerNetAI.m_maintenanceCost = brPlayerNetAI.m_maintenanceCost * 125 / 100; // 25% increase } } else // Same as the original basic road specs { } // Should we put traffic lights? //var roadBaseAI = info.GetComponent<RoadBaseAI>(); //if (roadBaseAI != null) //{ // roadBaseAI.m_trafficLights = true; //} }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: { foreach (var segment in info.m_segments) { switch (segment.m_forwardRequired) { case NetSegment.Flags.StopLeft: case NetSegment.Flags.StopRight: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_Bus__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_Bus__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; case NetSegment.Flags.StopBoth: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_BusBoth__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD_BusBoth__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; default: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Ground_SegmentLOD__XYSMap.png")); break; } } } break; case NetInfoVersion.GroundGrass: case NetInfoVersion.GroundTrees: { foreach (var segment in info.m_segments) { switch (segment.m_forwardRequired) { case NetSegment.Flags.StopLeft: case NetSegment.Flags.StopRight: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment_Bus__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_Bus__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_Bus__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; case NetSegment.Flags.StopBoth: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment_BusBoth__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_BusBoth__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD_BusBoth__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; default: segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures_Grass\Ground_SegmentLOD__XYSMap.png")); break; } } } break; case NetInfoVersion.Bridge: case NetInfoVersion.Elevated: { foreach (var segment in info.m_segments) { segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures\Elevated_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures\Elevated_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Elevated_SegmentLOD__XYSMap.png")); } } break; case NetInfoVersion.Slope: { foreach (var segment in info.m_segments) { segment.SetTextures( new TextureSet (@"Roads\BusRoads\Busway2L\Textures\Slope_Segment__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Slope_Segment__AlphaMap.png"), new LODTextureSet (@"Roads\BusRoads\Busway2L\Textures\Slope_SegmentLOD__MainTex.png", @"Roads\BusRoads\Busway2L\Textures\Slope_SegmentLOD__AlphaMap.png", @"Roads\BusRoads\Busway2L\Textures\Slope_SegmentLOD__XYS.png")); } } break; case NetInfoVersion.Tunnel: break; } /////////////////////////// // Templates // /////////////////////////// var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); /////////////////////////// // Set up // /////////////////////////// info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; info.m_lanes = info.m_lanes.Where(l => l.m_laneType != NetInfo.LaneType.Parking).ToArray(); info.m_laneTypes = NetInfo.LaneType.Pedestrian | NetInfo.LaneType.PublicTransport | NetInfo.LaneType.TransportVehicle; for (int i = 0; i < info.m_lanes.Count(); i++) { var lane = info.m_lanes[i]; if (lane.m_laneType == NetInfo.LaneType.Vehicle) { if (version == NetInfoVersion.Ground) { if (lane.m_position < 0f) { lane.m_position -= 1f; lane.m_stopOffset += 1f; } else { lane.m_position += 1f; lane.m_stopOffset -= 1f; } } lane.m_speedLimit = 1.6f; lane.m_laneType = NetInfo.LaneType.TransportVehicle; lane.SetBusLaneProps(); info.m_lanes[i] = new ExtendedNetInfoLane(lane, ExtendedVehicleType.Bus | ExtendedVehicleType.EmergencyVehicles); } } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwayTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_TUNNEL); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup24mMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_availableIn = ItemClass.Availability.All; //info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY4L); info.m_surfaceLevel = 0; info.m_createPavement = !(version == NetInfoVersion.Ground || version == NetInfoVersion.Tunnel); info.m_createGravel = version == NetInfoVersion.Ground; info.m_averageVehicleLaneSpeed = 2f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = false; info.m_UnlockMilestone = highwayInfo.m_UnlockMilestone; info.m_halfWidth = (version == NetInfoVersion.Bridge || version == NetInfoVersion.Elevated) ? 11 : 12; info.m_pavementWidth = 2; if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_class = highwayTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY4L_TUNNEL); } else { info.m_class = highwayInfo.m_class.Clone(NetInfoClasses.NEXT_HIGHWAY4L); } /////////////////////////// // Set up lanes // /////////////////////////// info.SetupHighwayLanes(); var leftHwLane = info.SetHighwayLeftShoulder(highwayInfo, version); var rightHwLane = info.SetHighwayRightShoulder(highwayInfo, version); var vehicleLanes = info.SetHighwayVehicleLanes(1); /////////////////////////// // Set up props // /////////////////////////// var leftHwLaneProps = leftHwLane.m_laneProps.m_props.ToList(); var rightHwLaneProps = rightHwLane.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.Slope) { leftHwLaneProps.SetHighwaySignsSlope(); rightHwLaneProps.SetHighwaySignsSlope(); } // Lightning rightHwLaneProps.SetHighwayRightLights(version); if (version == NetInfoVersion.Slope) { leftHwLaneProps.AddLeftWallLights(1); rightHwLaneProps.AddRightWallLights(-1); } leftHwLane.m_laneProps.m_props = leftHwLaneProps.ToArray(); rightHwLane.m_laneProps.m_props = rightHwLaneProps.ToArray(); info.TrimNonHighwayProps(); /////////////////////////// // AI // /////////////////////////// var hwPlayerNetAI = highwayInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (hwPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = hwPlayerNetAI.m_constructionCost * 4 / 3; playerNetAI.m_maintenanceCost = hwPlayerNetAI.m_maintenanceCost * 4 / 3; } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_highwayRules = true; roadBaseAI.m_trafficLights = false; roadBaseAI.m_accumulateSnow = false; } var roadAI = info.GetComponent<RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var mediumRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.AVENUE_4L); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"Roads\MediumAvenue4L\Textures\Ground_Segment__MainTex.png", @"Roads\MediumAvenue4L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\MediumAvenue4L\Textures\Ground_SegmentLOD__XYSMap.png")); info.SetAllNodesTexture( new TexturesSet (null, @"Roads\MediumAvenue4L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = mediumRoadInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD); info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = mediumRoadInfo .m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .Select(l => l.ShallowClone()) .OrderBy(l => l.m_position) .ToArray(); var nonVehicleLanes = info.m_lanes .Where(l => !vehicleLaneTypes.Contains(l.m_laneType)) .ToArray(); info.m_lanes = vehicleLanes .Union(nonVehicleLanes) .ToArray(); for (var i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; switch (i) { // Inside lane case 1: case 2: if (lane.m_position < 0) { lane.m_position += 0.5f; } else { lane.m_position += -0.5f; } break; } } info.Setup50LimitProps(); if (version == NetInfoVersion.Ground) { var mrPlayerNetAI = mediumRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (mrPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease } var mrRoadBaseAI = mediumRoadInfo.GetComponent<RoadBaseAI>(); var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (mrRoadBaseAI != null && roadBaseAI != null) { roadBaseAI.m_noiseAccumulation = mrRoadBaseAI.m_noiseAccumulation; roadBaseAI.m_noiseRadius = mrRoadBaseAI.m_noiseRadius; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var mediumRoadInfo = ToolsCSL.FindPrefab<NetInfo>("Medium Road"); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = mediumRoadInfo.m_class.Clone(MediumAvenueHelper.CLASS_NAME); info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = mediumRoadInfo .m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .Select(l => l.ShallowClone()) .OrderBy(l => l.m_position) .ToArray(); var nonVehicleLanes = info.m_lanes .Where(l => !vehicleLaneTypes.Contains(l.m_laneType)) .ToArray(); info.m_lanes = vehicleLanes .Union(nonVehicleLanes) .ToArray(); for (var i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; switch (i) { // Inside lane case 1: case 2: if (lane.m_position < 0) { lane.m_position += 0.5f; } else { lane.m_position += -0.5f; } break; } } info.Setup50LimitProps(); if (version == NetInfoVersion.Ground) { var mrPlayerNetAI = mediumRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (mrPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L); var owRoadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16m3mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 3 : 6); info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = owRoadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD_TUNNEL); } else { info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = false, LanesToAdd = 1, LaneWidth = 3.3f, SpeedLimit = 1.2f }); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); //Setting Up Props var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList(); var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.Slope) { leftRoadProps.AddLeftWallLights(info.m_pavementWidth); rightRoadProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray(); rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray(); info.TrimAboveGroundProps(version); info.SetupNewSpeedLimitProps(60, 40); // AI var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3 / 2; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 3 / 2; // Charge by the lane? } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var mediumRoadInfo = ToolsCSL.FindPrefab <NetInfo>("Medium Road"); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = mediumRoadInfo.m_class.Clone(MediumAvenueHelper.CLASS_NAME); info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = mediumRoadInfo .m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .Select(l => l.ShallowClone()) .OrderBy(l => l.m_position) .ToArray(); var nonVehicleLanes = info.m_lanes .Where(l => !vehicleLaneTypes.Contains(l.m_laneType)) .ToArray(); info.m_lanes = vehicleLanes .Union(nonVehicleLanes) .ToArray(); for (var i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; switch (i) { // Inside lane case 1: case 2: if (lane.m_position < 0) { lane.m_position += 0.5f; } else { lane.m_position += -0.5f; } break; } } info.Setup50LimitProps(); if (version == NetInfoVersion.Ground) { var mrPlayerNetAI = mediumRoadInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (mrPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\OneWayMedium4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\OneWayMedium4L\Textures\Ground_Segment__AlphaMap.png")); info.SetAllNodesTexture( new TexturesSet (@"NewNetwork\OneWayMedium4L\Textures\Ground_Node__MainTex.png", @"NewNetwork\OneWayMedium4L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.SetMeshes (@"NewNetwork\OneWayMedium4L\Meshes\Ground.obj", @"NewNetwork\OneWayMedium4L\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\OneWayMedium4L\Meshes\Ground.obj", @"NewNetwork\OneWayMedium4L\Meshes\Ground_Node_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0}; } /////////////////////////// // Set up // /////////////////////////// var vehicleLaneWidth = 3f; var pedWidth = 4f; var roadHalfWidth = 8f; var parkingLaneWidth = 2f; var vehicleLanesToTake = 4; info.m_halfWidth = 12.0f; info.m_pavementWidth = pedWidth; // Disabling Parkings and Peds //foreach (var l in info.m_lanes) //{ // if (l.m_laneType == NetInfo.LaneType.Parking) // { // l.m_laneType = NetInfo.LaneType.None; // } //} // Setting up lanes var lanes = info.m_lanes; var parkingLanes = lanes .Where(l => l.m_laneType == NetInfo.LaneType.Parking) .ToList(); var vehicleLanes = lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian) .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .Take(vehicleLanesToTake).ToList(); var pedestrianLanes = lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_similarLaneIndex) .ToList(); for (var i = 0; i < pedestrianLanes.Count; i++) { var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position); pedestrianLanes[i].m_width = pedWidth; pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth)); foreach (var prop in pedestrianLanes[i].m_laneProps.m_props) { prop.m_position.x += multiplier * 1.5f; } } for (var i = 0; i < vehicleLanes.Count; i++) { vehicleLanes[i].m_similarLaneCount = vehicleLanes.Count(); vehicleLanes[i].m_similarLaneIndex = i; vehicleLanes[i].m_width = vehicleLaneWidth; vehicleLanes[i].m_position = (-1 * ((vehicleLanes.Count / 2f) - .5f) + i) * vehicleLaneWidth; } for (var i = 0; i < parkingLanes.Count; i++) { var multiplier = parkingLanes[i].m_position / Math.Abs(parkingLanes[i].m_position); parkingLanes[i].m_width = parkingLaneWidth; parkingLanes[i].m_position = multiplier * (roadHalfWidth - (parkingLaneWidth / 2)); } var onewayRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L); if (version == NetInfoVersion.Ground) { var playerNetAI = info.GetComponent<PlayerNetAI>(); var orPlayerNetAI = onewayRoadInfo.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = orPlayerNetAI.m_constructionCost * 2; playerNetAI.m_maintenanceCost = orPlayerNetAI.m_maintenanceCost * 2; } } else // Same as the original oneway { } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var mediumRoadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.AVENUE_4L); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\MediumAvenue4L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\MediumAvenue4L\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\MediumAvenue4L\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\MediumAvenue4L\Textures\Ground_SegmentLOD__XYSMap.png")); info.SetAllNodesTexture( new TexturesSet (null, @"NewNetwork\MediumAvenue4L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = mediumRoadInfo.m_class.Clone(NetInfoClasses.NEXT_MEDIUM_ROAD); info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = mediumRoadInfo .m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .Select(l => l.ShallowClone()) .OrderBy(l => l.m_position) .ToArray(); var nonVehicleLanes = info.m_lanes .Where(l => !vehicleLaneTypes.Contains(l.m_laneType)) .ToArray(); info.m_lanes = vehicleLanes .Union(nonVehicleLanes) .ToArray(); for (var i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; switch (i) { // Inside lane case 1: case 2: if (lane.m_position < 0) { lane.m_position += 0.5f; } else { lane.m_position += -0.5f; } break; } } info.Setup50LimitProps(); if (version == NetInfoVersion.Ground) { var mrPlayerNetAI = mediumRoadInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (mrPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease } var mrRoadBaseAI = mediumRoadInfo.GetComponent <RoadBaseAI>(); var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (mrRoadBaseAI != null && roadBaseAI != null) { roadBaseAI.m_noiseAccumulation = mrRoadBaseAI.m_noiseAccumulation; roadBaseAI.m_noiseRadius = mrRoadBaseAI.m_noiseRadius; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup8m1p5mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Segment__APRMap.png"), new LODTextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Segment_LOD__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Segment_LOD__APRMap.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png")); foreach (var node in info.m_nodes) { if (node.m_flagsForbidden == NetNode.Flags.Transition) { node.SetTextures( new TextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Node__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Node__APRMap.png"), new LODTextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Node_LOD__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Node_LOD__APRMap.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png")); } else if (node.m_flagsRequired == NetNode.Flags.Transition) { node.SetTextures( new TextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Trans__APRMap.png"), new LODTextureSet (@"Roads\TinyRoads\Alley2L\Textures\Ground_Trans_LOD__MainTex.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_Trans_LOD__APRMap.png", @"Roads\TinyRoads\Alley2L\Textures\Ground_LOD__XYSMap.png")); } } break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_halfWidth = 4f; info.m_pavementWidth = 1.5f; info.m_surfaceLevel = 0; info.m_class = roadInfo.m_class.Clone("NExt2LAlley"); info.m_class.m_level = (ItemClass.Level)5; //New level info.m_lanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToArray(); var pedLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian); var roadLanes = info.m_lanes.Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian && l.m_laneType != NetInfo.LaneType.None); foreach (var pedLane in pedLanes) { pedLane.m_verticalOffset = 0.25f; } foreach (var roadLane in roadLanes) { roadLane.m_verticalOffset = 0.1f; } info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LaneWidth = 2.5f, SpeedLimit = 0.6f, BusStopOffset = 0f, PedLaneOffset = -0.75f, PedPropOffsetX = 2.25f }); info.SetupNewSpeedLimitProps(30, 40); info.TrimArrowsProps(); var originPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (playerNetAI != null && originPlayerNetAI != null) { playerNetAI.m_constructionCost = originPlayerNetAI.m_constructionCost * 1 / 2; playerNetAI.m_maintenanceCost = originPlayerNetAI.m_maintenanceCost * 1 / 2; } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var mediumRoadInfo = ToolsCSL.FindPrefab<NetInfo>("Medium Road"); /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\MediumAvenue4LTL\Textures\Ground_Segment__MainTex.png", @"NewNetwork\MediumAvenue4LTL\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\MediumAvenue4LTL\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\MediumAvenue4LTL\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\MediumAvenue4LTL\Textures\Ground_SegmentLOD__XYSMap.png")); info.SetNodesTexture( new TexturesSet (null, @"NewNetwork\MediumAvenue4LTL\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = mediumRoadInfo.m_class.Clone(MediumAvenueHelper.CLASS_NAME); info.m_UnlockMilestone = mediumRoadInfo.m_UnlockMilestone; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = info.m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .OrderBy(l => l.m_position) .ToArray(); for (var i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; switch (i) { // Turning lanes case 3: case 2: lane.m_allowConnect = false; lane.m_speedLimit /= 2f; lane.m_position = 0f; SetupTurningLaneProps(lane); break; // Regular lane case 4: case 1: if (lane.m_position < 0) { lane.m_position += 0.5f; } else { lane.m_position += -0.5f; } break; } } info.Setup50LimitProps(); if (version == NetInfoVersion.Ground) { var mrPlayerNetAI = mediumRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (mrPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = mrPlayerNetAI.m_constructionCost * 9 / 10; // 10% decrease playerNetAI.m_maintenanceCost = mrPlayerNetAI.m_maintenanceCost * 9 / 10; // 10% decrease } var mrRoadBaseAI = mediumRoadInfo.GetComponent<RoadBaseAI>(); var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } if (mrRoadBaseAI != null && roadBaseAI != null) { roadBaseAI.m_noiseAccumulation = mrRoadBaseAI.m_noiseAccumulation; roadBaseAI.m_noiseRadius = mrRoadBaseAI.m_noiseRadius; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadTunnelInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_4L_TUNNEL); var roadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_6L); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup32m3mSW2x3mMdnBusMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = true; info.m_pavementWidth = (version == NetInfoVersion.Slope || version == NetInfoVersion.Tunnel ? 4 : 3); info.m_halfWidth = (version == NetInfoVersion.Tunnel ? 17 : 16); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD_TUNNEL); } else { info.m_class = info.m_class.Clone("NEXTFourDevidedLaneBusAvenue4Parking" + version.ToString()); } info.m_canCrossLanes = false; // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LanesToAdd = 2, LaneWidth = version == NetInfoVersion.Slope ? 2.75f : 3, PedPropOffsetX = version == NetInfoVersion.Slope ? 1.5f : 1f, CenterLane = CenterLaneType.Median, CenterLaneWidth = 2, BusStopOffset = 0, HasBusStop = false }); var carLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Vehicle).ToList(); var pedkLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian).ToList(); var parking = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Parking).ToList(); carLanes[0].m_direction = NetInfo.Direction.Backward; carLanes[0].m_finalDirection = NetInfo.Direction.Backward; carLanes[0].m_position = -9.5f; carLanes[1].m_position = -6.6f; carLanes[1].m_direction = NetInfo.Direction.Backward; carLanes[1].m_finalDirection = NetInfo.Direction.Backward; carLanes[1].m_stopType = VehicleInfo.VehicleType.None; carLanes[2].m_position = -1.5f; carLanes[2].m_direction = NetInfo.Direction.Backward; carLanes[2].m_finalDirection = NetInfo.Direction.Backward; carLanes[2].m_laneType = NetInfo.LaneType.TransportVehicle; carLanes[2].m_stopType = VehicleInfo.VehicleType.Car; var tempProps = carLanes[2].m_laneProps.m_props.ToList(); tempProps.RemoveProps("arrow"); carLanes[2].m_laneProps.m_props = tempProps.ToArray(); carLanes[2].m_stopType = VehicleInfo.VehicleType.None; carLanes[3].m_position = 1.5f; carLanes[3].m_direction = NetInfo.Direction.Forward; carLanes[3].m_finalDirection = NetInfo.Direction.Forward; carLanes[3].m_laneType = NetInfo.LaneType.TransportVehicle; carLanes[3].m_stopType = VehicleInfo.VehicleType.Car; tempProps = carLanes[3].m_laneProps.m_props.ToList(); tempProps.RemoveProps("arrow"); carLanes[3].m_laneProps.m_props = tempProps.ToArray(); BusRoads.BusRoadsHelper.SetBusLaneProps(carLanes[2]); BusRoads.BusRoadsHelper.SetBusLaneProps(carLanes[3]); carLanes[4].m_position = 6.6f; // carLanes[4].m_speedLimit = .2f; carLanes[4].m_direction = NetInfo.Direction.Forward; carLanes[4].m_finalDirection = NetInfo.Direction.Forward; carLanes[4].m_stopType = VehicleInfo.VehicleType.None; carLanes[5].m_position = 9.5f; carLanes[5].m_direction = NetInfo.Direction.Forward; carLanes[5].m_finalDirection = NetInfo.Direction.Forward; carLanes[5].m_stopType = VehicleInfo.VehicleType.None; var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); var leftPed = info.GetLeftRoadShoulder().CloneWithoutStops(); leftPed.m_width = 1f; leftPed.m_position = -3.8f; tempProps = leftPed.m_laneProps.m_props.ToList(); tempProps.RemoveProps("light"); tempProps.RemoveProps("limit"); tempProps.RemoveProps("random"); leftPed.m_laneProps.m_props = tempProps.ToArray(); var rightPed = info.GetRightRoadShoulder().CloneWithoutStops(); rightPed.m_position = 3.8f; rightPed.m_width = 1f; tempProps = rightPed.m_laneProps.m_props.ToList(); tempProps.RemoveProps("light"); tempProps.RemoveProps("limit"); tempProps.RemoveProps("random"); rightPed.m_laneProps.m_props = tempProps.ToArray(); rightPed.m_stopType = VehicleInfo.VehicleType.Car; leftPed.m_stopType = VehicleInfo.VehicleType.Car; leftPedLane.m_stopType = VehicleInfo.VehicleType.None; rightPedLane.m_stopType = VehicleInfo.VehicleType.None; var centerLane1 = info.GetMedianLane().CloneWithoutStops(); var centerLane2 = info.GetMedianLane().CloneWithoutStops(); centerLane1.m_width = 1f; centerLane2.m_width = 1f; centerLane1.m_position = -4.3f; centerLane2.m_position = 4.3f; var leftPedLaneProps = leftPed.m_laneProps.m_props.ToList(); var rightPedLaneProps = rightPed.m_laneProps.m_props.ToList(); var centerLane1PedLaneProps = centerLane1.m_laneProps.m_props.ToList(); var centerLane2PedLaneProps = centerLane2.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.GroundTrees) { var treeProp = new NetLaneProps.Prop() { m_tree = Prefabs.Find <TreeInfo>("Tree2variant"), m_repeatDistance = 30, m_probability = 100, }; treeProp.m_position.x = 0; centerLane1PedLaneProps.Add(treeProp.ShallowClone()); centerLane2PedLaneProps.Add(treeProp.ShallowClone()); } var centerLane1StreetLight = centerLane1PedLaneProps?.FirstOrDefault(p => { if (p == null || p.m_prop == null) { return(false); } return(p.m_prop.name.ToLower().Contains("avenue light")); }); var centerLane1TrafficLight = centerLane1PedLaneProps?.FirstOrDefault(p => { if (p == null || p.m_prop == null) { return(false); } return(p.m_prop.name.ToLower().Contains("traffic light")); }); if (centerLane1StreetLight != null) { centerLane1StreetLight.m_finalProp = centerLane1StreetLight.m_prop = Prefabs.Find <PropInfo>(MediumAvenueSideLightBuilder.NAME); centerLane1StreetLight.m_angle = 180; var lefttLigth = centerLane1StreetLight.ShallowClone(); lefttLigth.m_position = new Vector3(-9.8f, 0, 0); leftPedLaneProps.AddProp(lefttLigth); } var centerLane2StreetLight = centerLane2PedLaneProps?.FirstOrDefault(p => { if (p == null || p.m_prop == null) { return(false); } return(p.m_prop.name.ToLower().Contains("avenue light")); }); if (centerLane2StreetLight != null) { centerLane2StreetLight.m_finalProp = centerLane2StreetLight.m_prop = Prefabs.Find <PropInfo>(MediumAvenueSideLightBuilder.NAME); centerLane2StreetLight.m_angle = 0; var rightLigth = centerLane2StreetLight.ShallowClone(); rightLigth.m_position = new Vector3(9.8f, 0, 0); rightPedLaneProps.AddProp(rightLigth); } var ind = 0; var indped = 0; centerLane1PedLaneProps?.ForEach(p => { if (p == null || p.m_prop == null) { return; } if (p.m_prop.name.ToLower().Contains("pedestrian")) { indped++; p.m_position = new Vector3(-0.9f, 0, 0); p.m_angle = 270; return; } if (p.m_prop.name.ToLower().Contains("mirror")) { ind++; if (ind == 1) { p.m_finalProp = p.m_prop = Prefabs.Find <PropInfo>("Traffic Light Pedestrian"); } else { p.m_finalProp = p.m_prop = Prefabs.Find <PropInfo>("Traffic Light 02"); p.m_position = new Vector3(.9f, 0, 0); } } }); ind = 0; indped = 0; centerLane2PedLaneProps?.ForEach(p => { if (p == null || p.m_prop == null) { return; } if (p.m_prop.name.ToLower().Contains("pedestrian")) { indped++; p.m_position = new Vector3(0.9f, 0, 0); p.m_angle = 90; return; } if (p.m_prop.name.ToLower().Contains("mirror")) { ind++; if (ind == 2) { p.m_finalProp = p.m_prop = Prefabs.Find <PropInfo>("Traffic Light Pedestrian"); } else { p.m_finalProp = p.m_prop = Prefabs.Find <PropInfo>("Traffic Light 02"); p.m_position = new Vector3(-.9f, 0, 0); } } }); if (centerLane1PedLaneProps != null) { // centerLane1PedLaneProps.RemoveProps("light"); centerLane1PedLaneProps.RemoveProps("bus"); centerLane1PedLaneProps.RemoveProps("avenue side"); centerLane1PedLaneProps.RemoveProps("50 Speed Limit"); } if (centerLane2PedLaneProps != null) { // centerLane2PedLaneProps.RemoveProps("light"); centerLane2PedLaneProps.RemoveProps("bus"); centerLane2PedLaneProps.RemoveProps("avenue side"); centerLane2PedLaneProps.RemoveProps("50 Speed Limit"); } if (centerLane1?.m_laneProps != null && centerLane1PedLaneProps != null) { centerLane1.m_laneProps.m_props = centerLane1PedLaneProps.ToArray(); } if (centerLane2?.m_laneProps != null && centerLane2PedLaneProps != null) { centerLane2.m_laneProps.m_props = centerLane2PedLaneProps.ToArray(); } //var centerLaneProps = new List<NetLaneProps.Prop>(); centerLane1.m_laneProps.m_props = centerLane1PedLaneProps.ToArray(); centerLane2.m_laneProps.m_props = centerLane2PedLaneProps.ToArray(); leftPed.m_laneProps.m_props = leftPedLaneProps.ToArray(); rightPed.m_laneProps.m_props = rightPedLaneProps.ToArray(); var pedLanes = new List <NetInfo.Lane>(); pedLanes.Add(rightPed); pedLanes.Add(leftPed); pedLanes.Add(leftPedLane); pedLanes.Add(rightPedLane); //carLanes[4].m_position += 1; var tempLanes = new List <NetInfo.Lane>(); tempLanes.Add(centerLane1); tempLanes.Add(centerLane2); tempLanes.AddRange(pedLanes); // tempLanes.AddRange(pedkLanes); tempLanes.AddRange(carLanes); tempLanes.AddRange(parking); info.m_lanes = tempLanes.ToArray(); // AI var owPlayerNetAI = roadInfo.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 3; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 3; // Charge by the lane? } var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var onewayRoadInfo = ToolsCSL.FindPrefab<NetInfo>("Oneway Road"); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; var grndMesh = OneWay1LSegmentModel.BuildMesh().CreateMesh("OW_1L_GROUND"); segments0.m_mesh = grndMesh; nodes0.m_mesh = grndMesh; info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Segment__AlphaMap.png")); info.SetNodesTexture( new TexturesSet (@"NewNetwork\OneWay1L\Textures\Ground_Node__MainTex.png", @"NewNetwork\OneWay1L\Textures\Ground_Node__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_class = onewayRoadInfo.m_class.Clone("SmallOneway"); info.m_hasParkingSpaces = false; info.m_halfWidth = 5.0f; info.m_pavementWidth = 2f; // Setting up lanes var parkingLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Parking) .ToList(); var vehicleLanes = info.m_lanes .Where(l => l.m_laneType != NetInfo.LaneType.None) .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian) .Where(l => l.m_laneType != NetInfo.LaneType.Parking) .ToList(); var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_similarLaneIndex) .ToList(); var vehicleLane = vehicleLanes[0]; var parkingLane = parkingLanes[0]; vehicleLanes[1].m_laneType = NetInfo.LaneType.None; parkingLanes[1].m_laneType = NetInfo.LaneType.None; vehicleLane.m_width = 3.5f; vehicleLane.m_verticalOffset = -0.3f; vehicleLane.m_position = -1.25f; vehicleLane.m_speedLimit = 0.7f; parkingLane.m_width = 2.5f; parkingLane.m_verticalOffset = -0.3f; parkingLane.m_position = 1.75f; var roadHalfWidth = 3f; var pedWidth = 2f; for (var i = 0; i < pedestrianLanes.Count; i++) { var multiplier = pedestrianLanes[i].m_position / Math.Abs(pedestrianLanes[i].m_position); pedestrianLanes[i].m_width = pedWidth; pedestrianLanes[i].m_position = multiplier * (roadHalfWidth + (.5f * pedWidth)); foreach (var prop in pedestrianLanes[i].m_laneProps.m_props) { prop.m_position.x += multiplier * roadHalfWidth; } } if (version == NetInfoVersion.Ground) { var playerNetAI = info.GetComponent<PlayerNetAI>(); var orPlayerNetAI = onewayRoadInfo.GetComponent<PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = orPlayerNetAI.m_constructionCost * 2 / 3; playerNetAI.m_maintenanceCost = orPlayerNetAI.m_maintenanceCost * 2 / 3; } } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// //var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); //var owRoadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16m3mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 3 : 6); info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11); info.m_canCrossLanes = true; if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = info.m_class.Clone("NEXTbasicroadpaintedmedianTunnel"); } else { info.m_class = info.m_class.Clone("NEXTbasicroadpaintedmedian"); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LaneWidth = 3.3f, SpeedLimit = 1.2f, CenterLane = CenterLaneType.Median, CenterLaneWidth = 3.3f }); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); //Setting Up Props var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList(); var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.Slope) { leftRoadProps.AddLeftWallLights(info.m_pavementWidth); rightRoadProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray(); rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray(); info.TrimAboveGroundProps(version); info.SetupNewSpeedLimitProps(50, 40); // AI var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_2L); var owRoadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L_TUNNEL); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16m2mSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_pavementWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 2 : 5); info.m_halfWidth = (version != NetInfoVersion.Slope && version != NetInfoVersion.Tunnel ? 8 : 11); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = owRoadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD_TUNNEL); } else { info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL4L_ROAD); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LanesToAdd = 2, PedPropOffsetX = 0.5f, BusStopOffset = 0f, SpeedLimit = 1.0f }); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); // Fix for T++ legacy support var lanes = info.m_lanes.OrderBy(l => l.m_position).ToArray(); var lanesLegacyOrder = new[] { lanes[0], lanes[5], lanes[1], lanes[4], lanes[2], lanes[3] }; info.m_lanes = lanesLegacyOrder; //Setting Up Props var leftRoadProps = leftPedLane.m_laneProps.m_props.ToList(); var rightRoadProps = rightPedLane.m_laneProps.m_props.ToList(); if (version == NetInfoVersion.Slope) { leftRoadProps.AddLeftWallLights(info.m_pavementWidth); rightRoadProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftRoadProps.ToArray(); rightPedLane.m_laneProps.m_props = rightRoadProps.ToArray(); info.TrimAboveGroundProps(version); info.SetupNewSpeedLimitProps(50, 40); // AI var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 2; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 2; // Charge by the lane? } // TODO: make it configurable var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var owRoadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ONEWAY_2L); /////////////////////////// // 3DModeling // /////////////////////////// if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0.m_forwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.SetMeshes (@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj", @"NewNetwork\SmallHeavyRoads\Meshes\Ground_LOD.obj"); nodes0.SetMeshes (@"NewNetwork\SmallHeavyRoads\Meshes\Ground.obj", @"NewNetwork\SmallHeavyRoads\Meshes\Ground_Node_LOD.obj"); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; } /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetAllSegmentsTexture( new TexturesSet (@"NewNetwork\OneWay3L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\OneWay3L\Textures\Ground_Segment__AlphaMap.png"), new TexturesSet (@"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__MainTex.png", @"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__AlphaMap.png", @"NewNetwork\OneWay3L\Textures\Ground_SegmentLOD__XYS.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_class = owRoadInfo.m_class.Clone(NetInfoClasses.NEXT_SMALL3L_ROAD); info.m_pavementWidth = 2; info.m_class.m_level = ItemClass.Level.Level3; // To make sure they dont fit with the 4L Small Roads // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var templateLane = info.m_lanes .Where(l => vehicleLaneTypes.Contains(l.m_laneType)) .OrderBy(l => l.m_position) .First(); var vehicleLanes = new List<NetInfo.Lane>(); const float outerCarLanePosition = 4.0f; const float pedLanePosition = 8f; const float pedLaneWidth = 1.5f; for (int i = 0; i < 3; i++) { var lane = templateLane.Clone(string.Format("Carlane {0}", i + 1)); lane.m_similarLaneIndex = i; lane.m_similarLaneCount = 3; switch (i) { case 0: lane.m_position = -outerCarLanePosition; break; case 1: lane.m_position = 0f; break; case 2: lane.m_position = outerCarLanePosition; break; } if (i == 2) { lane.m_allowStop = true; lane.m_stopOffset = 0.7f; } vehicleLanes.Add(lane); } var pedestrianLanes = info.m_lanes .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian) .OrderBy(l => l.m_position) .ToArray(); foreach (var lane in pedestrianLanes) { if (lane.m_position < 0) { lane.m_position = -pedLanePosition; } else { lane.m_position = pedLanePosition; } lane.m_width = pedLaneWidth; } var allLanes = new List<NetInfo.Lane>(); allLanes.AddRange(vehicleLanes); allLanes.AddRange(pedestrianLanes); info.m_lanes = allLanes .OrderBy(l => l.m_position) .ToArray(); if (version == NetInfoVersion.Ground) { var owPlayerNetAI = owRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 11 / 10; // 10% increase playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 11 / 10; // 10% increase } } else // Same as the original basic road specs { } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadTunnelInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_4L_TUNNEL); var roadInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.ROAD_6L); /////////////////////////// // 3DModeling // /////////////////////////// info.Setup32m3mSW2mMdnMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; info.m_pavementWidth = (version == NetInfoVersion.Slope || version == NetInfoVersion.Tunnel ? 4 : 3); info.m_halfWidth = (version == NetInfoVersion.Tunnel ? 17 : 16); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition | Vehicle.Flags.Underground; info.m_setCitizenFlags = CitizenInstance.Flags.Transition | CitizenInstance.Flags.Underground; info.m_class = roadTunnelInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD_TUNNEL); } else { info.m_class = roadInfo.m_class.Clone(NetInfoClasses.NEXT_XLARGE_ROAD); } // Setting up lanes info.SetRoadLanes(version, new LanesConfiguration { IsTwoWay = true, LanesToAdd = 4, LaneWidth = version == NetInfoVersion.Slope ? 2.75f : 3, PedPropOffsetX = version == NetInfoVersion.Slope ? 1.5f : 1f, CenterLane = CenterLaneType.Median, CenterLaneWidth = 2, BusStopOffset = 0f }); var medianLane = info.GetMedianLane(); var leftPedLane = info.GetLeftRoadShoulder(); var rightPedLane = info.GetRightRoadShoulder(); // Fix for T++ legacy support (reordering) if (medianLane != null) { info.m_lanes = info .m_lanes .Except(medianLane) .Union(medianLane) .ToArray(); } //Setting Up Props var leftPedLaneProps = leftPedLane.m_laneProps.m_props.ToList(); var rightPedLaneProps = rightPedLane.m_laneProps.m_props.ToList(); var medianPedLaneProps = medianLane?.m_laneProps?.m_props.ToList(); if (version != NetInfoVersion.Tunnel) { var medianStreetLight = medianPedLaneProps?.FirstOrDefault(p => p.m_prop.name.ToLower().Contains("avenue light")); if (medianStreetLight != null) { medianStreetLight.m_finalProp = medianStreetLight.m_prop = Prefabs.Find<PropInfo>(LargeAvenueMedianLightBuilder.NAME); } } if (medianPedLaneProps != null) { medianPedLaneProps.RemoveProps("50 Speed Limit"); } if (version == NetInfoVersion.Slope) { leftPedLaneProps.AddLeftWallLights(info.m_pavementWidth); rightPedLaneProps.AddRightWallLights(info.m_pavementWidth); } leftPedLane.m_laneProps.m_props = leftPedLaneProps.ToArray(); rightPedLane.m_laneProps.m_props = rightPedLaneProps.ToArray(); if (medianLane?.m_laneProps != null && medianPedLaneProps != null) { medianLane.m_laneProps.m_props = medianPedLaneProps.ToArray(); } info.TrimAboveGroundProps(version); // AI var owPlayerNetAI = roadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (owPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = owPlayerNetAI.m_constructionCost * 2; // Charge by the lane? playerNetAI.m_maintenanceCost = owPlayerNetAI.m_maintenanceCost * 2; // Charge by the lane? } var roadBaseAI = info.GetComponent<RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var roadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L_TREES); var roadTunnelInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L_TUNNEL); info.m_connectGroup = (NetInfo.ConnectGroup) 16; info.m_requireDirectRenderers = true; info.m_nodeConnectGroups = (NetInfo.ConnectGroup) 16; /////////////////////////// // 3DModeling // /////////////////////////// info.Setup16mNoSWMesh(version); /////////////////////////// // Texturing // /////////////////////////// SetupTextures(info, version); /////////////////////////// // Set up // /////////////////////////// info.m_availableIn = ItemClass.Availability.All; info.m_surfaceLevel = 0; info.m_createPavement = true; info.m_createGravel = false; info.m_canCrossLanes = false; //info.m_averageVehicleLaneSpeed = 0.3f; info.m_hasParkingSpaces = false; info.m_hasPedestrianLanes = true; info.m_halfWidth = 8; info.m_UnlockMilestone = roadInfo.m_UnlockMilestone; info.m_pavementWidth = 2; info.m_requireSurfaceMaps = true; info.m_dlcRequired = SteamHelper.DLC_BitMask.AfterDarkDLC; var pedModdedLanes = info.SetRoadLanes(version, new LanesConfiguration() { PedPropOffsetX = 3.5f, LanesToAdd = 2, SpeedLimit = 0.2f }); if (version == NetInfoVersion.Tunnel) { info.m_setVehicleFlags = Vehicle.Flags.Transition; info.m_class = roadTunnelInfo.m_class.Clone("NExtPedRoadStone16m"); } else { info.m_class = roadInfo.m_class.Clone("NExtPedRoadStone16m"); } info.m_class.m_level = ItemClass.Level.Level5; // Setting up lanes var vehicleLanes = info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Vehicle).ToList(); var bikeLaneWidth = 2; var bikeLanePosAbs = 1; var sVehicleLaneWidth = 2.5f; var sVehicleLanePosAbs = 4f; var bikeLanes = new List <NetInfo.Lane>(); bikeLanes.AddRange(vehicleLanes.Take(2)); var carLanes = new List <NetInfo.Lane>(); carLanes.AddRange(vehicleLanes.Skip(2)); for (var i = 0; i < bikeLanes.Count; i++) { bikeLanes[i].m_vehicleType = VehicleInfo.VehicleType.Bicycle; bikeLanes[i].m_position = ((i * 2) - 1) * bikeLanePosAbs; bikeLanes[i].m_width = bikeLaneWidth; bikeLanes[i].m_verticalOffset = -0.15f; bikeLanes[i].m_direction = bikeLanes[i].m_position > 0 ? NetInfo.Direction.Forward : NetInfo.Direction.Backward; bikeLanes[i].m_speedLimit = 0.8f; bikeLanes[i].m_stopType = VehicleInfo.VehicleType.None; var tempProps = bikeLanes[i].m_laneProps.m_props.ToList(); tempProps.RemoveProps("arrow"); bikeLanes[i].m_laneProps.m_props = tempProps.ToArray(); } for (int i = 0; i < carLanes.Count; i++) { carLanes[i].m_verticalOffset = 0.05f; var position = ((i * 2) - 1) * sVehicleLanePosAbs; var niLane = new ExtendedNetInfoLane(carLanes[i], ExtendedVehicleType.ServiceVehicles | ExtendedVehicleType.CargoTruck | ExtendedVehicleType.SnowTruck) { m_position = position, m_width = sVehicleLaneWidth, m_verticalOffset = 0.05f, m_direction = position > 0 ? NetInfo.Direction.Forward : NetInfo.Direction.Backward }; carLanes[i] = niLane; var tempProps = carLanes[i].m_laneProps.m_props.ToList(); tempProps.RemoveProps("arrow", "limit"); carLanes[i].m_laneProps.m_props = tempProps.ToArray(); } var pedLanes = new List <NetInfo.Lane>(); pedLanes.AddRange(info.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian).OrderBy(l => l.m_position)); foreach (var lane in vehicleLanes) { var laneProps = lane.m_laneProps.m_props.ToList(); laneProps.RemoveProps("arrow", "manhole"); lane.m_laneProps.m_props = laneProps.ToArray(); } for (int i = 0; i < pedLanes.Count; i++) { pedLanes[i].m_position = ((i * 2) - 1) * 5; pedLanes[i].m_width = 6; var tempProps = pedLanes[i].m_laneProps.m_props.ToList(); tempProps.RemoveProps("bus", "random", "limit"); var tempPropProps = tempProps.Where(tp => tp.m_prop != null); if (tempPropProps.Any(tp => tp.m_prop.name.ToLower().IndexOf("street light", StringComparison.Ordinal) != -1)) { tempProps.ReplacePropInfo(new KeyValuePair <string, PropInfo>("street light", Prefabs.Find <PropInfo>("StreetLamp02"))); var lightProp = tempProps.First(tp => tp.m_prop.name == "StreetLamp02"); lightProp.m_repeatDistance = 80; lightProp.m_segmentOffset = i; lightProp.m_probability = 100; lightProp.m_position.x = ((i * 2) - 1) * -2.5f; } else { var lightProp = new NetLaneProps.Prop() { m_prop = Prefabs.Find <PropInfo>("StreetLamp02").ShallowClone(), m_repeatDistance = 80, m_segmentOffset = i, m_probability = 100 }; lightProp.m_position.x = ((i * 2) - 1) * -2.5f; tempProps.Add(lightProp); } if (version == NetInfoVersion.Ground) { var treeProp = new NetLaneProps.Prop() { m_tree = Prefabs.Find <TreeInfo>("Tree2variant"), m_repeatDistance = 30, m_probability = 100, }; treeProp.m_position.x = ((i * 2) - 1) * 1.4f; tempProps.Add(treeProp); } if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge) { var benchProp1 = new NetLaneProps.Prop() { m_prop = Prefabs.Find <PropInfo>("High Bench"), m_repeatDistance = 80, m_segmentOffset = (i - 1) * -0.5f, m_probability = 100, m_angle = 90 + (i * 180) }; benchProp1.m_position.x = ((i * 2) - 1) * 1.8f; tempProps.Add(benchProp1); } pedLanes[i].m_laneProps.m_props = tempProps.ToArray(); } var laneCollection = new List <NetInfo.Lane>(); laneCollection.AddRange(bikeLanes); laneCollection.AddRange(carLanes); laneCollection.AddRange(pedLanes); info.m_lanes = laneCollection.ToArray(); /////////////////////////// // AI // /////////////////////////// var pedestrianVanilla = Prefabs.Find <NetInfo>(NetInfos.Vanilla.PED_PAVEMENT); switch (version) { case NetInfoVersion.Ground: { var vanillaplayerNetAI = pedestrianVanilla.GetComponent <PlayerNetAI>(); var playerNetAI = info.GetComponent <PlayerNetAI>(); if (playerNetAI != null) { playerNetAI.m_constructionCost = vanillaplayerNetAI.m_constructionCost * 2; playerNetAI.m_maintenanceCost = vanillaplayerNetAI.m_maintenanceCost * 2; } } break; } var roadBaseAI = info.GetComponent <RoadBaseAI>(); if (roadBaseAI != null) { roadBaseAI.m_trafficLights = false; roadBaseAI.m_noiseAccumulation = 3; roadBaseAI.m_noiseRadius = 30; } var roadAI = info.GetComponent <RoadAI>(); if (roadAI != null) { roadAI.m_enableZoning = true; } }
public void BuildUp(NetInfo info, NetInfoVersion version) { /////////////////////////// // Template // /////////////////////////// var basicRoadInfo = ToolsCSL.FindPrefab<NetInfo>("Basic Road"); /////////////////////////// // 3DModeling // /////////////////////////// // NOTE: Lets dont go there yet, since we will need Segment, Bus stop, transition and transition bus stop meshes. // Otherwise, we will be forced to unsupport the bus stops on the Small Avenue, which will cause crash on people allready using it with bus stops. //if (version == NetInfoVersion.Ground) //{ // info.m_surfaceLevel = 0; // info.m_class = basicRoadInfo.m_class.Clone("SmallAvenue"); // var segments0 = info.m_segments[0]; // var nodes0 = info.m_nodes[0]; // var grndMesh = SmallAvenue4LMeshes.GetGroundData().CreateMesh("SMALLROAD_4L_GROUND"); // segments0.m_mesh = grndMesh; // nodes0.m_mesh = grndMesh; //} /////////////////////////// // Texturing // /////////////////////////// switch (version) { case NetInfoVersion.Ground: info.SetSegmentsTexture( new TexturesSet (@"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__MainTex.png", @"NewNetwork\SmallAvenue4L\Textures\Ground_Segment__AlphaMap.png")); break; } /////////////////////////// // Set up // /////////////////////////// info.m_hasParkingSpaces = false; // Setting up lanes var vehicleLaneTypes = new[] { NetInfo.LaneType.Vehicle, NetInfo.LaneType.PublicTransport, NetInfo.LaneType.CargoVehicle, NetInfo.LaneType.TransportVehicle }; var vehicleLanes = info.m_lanes .Where(l => l.m_laneType.HasFlag(NetInfo.LaneType.Parking) || vehicleLaneTypes.Contains(l.m_laneType)) .OrderBy(l => l.m_position) .ToArray(); for (int i = 0; i < vehicleLanes.Length; i++) { var lane = vehicleLanes[i]; if (lane.m_laneType.HasFlag(NetInfo.LaneType.Parking)) { int closestVehicleLaneId; if (i - 1 >= 0 && vehicleLaneTypes.Contains(vehicleLanes[i - 1].m_laneType)) { closestVehicleLaneId = i - 1; } else if (i + 1 < vehicleLanes.Length && vehicleLaneTypes.Contains(vehicleLanes[i + 1].m_laneType)) { closestVehicleLaneId = i + 1; } else { continue; // Not supposed to happen } var closestVehicleLane = vehicleLanes[closestVehicleLaneId]; SetLane(lane, closestVehicleLane); if (lane.m_position < 0) { lane.m_position += 0.3f; } else { lane.m_position -= 0.3f; } } else { if (lane.m_position < 0) { lane.m_position += 0.2f; } else { lane.m_position -= 0.2f; } } } if (version == NetInfoVersion.Ground) { var brPlayerNetAI = basicRoadInfo.GetComponent<PlayerNetAI>(); var playerNetAI = info.GetComponent<PlayerNetAI>(); if (brPlayerNetAI != null && playerNetAI != null) { playerNetAI.m_constructionCost = brPlayerNetAI.m_constructionCost * 12 / 10; // 20% increase playerNetAI.m_maintenanceCost = brPlayerNetAI.m_maintenanceCost * 12 / 10; // 20% increase } } else // Same as the original basic road specs { } // Should we put traffic lights? //var roadBaseAI = info.GetComponent<RoadBaseAI>(); //if (roadBaseAI != null) //{ // roadBaseAI.m_trafficLights = true; //} }