public static NetInfo BuildVersion(this INetInfoBuilder builder, NetInfoVersion version, ICollection <Action> lateOperations)
        {
            if (builder.SupportedVersions.HasFlag(version))
            {
                var basedPrefabName = builder.GetBasedPrefabName(version);
                var builtPrefabName = builder.GetBuiltPrefabName(version);

                var info = Prefabs
                           .Find <NetInfo>(basedPrefabName)
                           .Clone(builtPrefabName);

                builder.BuildUp(info, version);

                var lateBuilder = builder as INetInfoLateBuilder;
                if (lateBuilder != null)
                {
                    lateOperations.Add(() => lateBuilder.LateBuildUp(info, version));
                }

                return(info);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
 public static T BuildEmergencyFallback <T>(this IPrefabBuilder <T> builder)
     where T : PrefabInfo
 {
     return(Prefabs
            .Find <T>(builder.BasedPrefabName)
            .Clone(builder.Name));
 }
        public void ModifyExistingNetInfo()
        {
            var highwayRampInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_RAMP, false);

            if (highwayRampInfo != null)
            {
                highwayRampInfo.m_UIPriority = 5;
                var thumbnails = AssetManager.instance.GetThumbnails(NetInfos.Vanilla.HIGHWAY_RAMP, @"Roads\Highways\HighwayRamp\thumbnails.png");
                highwayRampInfo.m_Atlas     = thumbnails;
                highwayRampInfo.m_Thumbnail = thumbnails.name;
            }

            var highway3L = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L, false);

            if (highway3L != null)
            {
                highway3L.m_UIPriority = 30;
                var thumbnails = AssetManager.instance.GetThumbnails(NetInfos.Vanilla.HIGHWAY_3L, @"Roads\Highways\Highway3L\thumbnails.png");
                highway3L.m_Atlas     = thumbnails;
                highway3L.m_Thumbnail = thumbnails.name;
                highway3L.ModifyTitle("Three-Lane Highway");
            }

            var highway3LBarrier = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_BARRIER, false);

            if (highway3LBarrier != null)
            {
                highway3LBarrier.m_UIPriority = 35;
                var thumbnails = AssetManager.instance.GetThumbnails(NetInfos.Vanilla.HIGHWAY_3L_BARRIER, @"Roads\Highways\Highway3LBarrier\thumbnails.png");
                highway3LBarrier.m_Atlas     = thumbnails;
                highway3LBarrier.m_Thumbnail = thumbnails.name;
                highway3LBarrier.ModifyTitle("Three-Lane Highway with Sound Barrier");
            }
        }
        public static void SetBusLaneProps(this NetInfo.Lane lane)
        {
            var prop = Prefabs.Find <PropInfo>("BusLaneText", false);

            if (prop == null)
            {
                return;
            }

            if (lane.m_laneProps == null)
            {
                lane.m_laneProps         = ScriptableObject.CreateInstance <NetLaneProps>();
                lane.m_laneProps.m_props = new NetLaneProps.Prop[] { };
            }
            else
            {
                lane.m_laneProps = lane.m_laneProps.Clone();
            }

            lane.m_laneProps.m_props = lane
                                       .m_laneProps
                                       .m_props
                                       .Union(new NetLaneProps.Prop
            {
                m_prop               = prop,
                m_position           = new Vector3(0f, 0f, 7.5f),
                m_angle              = 180f,
                m_segmentOffset      = -1f,
                m_minLength          = 8f,
                m_startFlagsRequired = NetNode.Flags.Junction
            })
                                       .ToArray();
        }
        //public static IEnumerable<NetInfo> Build(this INetInfoBuilder builder, ICollection<Action> lateOperations)
        //{
        //    // Ground versions

        //    var groundInfo = builder.BuildVersion(NetInfoVersion.Ground, lateOperations);
        //    var groundGrassInfo = builder.BuildVersion(NetInfoVersion.GroundGrass, lateOperations);
        //    var groundTreesInfo = builder.BuildVersion(NetInfoVersion.GroundTrees, lateOperations);

        //    var groundInfos = new[] { groundInfo, groundGrassInfo, groundTreesInfo };
        //    groundInfos = groundInfos.Where(gi => gi != null).ToArray();

        //    if (!groundInfos.Any())
        //    {
        //        yield break;
        //    }

        //    // Other versions
        //    var elevatedInfo = builder.BuildVersion(NetInfoVersion.Elevated, lateOperations);
        //    var bridgeInfo = builder.BuildVersion(NetInfoVersion.Bridge, lateOperations);
        //    var tunnelInfo = builder.BuildVersion(NetInfoVersion.Tunnel, lateOperations);
        //    var slopeInfo = builder.BuildVersion(NetInfoVersion.Slope, lateOperations);

        //    // Setup MenuItems
        //    var swMb = new Stopwatch();
        //    swMb.Start();
        //    if (builder is IMenuItemBuilder)
        //    {
        //        if (groundInfos.Count() > 1)
        //        {
        //            throw new Exception("Multiple netinfo menuitem cannot be build with the IMenuItemBuilder, use the IMenuItemBuildersProvider");
        //        }

        //        var mib = builder as IMenuItemBuilder;
        //        groundInfos[0].SetMenuItemConfig(mib);
        //    }
        //    else if (builder is IMenuItemBuildersProvider)
        //    {
        //        var mibp = builder as IMenuItemBuildersProvider;
        //        var mibs = mibp.MenuItemBuilders.ToDictionary(x => x.Name, StringComparer.InvariantCultureIgnoreCase);

        //        foreach (var mainInfo in groundInfos)
        //        {
        //            if (mibs.ContainsKey(mainInfo.name))
        //            {
        //                var mib = mibs[mainInfo.name];
        //                mainInfo.SetMenuItemConfig(mib);
        //            }
        //        }
        //    }
        //    else
        //    {
        //        throw new Exception("Cannot set the menuitem on netinfo, either implement IMenuItemBuilder or IMenuItemBuildersProvider");
        //    }
        //    swMb.Stop();
        //    Debug.Log($"{builder.Name} menu item built in {swMb.ElapsedMilliseconds}");
        //    // Setup AI
        //    foreach (var mainInfo in groundInfos)
        //    {
        //        var ai = mainInfo.GetComponent<RoadAI>();

        //        ai.m_elevatedInfo = elevatedInfo;
        //        ai.m_bridgeInfo = bridgeInfo;
        //        ai.m_tunnelInfo = tunnelInfo;
        //        ai.m_slopeInfo = slopeInfo;
        //    }

        //    // Returning
        //    foreach (var mainInfo in groundInfos)
        //    {
        //        yield return mainInfo;
        //    }
        //    if (elevatedInfo != null) yield return elevatedInfo;
        //    if (bridgeInfo != null) yield return bridgeInfo;
        //    if (tunnelInfo != null) yield return tunnelInfo;
        //    if (slopeInfo != null) yield return slopeInfo;
        //}

        public static NetInfo BuildVersion(this INetInfoBuilder builder, NetInfoVersion version, ICollection <Action> lateOperations)
        {
            if (builder.SupportedVersions.HasFlag(version))
            {
                var sw = new Stopwatch();
                var basedPrefabName = builder.GetBasedPrefabName(version);
                var builtPrefabName = builder.GetBuiltPrefabName(version);

                sw.Start();
                var info = Prefabs
                           .Find <NetInfo>(basedPrefabName)
                           .Clone(builtPrefabName);
                sw.Stop();
                Debug.Log($"cloned {builder.BasedPrefabName} as {builder.Name} in {sw.ElapsedMilliseconds}");
                builder.BuildUp(info, version);

                var lateBuilder = builder as INetInfoLateBuilder;
                if (lateBuilder != null)
                {
                    var swl = new Stopwatch();
                    swl.Start();
                    lateOperations.Add(() => lateBuilder.LateBuildUp(info, version));
                    swl.Stop();
                    Debug.Log($"cloned {builder.BasedPrefabName} in {swl.ElapsedMilliseconds}");
                }

                return(info);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        public static void TrimNonHighwayProps(this NetInfo info, bool removeRightStreetLights = false, bool removeLeftStreetLights = true)
        {
            var randomProp    = Prefabs.Find <PropInfo>("Random Street Prop", false);
            var streetLight   = Prefabs.Find <PropInfo>("New Street Light", false);
            var streetLightHw = Prefabs.Find <PropInfo>("New Street Light Highway", false);
            var manhole       = Prefabs.Find <PropInfo>("Manhole", false);

            foreach (var laneProps in info.m_lanes.Select(l => l.m_laneProps).Where(lpi => lpi != null))
            {
                var remainingProp = new List <NetLaneProps.Prop>();

                foreach (var prop in laneProps.m_props.Where(p => p.m_prop != null))
                {
                    if (prop.m_prop == randomProp)
                    {
                        continue;
                    }

                    if (prop.m_prop == manhole)
                    {
                        continue;
                    }

                    if (removeLeftStreetLights)
                    {
                        if (prop.m_prop == streetLight &&
                            laneProps.name.Contains("Left"))
                        {
                            continue;
                        }

                        if (prop.m_prop == streetLightHw &&
                            laneProps.name.Contains("Left"))
                        {
                            continue;
                        }
                    }

                    if (removeRightStreetLights)
                    {
                        if (prop.m_prop == streetLight &&
                            laneProps.name.Contains("Right"))
                        {
                            continue;
                        }

                        if (prop.m_prop == streetLightHw &&
                            laneProps.name.Contains("Right"))
                        {
                            continue;
                        }
                    }

                    remainingProp.Add(prop);
                }

                laneProps.m_props = remainingProp.ToArray();
            }
        }
        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;
                    }
                }
            }
        }
        private static NetInfo BuildEmergencyFallbackVersion(this INetInfoBuilder builder, NetInfoVersion version)
        {
            var basedPrefabName = builder.GetBasedPrefabName(version);
            var builtPrefabName = builder.GetBuiltPrefabName(version);

            return(Prefabs
                   .Find <NetInfo>(basedPrefabName)
                   .Clone(builtPrefabName));
        }
Esempio n. 10
0
        public void ModifyExistingNetInfo()
        {
            var avenue4L = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_4L, false);

            if (avenue4L != null)
            {
                avenue4L.ModifyTitle("Four-Lane Road with Median");
            }
        }
        public void ModifyExistingNetInfo()
        {
            var gravelRoadInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_2L_GRAVEL, false);

            if (gravelRoadInfo != null)
            {
                gravelRoadInfo.SetUICategory(RExExtendedMenus.ROADS_TINY);
                gravelRoadInfo.m_UIPriority = 0;
            }
        }
        public void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            var railVersionName = SharedHelpers.NameBuilder(SharedHelpers.TRAIN_TRACK, version);
            var railInfo        = Prefabs.Find <NetInfo>(railVersionName);

            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup10mMesh(version);

            ///////////////////////////
            // Set up                //
            ///////////////////////////
            info.m_class     = railInfo.m_class.Clone("APT" + railVersionName);
            info.m_halfWidth = 4.999f;

            //if (version == NetInfoVersion.Tunnel)
            //{
            //    info.m_setVehicleFlags = Vehicle.Flags.Transition;
            //    info.m_setCitizenFlags = CitizenInstance.Flags.Transition;
            //}

            var lanes = new List <NetInfo.Lane>();

            lanes.AddRange(info.m_lanes.ToList());
            for (int i = 0; i < lanes.Count; i++)
            {
                if (lanes[i].m_direction == NetInfo.Direction.Backward)
                {
                    lanes[i].m_direction = NetInfo.Direction.Forward;
                }
            }
            info.m_lanes             = lanes.ToArray();
            info.m_connectGroup      = NetInfo.ConnectGroup.WideTram;
            info.m_nodeConnectGroups = NetInfo.ConnectGroup.WideTram | NetInfo.ConnectGroup.DoubleTrain | NetInfo.ConnectGroup.TrainStation;
            //var railInfos = new List<NetInfo>();
            //railInfos.Add(railInfo);
            //railInfos.Add(Prefabs.Find<NetInfo>(NetInfos.Vanilla.TRAIN_STATION_TRACK, false));
            //railInfos.Add(Prefabs.Find<NetInfo>("Train Cargo Track", false));
            //for (int i = 0; i < railInfos.Count; i++)
            //{
            //    var ri = railInfos[i];
            //    //info.m_nodes[1].m_connectGroup = (NetInfo.ConnectGroup)9;
            //    ri.m_connectGroup = NetInfo.ConnectGroup.DoubleTrain;
            //    railInfo.m_nodeConnectGroups = NetInfo.ConnectGroup.DoubleTrain;
            //    if (railInfo.m_nodes.Length > 1)
            //    {
            //        railInfo.m_nodes[1].m_connectGroup = NetInfo.ConnectGroup.DoubleTrain;
            //    }

            //}
        }
Esempio n. 13
0
        private static NetLaneProps.Prop GetHighwayLight(this IEnumerable <NetLaneProps.Prop> props)
        {
            var streetLightPropInfo = Prefabs.Find <PropInfo>("New Street Light Highway", false);

            if (streetLightPropInfo == null)
            {
                return(null);
            }

            return(props.FirstOrDefault(prop => prop.m_prop == streetLightPropInfo));
        }
Esempio n. 14
0
        public static T Build <T>(this IPrefabBuilder <T> builder)
            where T : PrefabInfo
        {
            var info = Prefabs
                       .Find <T>(builder.BasedPrefabName)
                       .Clone(builder.Name);

            builder.BuildUp(info);

            return(info);
        }
        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)
            {
            }
        }
Esempio n. 16
0
        public static void SetupNewSpeedLimitProps(this NetInfo info, int newSpeedLimit, int oldSpeedLimit)
        {
            var newSpeedLimitPI = Prefabs.Find <PropInfo>(newSpeedLimit + " Speed Limit", false);
            var oldSpeedLimitPI = Prefabs.Find <PropInfo>(oldSpeedLimit + " Speed Limit", false);

            if (newSpeedLimitPI == null || oldSpeedLimitPI == null)
            {
                return;
            }

            info.ReplaceProps(newSpeedLimitPI, oldSpeedLimitPI);
        }
        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)
            {
            }
        }
Esempio n. 18
0
        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;
            }
        }
Esempio n. 19
0
        public static void AddRightWallLights(this ICollection <NetLaneProps.Prop> props, int xPos = 0)
        {
            var wallLightPropInfo = Prefabs.Find <PropInfo>("Wall Light Orange");
            var wallLightProp     = new NetLaneProps.Prop();

            wallLightProp.m_prop           = wallLightPropInfo.ShallowClone();
            wallLightProp.m_probability    = 100;
            wallLightProp.m_repeatDistance = 20;
            wallLightProp.m_segmentOffset  = 0;
            wallLightProp.m_angle          = 90;
            wallLightProp.m_position       = new Vector3(xPos, 1.5f, 0);
            props.Add(wallLightProp);
        }
Esempio n. 20
0
        public static void AddLeftWallLights(this ICollection <NetLaneProps.Prop> props, float pavementWidth)
        {
            var wallLightPropInfo = Prefabs.Find <PropInfo>("Wall Light Orange");
            var wallLightProp     = new NetLaneProps.Prop();
            var wallPropXPos      = (pavementWidth - 3) * -0.5f;

            wallLightProp.m_prop           = wallLightPropInfo.ShallowClone();
            wallLightProp.m_probability    = 100;
            wallLightProp.m_repeatDistance = 20;
            wallLightProp.m_segmentOffset  = 0;
            wallLightProp.m_angle          = 270;
            wallLightProp.m_position       = new Vector3(wallPropXPos, 1.5f, 0);
            props.Add(wallLightProp);
        }
Esempio n. 21
0
        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;
            }
        }
Esempio n. 22
0
        public static void SetHighwaySignsSlope(this ICollection <NetLaneProps.Prop> props)
        {
            var speedLimit   = Prefabs.Find <PropInfo>("100 Speed Limit");
            var motorwaySign = Prefabs.Find <PropInfo>("Motorway Sign");

            foreach (var p in props)
            {
                if (p.m_prop == speedLimit)
                {
                    p.m_position = new Vector3(0f, 1f, 10f);
                }

                if (p.m_prop == motorwaySign)
                {
                    p.m_position = new Vector3(0f, 1f, 1f);
                }
            }
        }
Esempio n. 23
0
        public static void ModifyExistingIcons()
        {
            if (modified)
            {
                return;
            }
            var rail2L = Prefabs.Find <NetInfo>(SharedHelpers.TRAIN_TRACK, false);

            if (rail2L != null)
            {
                rail2L.m_UIPriority = 12;
                var thumbnails = AssetManager.instance.GetThumbnails(SharedHelpers.TRAIN_TRACK, @"Textures\Rail2L\thumbnails.png");
                rail2L.m_Atlas     = thumbnails;
                rail2L.m_Thumbnail = thumbnails.name;
                rail2L.ModifyTitle("Two Lane Two-Way Rail");
                modified = true;
            }
        }
Esempio n. 24
0
        public static NetInfo Setup32m3mSW2x3mMdnMesh(this NetInfo info, NetInfoVersion version)
        {
            var highwayInfo     = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_6L);
            var slopeInfo       = Prefabs.Find <NetInfo>(NetInfos.Vanilla.ROAD_4L_SLOPE);
            var defaultMaterial = highwayInfo.m_nodes[0].m_material;

            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
            {
                var segments0 = info.m_segments[0];
                var nodes0    = info.m_nodes[0];

                segments0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\32m\3mSW2x3mMdn\Ground.obj");



                segments0.m_backwardForbidden = NetSegment.Flags.None;
                segments0.m_backwardRequired  = NetSegment.Flags.None;
                segments0.m_forwardForbidden  = NetSegment.Flags.None;
                segments0.m_forwardRequired   = NetSegment.Flags.None;



                info.m_nodes[0].SetMeshes(@"Roads\Common\Meshes\32m\3mSW2x3mMdn\Ground_Node.obj");
                var nodes1 = info.m_nodes[0].ShallowClone();
                nodes0.m_flagsForbidden = NetNode.Flags.Transition;
                nodes1.m_flagsRequired  = NetNode.Flags.Transition;

                info.m_segments = new[] { segments0 };
                info.m_nodes    = new[] { nodes0, nodes1 };
                break;
            }
            }
            return(info);
        }
        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;
            }
        }
Esempio n. 26
0
        public static void Setup50LimitProps(this NetInfo info)
        {
            var speed50 = Prefabs.Find <PropInfo>("50 Speed Limit", false);
            var speed60 = Prefabs.Find <PropInfo>("60 Speed Limit", false);

            if (speed50 == null || speed60 == null)
            {
                return;
            }

            foreach (var lane in info.m_lanes.Where(l => l.m_laneProps != null))
            {
                if (lane.m_laneProps.m_props == null ||
                    lane.m_laneProps.m_props.Length == 0)
                {
                    continue;
                }

                var speed60Prop = lane
                                  .m_laneProps
                                  .m_props
                                  .FirstOrDefault(prop => prop.m_prop == speed60);

                if (speed60Prop != null)
                {
                    var newPropsContent = new List <NetLaneProps.Prop>();
                    var speed50Prop     = speed60Prop.ShallowClone();
                    speed50Prop.m_prop      = speed50;
                    speed50Prop.m_finalProp = null;

                    newPropsContent.AddRange(lane.m_laneProps.m_props.Where(prop => prop.m_prop != speed60));
                    newPropsContent.Add(speed50Prop);

                    var newProps = ScriptableObject.CreateInstance <NetLaneProps>();
                    newProps.name    = lane.m_laneProps.name + "_clone";
                    newProps.m_props = newPropsContent.ToArray();
                    lane.m_laneProps = newProps;
                }
            }
        }
Esempio n. 27
0
        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 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;
            }
        }
        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 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;
            }
        }