private static NetInfo BuildVersion(this INetInfoBuilder builder, NetInfoVersion version, Action<NetInfo> assign, ICollection<NetInfo> holdingCollection)
        {
            if (builder.SupportedVersions.HasFlag(version))
            {
                var completePrefabName = builder.GetPrefabName(version);
                var completeName = builder.GetNewName(version);

                var info = ToolsCSL
                    .FindPrefab<NetInfo>(completePrefabName)
                    .Clone(completeName);

                info.SetUICategory(builder.UICategory);
                builder.BuildUp(info, version);

                if (assign != null)
                {
                    assign(info);
                }

                holdingCollection.Add(info);

                return info;
            }
            else
            {
                if (assign != null)
                {
                    assign(null);
                }
            }

            return null;
        }
        public static NetInfo Setup8m2mSWMesh(this NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
                case NetInfoVersion.Ground:
                    { 
                        var segments0 = info.m_segments[0];
                        var nodes0 = info.m_nodes[0];

                        segments0
                            .SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Common\Meshes\8m\2mSW\Ground.obj",
                             @"Roads\Common\Meshes\8m\2mSW\Ground_LOD.obj");

                        nodes0
                            .SetMeshes
                            (@"Roads\Common\Meshes\8m\2mSW\Ground_Node.obj",
                             @"Roads\Common\Meshes\8m\2mSW\Ground_Node_LOD.obj");

                        info.m_segments = new[] { segments0 };
                        info.m_nodes = new[] { nodes0 };
                        break;
                    }
            }
            return info;
        }
        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;
            }
        }
        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);
        }
 public static void AddStoneBollard(this NetInfo info, NetInfoVersion version)
 {
     var bollardName = "StoneBollard";
     var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"478820060.{bollardName}_Data");
     if (bollardInfo == null)
     {
         bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{bollardName}.{bollardName}_Data");
     }
     info.AddBollards(version, bollardInfo);
 }
        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)
            {
            }
        }
예제 #7
0
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            case NetInfoVersion.GroundGrass:
            case NetInfoVersion.GroundTrees:
                var suffix = version.ToString().Substring(6).Length > 0 ? "Grass" : "Concrete";
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment{suffix}__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__MainTex.png",
                        $@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment{suffix}_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                        @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));


                foreach (var node in info.m_nodes)
                {
                    if (node.m_flagsForbidden == NetNode.Flags.Transition)
                    {
                        info.m_nodes[0].SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_Simple__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_Simple__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                    }
                    else if (node.m_flagsRequired == NetNode.Flags.Transition)
                    {
                        node.SetTextures(
                            new TextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__MainTex.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Node_LOD__APRMap.png",
                                @"Roads\Avenues\LargeAvenue8LSideParking\Textures\Ground_Segment_LOD__XYSMap.png"));
                    }
                }
                break;
            }
        }
 public static string GetBuiltPrefabName(this INetInfoBuilder builder, NetInfoVersion version)
 {
     if (builder is INetInfoSpecificNameBuilder)
     {
         return(((INetInfoSpecificNameBuilder)builder).GetSpecificBuiltPrefabName(version));
     }
     else
     {
         return(NetInfos.New.GetPrefabName(builder.Name, version));
     }
 }
 public static string GetBasedPrefabName(this INetInfoBuilder builder, NetInfoVersion version)
 {
     if (builder is INetInfoSpecificBaseBuilder)
     {
         return(((INetInfoSpecificBaseBuilder)builder).GetSpecificBasedPrefabName(version));
     }
     else
     {
         return(NetInfos.Vanilla.GetPrefabName(builder.BasedPrefabName, version));
     }
 }
        private static string GetNewName(this INetInfoBuilder builder, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                return(builder.Name);

            default:
                return(builder.Name + " " + version);
            }
        }
        private static string GetNewName(this INetInfoBuilder builder, NetInfoVersion version)
        {
            switch (version)
            {
                case NetInfoVersion.Ground:
                    return builder.Name;

                default:
                    return builder.Name + " " + version;
            }
        }
 public static string GetBasedPrefabName(this INetInfoBuilder builder, NetInfoVersion version)
 {
     if (builder is INetInfoSpecificBaseBuilder)
     {
         return ((INetInfoSpecificBaseBuilder) builder).GetSpecificBasedPrefabName(version);
     }
     else
     {
         return NetInfos.Vanilla.GetPrefabName(builder.BasedPrefabName, version);
     }
 }
 public static string GetBuiltPrefabName(this INetInfoBuilder builder, NetInfoVersion version)
 {
     if (builder is INetInfoSpecificNameBuilder)
     {
         return ((INetInfoSpecificNameBuilder)builder).GetSpecificBuiltPrefabName(version);
     }
     else
     {
         return NetInfos.New.GetPrefabName(builder.Name, version);
     }
 }
        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)
            {
            }
        }
예제 #15
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;
            }
        }
예제 #16
0
            public static string GetPrefabName(string groundName, NetInfoVersion version)
            {
                switch (groundName)
                {
                case ROAD_2L:
                case ROAD_6L:

                case AVENUE_4L:

                case ONEWAY_2L:

                case HIGHWAY_3L:
                    switch (version)
                    {
                    case NetInfoVersion.Ground:
                        return(groundName);

                    case NetInfoVersion.Elevated:
                    case NetInfoVersion.Bridge:
                    case NetInfoVersion.Tunnel:
                    case NetInfoVersion.Slope:
                        return(groundName + " " + version);

                    default:
                        throw new NotImplementedException();
                    }

                case ONEWAY_6L:
                    switch (version)
                    {
                    case NetInfoVersion.Ground:
                        return(groundName);

                    case NetInfoVersion.Elevated:
                        return(groundName + " " + NetInfoVersion.Elevated);

                    case NetInfoVersion.Bridge:
                        return(groundName + " " + NetInfoVersion.Bridge);

                    case NetInfoVersion.Tunnel:
                        return(groundName + " Road Tunnel");

                    case NetInfoVersion.Slope:
                        return(groundName + " Road Slope");

                    default:
                        throw new NotImplementedException();
                    }

                default:
                    throw new NotImplementedException();
                }
            }
예제 #17
0
        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;
            }
        }
예제 #18
0
        public override void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup6m1WMesh(version);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            info.Setup6m1WTextures(version);
            base.BuildUp(info, version);
        }
        public static void SetupTrackProps(NetInfo prefab, NetInfoVersion version)
        {
            if (version == NetInfoVersion.Tunnel)
            {
                var lanes    = prefab.m_lanes.ToList();
                var propLane = new NetInfo.Lane();
                propLane.m_laneProps      = ScriptableObject.CreateInstance <NetLaneProps>();
                propLane.m_laneProps.name = "LightLane";
                var propsList   = new List <NetLaneProps.Prop>();
                var thePropInfo = PrefabCollection <PropInfo> .FindLoaded("Tunnel Light Small Road").ShallowClone();

                thePropInfo.SetAsTunnelLightProp(1, 20);
                Debug.Log("We are in here with " + prefab.name);
                if (prefab.name.Contains("Steel"))
                {
                    if (prefab.name.Contains("Large"))
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-9.5f, 6, 0), 270, 60);
                        propsList.AddBasicProp(thePropInfo, new Vector3(9.5f, 6, 0), 90, 60);
                    }
                    else if (prefab.name.Contains("Small"))
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-3.5f, 6, 0), 270, 60);
                    }
                    else
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-5.5f, 6, 0), 270, 60);
                    }
                }
                else
                {
                    if (prefab.name.Contains("Large"))
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-7.5f, 6, 0), 270, 60);
                        propsList.AddBasicProp(thePropInfo, new Vector3(7.5f, 6, 0), 90, 60);
                    }
                    else if (prefab.name.Contains("Small"))
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-1.5f, 5.5f, 0), 270, 60);
                    }
                    else
                    {
                        propsList.AddBasicProp(thePropInfo, new Vector3(-3.5f, 6, 0), 270, 60);
                    }
                }

                propLane.m_laneProps.m_props = propsList.ToArray();
                lanes.Add(propLane);
                prefab.m_lanes = lanes.ToArray();
            }
        }
        public static NetInfo SetRoadLanes(this NetInfo rdInfo, NetInfoVersion version, LanesConfiguration config)
        {
            if (config.LanesToAdd < 0)
            {
                var remainingLanes = new List <NetInfo.Lane>();
                remainingLanes.AddRange(rdInfo
                                        .m_lanes
                                        .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian || l.m_laneType == NetInfo.LaneType.None || l.m_laneType == NetInfo.LaneType.Parking));
                remainingLanes.AddRange(rdInfo
                                        .m_lanes
                                        .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian && l.m_laneType != NetInfo.LaneType.None && l.m_laneType != NetInfo.LaneType.Parking)
                                        .Skip(-config.LanesToAdd));

                rdInfo.m_lanes = remainingLanes.ToArray();
            }
            else if (config.LanesToAdd > 0)
            {
                var sourceLane = rdInfo.m_lanes.First(l => l.m_laneType != NetInfo.LaneType.None && l.m_laneType != NetInfo.LaneType.Parking && l.m_laneType != NetInfo.LaneType.Pedestrian);
                var tempLanes  = rdInfo.m_lanes.ToList();

                for (var i = 0; i < config.LanesToAdd; i++)
                {
                    var newLane = sourceLane.CloneWithoutStops();
                    tempLanes.Add(newLane);
                }

                rdInfo.m_lanes = tempLanes.ToArray();
            }

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

            laneCollection.AddRange(rdInfo.SetupVehicleLanes(version, config));
            laneCollection.AddRange(rdInfo.SetupPedestrianLanes(version, config));

            if (rdInfo.m_hasParkingSpaces)
            {
                laneCollection.AddRange(rdInfo.SetupParkingLanes());
            }

            var medianLane = rdInfo.m_lanes.FirstOrDefault(l => l.m_laneType == NetInfo.LaneType.None && l.m_position == 0);

            if (config.CenterLane == CenterLaneType.Median && medianLane != null)
            {
                medianLane = medianLane.SetupMedianLane(config, version);
                laneCollection.Add(medianLane);
            }

            rdInfo.m_lanes = laneCollection.OrderBy(l => l.m_position).ToArray();

            return(rdInfo);
        }
        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;
            }
        }
예제 #22
0
        public void LateBuildUp(NetInfo info, NetInfoVersion version)
        {
            var stoneBollard = PrefabCollection <PropInfo> .FindLoaded("478820060.StoneBollard_Data");

            if (stoneBollard == null)
            {
                stoneBollard = PrefabCollection <PropInfo> .FindLoaded("StoneBollard.StoneBollard_Data");
            }

            if (stoneBollard == null)
            {
                return;
            }

            var pedLanes = info.m_lanes.Where(pl => pl.m_laneType == NetInfo.LaneType.Pedestrian).ToArray();

            for (var i = 0; i < pedLanes.Length; i++)
            {
                var bollardProp = new NetLaneProps.Prop()
                {
                    m_prop             = stoneBollard,
                    m_finalProp        = stoneBollard,
                    m_probability      = 100,
                    m_segmentOffset    = 1,
                    m_minLength        = 10,
                    m_endFlagsRequired = NetNode.Flags.Transition
                };
                bollardProp.m_position.x = ((i * 2) - 1) * -3f;
                bollardProp.m_position.y = -0.3f;

                var bollardProp2 = bollardProp.ShallowClone();
                bollardProp2.m_segmentOffset      = -1;
                bollardProp2.m_endFlagsRequired   = NetNode.Flags.None;
                bollardProp2.m_startFlagsRequired = NetNode.Flags.Transition;

                var bollardProp3 = bollardProp.ShallowClone();
                bollardProp3.m_position.x = ((i * 2) - 1);

                var bollardProp4 = bollardProp2.ShallowClone();
                bollardProp4.m_position.x         = ((i * 2) - 1);
                bollardProp2.m_endFlagsRequired   = NetNode.Flags.None;
                bollardProp2.m_startFlagsRequired = NetNode.Flags.Transition;

                var bollardProps = new List <NetLaneProps.Prop> {
                    bollardProp, bollardProp2, bollardProp3, bollardProp4
                };
                var tempProps = pedLanes[i].m_laneProps.m_props.ToList();
                tempProps.AddRange(bollardProps);
                pedLanes[i].m_laneProps.m_props = tempProps.ToArray();
            }
        }
        public static NetInfo SetRoadLanes(this NetInfo rdInfo, NetInfoVersion version, LanesConfiguration config)
        {
            if (config.LanesToAdd < 0)
            {
                var remainingLanes = new List<NetInfo.Lane>();
                remainingLanes.AddRange(rdInfo
                    .m_lanes
                    .Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian || l.m_laneType == NetInfo.LaneType.None || l.m_laneType == NetInfo.LaneType.Parking));
                remainingLanes.AddRange(rdInfo
                    .m_lanes
                    .Where(l => l.m_laneType != NetInfo.LaneType.Pedestrian && l.m_laneType != NetInfo.LaneType.None && l.m_laneType != NetInfo.LaneType.Parking)
                    .Skip(-config.LanesToAdd));

                rdInfo.m_lanes = remainingLanes.ToArray();
            }
            else if (config.LanesToAdd > 0)
            {
                var sourceLane = rdInfo.m_lanes.First(l => l.m_laneType != NetInfo.LaneType.None && l.m_laneType != NetInfo.LaneType.Parking && l.m_laneType != NetInfo.LaneType.Pedestrian);
                var tempLanes = rdInfo.m_lanes.ToList();

                for (var i = 0; i < config.LanesToAdd; i++)
                {
                    var newLane = sourceLane.CloneWithoutStops();
                    tempLanes.Add(newLane);
                }

                rdInfo.m_lanes = tempLanes.ToArray();
            }

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

            laneCollection.AddRange(rdInfo.SetupVehicleLanes(version, config));
            laneCollection.AddRange(rdInfo.SetupPedestrianLanes(version, config));

            if (rdInfo.m_hasParkingSpaces)
            {
                laneCollection.AddRange(rdInfo.SetupParkingLanes());
            }

            var medianLane = rdInfo.m_lanes.FirstOrDefault(l => l.m_laneType == NetInfo.LaneType.None && l.m_position == 0);
            if (config.CenterLane == CenterLaneType.Median && medianLane != null)
            {
                medianLane = medianLane.SetupMedianLane(config, version);
                laneCollection.Add(medianLane);
            }

            rdInfo.m_lanes = laneCollection.OrderBy(l => l.m_position).ToArray();

            return rdInfo;
        }
        public string GetSpecificBuiltPrefabName(NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                return("Zonable Pedestrian Pavement");

            case NetInfoVersion.Elevated:
                return("Zonable Pedestrian Elevated");    // T++ Legacy name

            default:
                throw new ArgumentOutOfRangeException(nameof(version), version, null);
            }
        }
예제 #25
0
 public static void MakePedestrianLanesNarrow(NetInfo prefab, NetInfoVersion version)
 {
     if (version == NetInfoVersion.Tunnel)
     {
         if (prefab?.m_lanes == null)
         {
             return;
         }
         foreach (var lane in prefab.m_lanes.Where(lane => lane != null && lane.m_laneType == NetInfo.LaneType.Pedestrian))
         {
             lane.m_width    = 2;
             lane.m_position = Math.Sign(lane.m_position) * (4 + .5f * lane.m_width);
         }
     }
 }
예제 #26
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;
            }
        }
        public static void SetupElevatedBoardWalkTextures(this NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Elevated:
                info.SetAllSegmentsTexture(
                    new TextureSet(
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__MainTex.png",
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__AlphaMap.png",
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__XYSMap.png"),
                    new LODTextureSet(
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__MainTex.png",
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__AlphaMap.png",
                        @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__XYSMap.png")
                    );

                foreach (var node in info.m_nodes)
                {
                    if (node.m_flagsRequired != NetNode.Flags.Transition)
                    {
                        node.SetTextures(
                            new TextureSet(
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__MainTex.png",
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__AlphaMap.png",
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment__XYSMap.png"),
                            new LODTextureSet(
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__MainTex.png",
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__AlphaMap.png",
                                @"Roads\PedestrianRoads\BoardWalkTiny\Textures\Elevated_Segment_LOD__XYSMap.png")
                            );
                    }
                    else
                    {
                        node.SetTextures(
                            new TextureSet
                                (@"Roads\PedestrianRoads\Common\Textures\Elevated_Trans__MainTex.png",
                                @"Roads\Common\Textures\Plain\Elevated_Trans__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\PedestrianRoads\Common\Textures\Elevated_Trans_LOD__MainTex.png",
                                @"Roads\PedestrianRoads\Common\Textures\Elevated_Trans_LOD__AlphaMap.png",
                                @"Roads\Common\Textures\Plain\Elevated_Segment_LOD__XYSMap.png")
                            );
                    }
                }
                break;
            }
        }
예제 #28
0
        public override void BuildUp(NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // 3DModeling            //
            ///////////////////////////
            info.Setup6m2WMesh(version);

            ///////////////////////////
            // Texturing             //
            ///////////////////////////
            info.Setup6m2WTextures(version);
            base.BuildUp(info, version);

            var railLane = info.m_lanes.FirstOrDefault(l => l.m_laneType == NetInfo.LaneType.Vehicle);

            railLane.m_direction = NetInfo.Direction.AvoidBackward | NetInfo.Direction.AvoidForward;
        }
        public static void SetupStationProps(NetInfo prefab, NetInfoVersion version)
        {
            if (version == NetInfoVersion.Tunnel)
            {
                var propLanes = prefab.m_lanes.Where(l => l.m_laneType == NetInfo.LaneType.Pedestrian).ToList();
                foreach (NetInfo.Lane t in propLanes)
                {
                    t.m_laneProps = ScriptableObject.CreateInstance <NetLaneProps>();
                    var propsList   = new List <NetLaneProps.Prop>();
                    var thePropInfo = PrefabCollection <PropInfo> .FindLoaded($"{Util.PackageName($"BP_flurotube_light_3")}.flurotube_light_3_Data");

                    thePropInfo.SetAsTunnelLightProp(3, 18);
                    propsList.AddBasicProp(thePropInfo, new Vector3(0, 5.8f, 0), 0, 20);
                    t.m_laneProps.m_props = propsList.ToArray();
                }
            }
        }
예제 #30
0
            public static string GetPrefabName(string groundName, NetInfoVersion version)
            {
                switch (groundName)
                {
                    case ROAD_2L:
                    case ROAD_6L:

                    case AVENUE_4L:

                    case ONEWAY_2L:

                    case HIGHWAY_3L:
                        switch (version)
                        {
                            case NetInfoVersion.Ground:
                                return groundName;
                            case NetInfoVersion.Elevated:
                            case NetInfoVersion.Bridge:
                            case NetInfoVersion.Tunnel:
                            case NetInfoVersion.Slope:
                                return groundName + " " + version;
                            default:
                                throw new NotImplementedException();
                        }

                    case ONEWAY_6L:
                        switch (version)
                        {
                            case NetInfoVersion.Ground:
                                return groundName;
                            case NetInfoVersion.Elevated:
                                return groundName + " " + NetInfoVersion.Elevated;
                            case NetInfoVersion.Bridge:
                                return groundName + " " + NetInfoVersion.Bridge;
                            case NetInfoVersion.Tunnel:
                                return groundName + " Road Tunnel";
                            case NetInfoVersion.Slope:
                                return groundName + " Road Slope";
                            default:
                                throw new NotImplementedException();
                        }

                    default:
                        throw new NotImplementedException();
                }
            }
        public static NetInfo Setup8m1p5mSW1SMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var nodes0    = info.m_nodes[0].ShallowClone();
                var nodes1    = info.m_nodes[0].ShallowClone();
                var nodes2    = info.m_nodes[0].ShallowClone();
                segments0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_LOD.obj");

                nodes0
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");

                nodes1
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node2.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");
                nodes2
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node3.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj");

                if (laneStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                nodes1.m_directConnect = true;
                nodes1.m_connectGroup  = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayStart | NetInfo.ConnectGroup.OnewayEnd;
                nodes2.m_directConnect = true;
                nodes2.m_connectGroup  = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayEnd;
                info.m_segments        = new[] { segments0 };
                info.m_nodes           = new[] { nodes0, nodes1 };
                break;
            }
            }
            return(info);
        }
예제 #32
0
        public static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            var aprPathPrefix = (RoadColorChanger.IsPluginActive ? RoadColorChanger.GetTexturePrefix() : string.Empty);

            switch (version)
            {
            case NetInfoVersion.Slope:
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Highways\Highway3L\Textures\Slope_Segment__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\Slope_Segment_Open__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Highways\Highway3L\Textures\Slope_SegmentLOD__MainTex.png",
                        @"Roads\Highways\Highway3L\Textures\Slope_SegmentLOD__APRMap.png",
                        @"Roads\Highways\Highway3L\Textures\Slope_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Highways\Highway3L\Textures\Slope_Node__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\Ground_Node__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Highways\Highway3L\Textures\Ground_NodeLOD__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\Ground_NodeLOD__APRMap.png",
                        @"Roads\Highways\Highway3L\Textures\Ground_LOD__XYSMap.png"));
                break;

            case NetInfoVersion.Tunnel:
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (@"Roads\Highways\Highway3L\Textures\Tunnel_Segment__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\Tunnel" + (RoadColorChanger.IsPluginActive ? "_Segment" : "") + "__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Highways\Highway3L\Textures\Tunnel_SegmentLOD__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\TunnelLOD__APRMap.png",
                        @"Roads\Highways\Highway3L\Textures\Slope_LOD__XYSMap.png"));
                info.SetAllNodesTexture(
                    new TextureSet
                        (@"Roads\Highways\Highway3L\Textures\Tunnel_Node__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\Tunnel" + (RoadColorChanger.IsPluginActive ? "_Node" : "") + "__APRMap.png"),
                    new LODTextureSet
                        (@"Roads\Highways\Highway3L\Textures\Tunnel_NodeLOD__MainTex.png",
                        aprPathPrefix + @"Roads\Highways\Highway3L\Textures\TunnelLOD__APRMap.png",
                        @"Roads\Highways\Highway3L\Textures\Slope_LOD__XYSMap.png"));
                break;
            }
        }
        public static void CommonConcreteCustomization(NetInfo prefab, NetInfoVersion version)
        {
            if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge)
            {
                prefab.m_class.m_level = ItemClass.Level.Level1;
            }
            else
            {
                prefab.m_class.m_level = ItemClass.Level.Level2;
            }
            var lanes    = prefab.m_lanes.ToList();
            var propLane = new NetInfo.Lane();

            propLane.m_laneType  = NetInfo.LaneType.None;
            propLane.m_laneProps = ScriptableObject.CreateInstance <NetLaneProps>();
            lanes.Add(propLane);
            prefab.m_lanes = lanes.ToArray();
        }
 public void LateBuildUp(NetInfo info, NetInfoVersion version)
 {
     //var RoadPlanter1Name = "RoadPlanter1";
     //var RoadPlanter1 = PrefabCollection<PropInfo>.FindLoaded($"{Tools.PackageName(RoadPlanter1Name)}.{RoadPlanter1Name}_Data");
     //var pedLanes = info.m_lanes.Where(pl => pl.m_laneType == NetInfo.LaneType.Pedestrian).ToArray();
     //for (var i = 0; i < pedLanes.Length; i++)
     //{
     //    var planterProp = new NetLaneProps.Prop();
     //    planterProp.m_prop = RoadPlanter1;
     //    planterProp.m_finalProp = RoadPlanter1;
     //    planterProp.m_repeatDistance = 30;
     //    planterProp.m_probability = 100;
     //    planterProp.m_position = new UnityEngine.Vector3(((i * 2) - 1), 0.05f, -0.15f);
     //    var tempProps = pedLanes[i].m_laneProps.m_props.ToList();
     //    tempProps.Add(planterProp);
     //    pedLanes[i].m_laneProps.m_props = tempProps.ToArray();
     //}
 }
 public string GetPrefabName(NetInfoVersion version)
 {
     switch (version)
     {
         case NetInfoVersion.Ground:
             return PrefabName;
         case NetInfoVersion.Elevated:
             return PrefabName + " " + NetInfoVersion.Elevated;
         case NetInfoVersion.Bridge:
             return PrefabName + " " + NetInfoVersion.Bridge;
         case NetInfoVersion.Tunnel:
             return PrefabName + " Road Tunnel";
         case NetInfoVersion.Slope:
             return PrefabName + " Road Slope";
         default:
             throw new NotImplementedException();
     }
 }
        public static void SetupGroundNakedTextures(this NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
                case NetInfoVersion.Ground:
                    info.SetAllSegmentsTexture(
                        new TextureSet(
                            @"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png",
                            @"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
                        new LODTextureSet(
                            @"Roads\Common\Textures\Plain\Ground_Segment_LOD__AlphaMap.png",
                            @"Roads\Common\Textures\Plain\Ground_Segment_LOD__AlphaMap.png",
                            @"Roads\Common\Textures\Plain\Ground_Node_LOD__XYSMap.png"));

                    foreach (var node in info.m_nodes)
                    {
                        if (node.m_flagsRequired != NetNode.Flags.Transition)
                        {
                            node.SetTextures(
                                new TextureSet
                                    (@"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png",
                                     @"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
                                new LODTextureSet
                                    (@"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__MainTex.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__AlphaMap.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__XYSMap.png"));
                        }
                        else
                        {
                            node.SetTextures(
                                new TextureSet
                                    (@"Roads\PedestrianRoads\Common\Textures\Ground_Trans__MainTex.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Trans__AlphaMap.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__XYSMap.png"),
                            new LODTextureSet
                                    (@"Roads\PedestrianRoads\Common\Textures\Ground_Trans_LOD__MainTex.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Trans_LOD__AlphaMap.png",
                                     @"Roads\PedestrianRoads\Common\Textures\Ground_Node_LOD__XYSMap.png"));
                        }
                    }
                    break;
            }
        }
예제 #37
0
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                info.SetAllSegmentsTexture(
                    new TextureSet
                        (null,
                        @"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
                    new LODTextureSet
                        (@"Roads\Common\Textures\Plain\Ground_Segment_LOD__MainTex.png",
                        @"Roads\Common\Textures\Plain\Ground_Segment_LOD__AlphaMap.png",
                        @"Roads\Common\Textures\Plain\Ground_Segment_LOD__XYSMap.png"));

                foreach (var node in info.m_nodes)
                {
                    if (node.m_flagsRequired == NetNode.Flags.Transition)
                    {
                        node.SetTextures(
                            new TextureSet
                                (null,
                                @"Roads\Common\Textures\Plain\Ground_Trans__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\Common\Textures\Plain\Ground_Trans_LOD__MainTex.png",
                                @"Roads\Common\Textures\Plain\Ground_Trans_LOD__AlphaMap.png",
                                @"Roads\Common\Textures\Plain\Ground_Trans_LOD__XYSMap.png"));
                    }
                    else
                    {
                        node.SetTextures(
                            new TextureSet
                                (null,
                                @"Roads\Common\Textures\Plain\Ground_Segment__AlphaMap.png"),
                            new LODTextureSet
                                (@"Roads\Common\Textures\Plain\Ground_Node_LOD__MainTex.png",
                                @"Roads\Common\Textures\Plain\Ground_Node_LOD__AlphaMap.png",
                                @"Roads\Common\Textures\Plain\Ground_Node_LOD__XYSMap.png"));
                    }
                }
                break;
            }
        }
        public static void SetLargeIslandTrackWidths(NetInfo prefab, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                prefab.m_halfWidth     = 15.5f;
                prefab.m_pavementWidth = 1.5f;
                break;

            case NetInfoVersion.Elevated:
                prefab.m_halfWidth     = 15.5f;
                prefab.m_pavementWidth = 1.5f;
                break;

            case NetInfoVersion.Tunnel:
                prefab.m_halfWidth     = 16.5f;
                prefab.m_pavementWidth = 2.5f;
                break;
            }
        }
        public static void SetLargeStationTrackWidths(NetInfo prefab, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                prefab.m_halfWidth     = 9;
                prefab.m_pavementWidth = 2f;
                break;

            case NetInfoVersion.Elevated:
                prefab.m_halfWidth     = prefab.name.Contains("Steel") ? 9.0001f : 9; //Todo make proper enum for the styles
                prefab.m_pavementWidth = 1.5f;
                break;

            case NetInfoVersion.Tunnel:
                prefab.m_halfWidth     = 12;
                prefab.m_pavementWidth = 4.5f;
                break;
            }
        }
        public static void SetSmallStationTrackWidths(NetInfo prefab, NetInfoVersion version)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
                prefab.m_halfWidth     = 3;
                prefab.m_pavementWidth = 1.5f;
                break;

            case NetInfoVersion.Elevated:
                prefab.m_halfWidth     = 3;
                prefab.m_pavementWidth = 1.5f;
                break;

            case NetInfoVersion.Tunnel:
                prefab.m_halfWidth     = 6f;
                prefab.m_pavementWidth = 4.5f;
                break;
            }
        }
예제 #41
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);
        }
예제 #42
0
        public static NetInfo.Lane SetHighwayLeftShoulder(this NetInfo hwInfo, NetInfo hwInfoTemplate, NetInfoVersion version)
        {
            var leftHwLaneTemplate = hwInfoTemplate.m_lanes.First(l => l.m_laneType == NetInfo.LaneType.None);
            var leftHwLane = hwInfo.m_lanes.First(l => l.m_laneType == NetInfo.LaneType.None);

            leftHwLane.m_laneProps = leftHwLaneTemplate.m_laneProps.Clone("Highway Left Props");

            leftHwLane.m_width = 2;
            leftHwLane.m_position = hwInfo.m_halfWidth - leftHwLane.m_width;
            leftHwLane.m_position = -leftHwLane.m_position;

            // Default props position
            switch (version)
            {
                case NetInfoVersion.Ground:
                    foreach (var prop in leftHwLane.m_laneProps.m_props)
                    {
                        prop.m_position.x = -1f;
                    }
                    break;

                case NetInfoVersion.Elevated:
                case NetInfoVersion.Bridge:
                    foreach (var prop in leftHwLane.m_laneProps.m_props)
                    {
                        prop.m_position.x = -0.6f;
                    }
                    break;

                case NetInfoVersion.Slope:
                case NetInfoVersion.Tunnel:
                    foreach (var prop in leftHwLane.m_laneProps.m_props)
                    {
                        prop.m_position.x = 1f;
                    }
                    break;
            }

            return leftHwLane;
        }
예제 #43
0
        public static NetInfo Setup8m1p5mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical)
        {
            switch (version)
            {
            case NetInfoVersion.Ground:
            {
                var segments0 = info.m_segments[0].ShallowClone();
                var nodes0    = info.m_nodes[0].ShallowClone();
                var nodes1    = info.m_nodes[0].ShallowClone();

                segments0
                .SetFlagsDefault()
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_LOD.obj");

                nodes0
                .SetFlags(NetNode.Flags.None, NetNode.Flags.Transition)
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Node.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj");

                nodes1
                .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None)
                .SetMeshes
                    (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Trans.obj",
                    @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj");

                if (laneStyle != LanesLayoutStyle.Symmetrical)
                {
                    RoadHelper.HandleAsymSegmentFlags(segments0);
                }

                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;
            }
        }
        public static void AddWoodBollards(this NetInfo info, NetInfoVersion version)
        {
            var bollardName = "WoodBollard";
            var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"478820060.{bollardName}_Data");
            if (bollardInfo == null)
            {
                bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{bollardName}.{bollardName}_Data");
            }

            BuildingInfo pillarInfo = null;
            if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge)
            {
                var pillarName = "Wood8mEPillar";
                pillarInfo = PrefabCollection<BuildingInfo>.FindLoaded($"478820060.{pillarName}_Data");
                if (pillarInfo == null)
                {
                    pillarInfo = PrefabCollection<BuildingInfo>.FindLoaded($"{pillarName}.{pillarName}_Data");
                }
            }

            info.AddBollards(version, bollardInfo, pillarInfo);
        }
        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 NetInfo BuildVersion(this INetInfoBuilder builder, NetInfoVersion version, ICollection<NetInfo> holdingCollection)
        {
            if (builder.SupportedVersions.HasFlag(version))
            {
                var completePrefabName = NetInfos.Vanilla.GetPrefabName(builder.TemplatePrefabName, version);
                var completeName = builder.GetNewName(version);

                var info = Prefabs
                    .Find<NetInfo>(completePrefabName)
                    .Clone(completeName);

                info.SetUICategory(builder.UICategory);
                builder.BuildUp(info, version);

                holdingCollection.Add(info);

                return info;
            }
            else
            {
                return null;
            }
        }
        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 static void Setup16mMesh(this NetInfo info, NetInfoVersion version)
        {
            ///////////////////////////
            // Template              //
            ///////////////////////////
            var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L);
            var defaultMaterial = highwayInfo.m_nodes[0].m_material;

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

                        segments0
                            .SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Ground.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_LOD.obj");

                        nodes0
                            .SetFlags(NetNode.Flags.None, NetNode.Flags.Transition)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Ground_Node.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Node_LOD.obj");

                        nodes1
                            .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Ground_Trans.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Trans_LOD.obj");

                        info.m_segments = new[] { segments0 };
                        info.m_nodes = new[] { nodes0, nodes1 };
                    }
                    break;

                case NetInfoVersion.Elevated:
                case NetInfoVersion.Bridge:
                    {
                        var segments0 = info.m_segments[0].ShallowClone();
                        var nodes0 = info.m_nodes[0].ShallowClone();
                        var nodes1 = info.m_nodes[0].ShallowClone();

                        segments0
                            .SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Elevated.obj",
                             @"Roads\Highways\Common\Meshes\16m\Elevated_LOD.obj");

                        nodes0
                            .SetFlags(NetNode.Flags.None, NetNode.Flags.Transition)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Elevated_Node.obj",
                             @"Roads\Highways\Common\Meshes\16m\Elevated_Node_LOD.obj");

                        nodes1
                            .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Elevated_Trans.obj",
                             @"Roads\Highways\Common\Meshes\16m\Elevated_Trans_LOD.obj");

                        info.m_segments = new[] { segments0 };
                        info.m_nodes = new[] { nodes0, nodes1 };
                    }
                    break;

                case NetInfoVersion.Slope:
                    {
                        var segments0 = info.m_segments[0].ShallowClone();
                        var segments1 = info.m_segments[1].ShallowClone();
                        var segments2 = info.m_segments[1].ShallowClone();
                        var nodes0 = info.m_nodes[0].ShallowClone();
                        var nodes1 = info.m_nodes[0].ShallowClone();
                        var nodes2 = info.m_nodes[1].ShallowClone();
                        var nodes3 = info.m_nodes[1].ShallowClone();

                        segments0
                            .SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel_Gray.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_LOD.obj");
                        segments1
                            .SetFlagsDefault();
                        segments2
                            .SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Slope.obj",
                             @"Roads\Highways\Common\Meshes\16m\Slope_LOD.obj");

                        nodes0
                            .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel_Node_Gray.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Node_LOD.obj");
                        nodes1
                            .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Slope_U_Node.obj",
                             @"Roads\Highways\Common\Meshes\16m\Slope_U_Node_LOD.obj");
                        nodes2
                            .SetFlags(NetNode.Flags.None, NetNode.Flags.UndergroundTransition)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Ground_Node.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Node_LOD.obj");
                        nodes3
                            .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Ground_Trans.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Trans_LOD.obj");

                        nodes1.m_material = defaultMaterial;

                        info.m_segments = new[] { segments0, segments1, segments2 };
                        info.m_nodes = new[] { nodes0, nodes1, nodes2, nodes3 };
                    }
                    break;

                case NetInfoVersion.Tunnel:
                    {
                        var segments0 = info.m_segments[0].ShallowClone();
                        var segments1 = info.m_segments[0].ShallowClone();
                        var nodes0 = info.m_nodes[0].ShallowClone();
                        var nodes1 = info.m_nodes[0].ShallowClone();

                        segments0
                            //.SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel_Gray.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_LOD.obj");
                        segments1
                            //.SetFlagsDefault()
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel.obj",
                             @"Roads\Highways\Common\Meshes\16m\Tunnel_LOD.obj");
                        nodes0
                            .SetFlags(NetNode.Flags.None, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel_Node_Gray.obj",
                             @"Roads\Highways\Common\Meshes\16m\Ground_Node_LOD.obj");
                        nodes1
                            .SetFlags(NetNode.Flags.None, NetNode.Flags.None)
                            .SetMeshes
                            (@"Roads\Highways\Common\Meshes\16m\Tunnel_Node.obj",
                             @"Roads\Highways\Common\Meshes\16m\Tunnel_Node_LOD.obj");

                        segments1.m_material = defaultMaterial;
                        nodes1.m_material = defaultMaterial;

                        info.m_segments = new[] { segments0, segments1 };
                        info.m_nodes = new[] { nodes0, nodes1 };
                    }
                    break;
            }
        }
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            switch (version)
            {
                case NetInfoVersion.Ground:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_Segment__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_Segment__APRMap.png"),
                        new LODTextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__APRMap.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Ground_SegmentLOD__XYSMap.png"));
                    break;
                case NetInfoVersion.Elevated:
                case NetInfoVersion.Bridge:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__APRMap.png"),
                        new LODTextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__APRMap.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__XYSMap.png"));
                    break;
                    //info.SetAllNodesTexture(
                    //    new TextureSet
                    //        (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Segment__MainTex.png",
                    //        @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_Node__APRMap.png"),
                    //    new LODTextureSet
                    //        (@"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__MainTex.png",
                    //        @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_NodeLOD__APRMap.png",
                    //        @"Roads\Avenues\MediumAvenue4LTL\Textures\Elevated_SegmentLOD__XYSMap.png"));

                case NetInfoVersion.Slope:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_Segment__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_Segment__APRMap.png"),
                        new LODTextureSet
                            (@"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__MainTex.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__APRMap.png",
                            @"Roads\Avenues\MediumAvenue4LTL\Textures\Slope_SegmentLOD__XYSMap.png"));
                    foreach(var node in info.m_nodes)
                    {
                        if (node.m_mesh.name == "Slope_U_Node")
                        {
                            node.SetTextures(
                                new TextureSet
                                    (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
                                    @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Node__APRMap.png"),
                                new LODTextureSet
                                    (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
                                    @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
                                    @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
                        }
                    }
                    //info.SetAllNodesTexture(
                    //new TextureSet
                    //    (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png",
                    //    @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"),
                    //new LODTextureSet
                    //    (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png",
                    //    @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png",
                    //    @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png"));
                    break;
                case NetInfoVersion.Tunnel:
                    {
                        info.SetAllSegmentsTexture(
                            new TextureSet
                                (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
                        info.SetAllNodesTexture(
                            new TextureSet
                                (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Segment__MainTex.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_Node__APRMap.png"),
                            new LODTextureSet
                                (@"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__MainTex.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__APRMap.png",
                                @"Roads\Avenues\MediumAvenue4LTL\Textures\Tunnel_SegmentLOD__XYSMap.png"));
                        break;
                    }
            }
        }
        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();
        }
        private static void SetupTextures(NetInfo info, NetInfoVersion version)
        {
            var aprPathPrefix = (RoadColorChanger.IsPluginActive ? RoadColorChanger.GetTexturePrefix() : string.Empty);

            switch (version)
            {
                case NetInfoVersion.Ground:
                    info.SetAllSegmentsTexture(
                        new TextureSet(
                            @"Roads\Highways\Highway6L\Textures\Ground_Segment__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Segment__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Ground_SegmentLOD__XYSMap.png"));
                    info.SetAllNodesTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Ground_Node__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Node__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__XYSMap.png"));
                    break;

                case NetInfoVersion.Elevated:
                case NetInfoVersion.Bridge:
                    info.SetAllSegmentsTexture(
                        new TextureSet(
                            @"Roads\Highways\Highway6L\Textures\Elevated_Segment__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_Segment__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Elevated_SegmentLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_SegmentLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Elevated_LOD__XYSMap.png"));
                    info.SetAllNodesTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Elevated_Node__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_Node__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Elevated_NodeLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Elevated_NodeLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Elevated_LOD__XYSMap.png"));
                    break;

                case NetInfoVersion.Slope:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Slope_Segment__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Slope_Segment__APRMap.png"),
                        new LODTextureSet
                            (@"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Slope_SegmentLOD__XYSMap.png"));
                    info.SetAllNodesTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Tunnel_Node__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_Node__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Ground_NodeLOD__XYSMap.png"));
                    break;
                case NetInfoVersion.Tunnel:
                    info.SetAllSegmentsTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Tunnel_Segment__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_Segment__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__XYSMap.png"));
                    info.SetAllNodesTexture(
                        new TextureSet
                           (@"Roads\Highways\Highway6L\Textures\Tunnel_Node__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_" + (RoadColorChanger.IsPluginActive ? "Node" : "Segment") + "__APRMap.png"),
                        new LODTextureSet
                           (@"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__MainTex.png",
                            aprPathPrefix + @"Roads\Highways\Highway6L\Textures\Tunnel_SegmentLOD__APRMap.png",
                            @"Roads\Highways\Highway6L\Textures\Tunnel_NodeLOD__XYSMap.png"));
                    break;
            }
        }
        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 string GetPrefabName(NetInfoVersion version)
 {
     return PrefabName;
 }
 public void BuildUp(NetInfo info, NetInfoVersion version)
 {
     // I$|H3lls7rik3r sandbox
 }
 public void LateBuildUp(NetInfo info, NetInfoVersion version)
 {
     info.AddRetractBollard(version);
 }
        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 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;
                }
            }
        }
예제 #59
0
        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 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;
            }
        }