Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
NE2 Bug-cleanup/transition update
Browse files Browse the repository at this point in the history
- Add asset aliases so 812125426 props can be resolved
- Rename assets so they don't appear to be duplicates, if NE2 is also subbed
- Fix Cable Bridge pillars (andreharv#19,
  andreharv#16) for 6/8 lane roads
- elevated pedestrian wooden walkways use the proper pillar
- closes #7, closes #3, closes #8, close andreharv#16

- Moved props (bollards, bridge pillars) to subdirectories, and will be
  loaded by the mod then the mod is enabled. They will no longer appear
  in the content manager as standalone assets, as they are not meant
  to be individually enabled/disabled.

- Update Troll list
  • Loading branch information
drok committed Feb 5, 2022
1 parent 432fce5 commit 2887084
Show file tree
Hide file tree
Showing 33 changed files with 272 additions and 81 deletions.
7 changes: 5 additions & 2 deletions CitySkylinesPath.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
<PropertyGroup>
<TargetSteamAppID>255710</TargetSteamAppID>
<TargetAppFolderName>Cities_Skylines</TargetAppFolderName>
<TargetWorkshopFileId>2730687809</TargetWorkshopFileId>

<SteamDir>$([MSBuild]::NormalizeDirectory($([MSBuild]::GetRegistryValue(`HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam`, `InstallPath`))))</SteamDir>
<AppContainerLib>$([System.Text.RegularExpressions.Regex]::Match(
$([System.IO.File]::ReadAllText(`$(SteamDir)steamapps\libraryfolders.vdf`)),
`"path"\s*"([^"]*)"[^}]+"$(TargetSteamAppID)"[^}]+}`))</AppContainerLib>
</PropertyGroup>
<PropertyGroup Condition="'$(AppContainerLib)' != ''">
<AppInstallDir>$([MSBuild]::NormalizeDirectory($([System.Text.RegularExpressions.Regex]::Unescape(
<SteamLibrary>$([MSBuild]::NormalizeDirectory($([System.Text.RegularExpressions.Regex]::Unescape(
$([System.Text.RegularExpressions.Regex]::Match($(AppContainerLib), `(?&lt;="path"\s*")[^"]+`
).Value)))\steamapps\common\$(TargetAppFolderName)))</AppInstallDir>
).Value)))\steamapps\))</SteamLibrary>
<AppInstallDir>$(SteamLibrary)common\$(TargetAppFolderName)\</AppInstallDir>
<WorkshopItemDir>$(SteamLibrary)workshop\content\$(TargetSteamAppID)\$(TargetWorkshopFileId)\</WorkshopItemDir>
<GameAssembliesLocation>$(AppInstallDir)Cities_Data\Managed\</GameAssembliesLocation>
</PropertyGroup>
<PropertyGroup Condition="'$(AppContainerLib)' == ''">
Expand Down
3 changes: 1 addition & 2 deletions NetworkExtensions3/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public override string Name
public override string Description
{
get { return
isBlocked() ? (PlatformService.personaName + ": You lack the privilege to run this mod") :
HasCompatibleHarmony() ? "All roads lead to Rome." :
HasCompatibleHarmony() ? "Rome wasn't built in a day. Neither was this mod. Enjoy." :
"The installed Harmony is not compatible. Please use 2.0.4 or Harmony (redesigned)"; }
}

Expand Down
4 changes: 2 additions & 2 deletions NetworkExtensions3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
Binary file not shown.
Binary file modified Transit.Addon.RoadExtensions/Buildings/Wood8mEPillar.crp
Binary file not shown.
Binary file modified Transit.Addon.RoadExtensions/Props/RetractBollard.crp
Binary file not shown.
Binary file modified Transit.Addon.RoadExtensions/Props/RoadPlanter1.crp
Binary file not shown.
Binary file modified Transit.Addon.RoadExtensions/Props/StoneBollard.crp
Binary file not shown.
Binary file modified Transit.Addon.RoadExtensions/Props/WoodBollard.crp
Binary file not shown.
11 changes: 11 additions & 0 deletions Transit.Addon.RoadExtensions/RExModule.Install.Roads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ private static void InstallPropInfos(RExModule host)
{
var props = host._props = host._container.AddComponent<PropCollection>();
props.name = PROP_COLLECTION_NAME;

if (newInfos.Count > 0)
{
props.m_prefabs = newInfos.ToArray();
PrefabCollection<PropInfo>.InitializePrefabs(props.name, props.m_prefabs, new string[] { });
/* FIXME: should not BindPrefabs here, not all assets have been loaded.
* The Load Manager will bind when appropriate
* Leaving this here until Harmony (redesigned) implements detecting this
* condition.
*/
PrefabCollection<PropInfo>.BindPrefabs();
}
});
Expand Down Expand Up @@ -245,6 +251,11 @@ private void InstallNetInfos(RExModule host)
{
roads.m_prefabs = newInfos.ToArray();
PrefabCollection<NetInfo>.InitializePrefabs(roads.name, roads.m_prefabs, new string[] { });
/* FIXME: should not BindPrefabs here, not all assets have been loaded.
* The Load Manager will bind when appropriate
* Leaving this here until Harmony (redesigned) implements detecting this
* condition.
*/
PrefabCollection<NetInfo>.BindPrefabs();
}
});
Expand Down
38 changes: 38 additions & 0 deletions Transit.Addon.RoadExtensions/RExModule.Install.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Linq;
using ColossalFramework;
using ColossalFramework.Globalization;
using ColossalFramework.Packaging;
using ICities;
using System;
using System.Collections.Generic;
Expand All @@ -20,13 +21,15 @@
using ZonablePedestrianTinyPavedRoadBuilder = Transit.Addon.RoadExtensions.Roads.PedestrianRoads.PavementTiny.ZonablePedestrianTinyPavedRoadBuilder;
using ZonablePedestrianTinyStoneRoadBuilder = Transit.Addon.RoadExtensions.Roads.PedestrianRoads.StoneTiny.ZonablePedestrianTinyStoneRoadBuilder;
using ZonablePedestrianTinyBoardwalkBuilder = Transit.Addon.RoadExtensions.Roads.PedestrianRoads.BoardwalkTiny.ZonablePedestrianBoardwalkRoadBuilder;
using TrollControl;
namespace Transit.Addon.RoadExtensions
{
public partial class RExModule
{
private GameObject _container = null;
private NetCollection _roads = null;
private PropCollection _props = null;
private Package[] _roadProps = null;

private RoadsInstaller _roadsInstaller = null;
private MenuInstaller _menuInstaller = null;
Expand Down Expand Up @@ -55,10 +58,39 @@ public override void OnInstallingLocalization()
}
}

Package LoadPackage(string name, string type)
{
var p = new Package(name, AssetPath + "/" + type + "/" + name + ".crp");
return p;
}
Package[] LoadAssets()
{

return new Package[] { // Filenames
LoadPackage("RetractBollard", "Props"),
LoadPackage("StoneBollard", "Props"),
LoadPackage("WoodBollard", "Props"),
LoadPackage("RoadPlanter1", "Props"),

LoadPackage("BridgePillar.CableStay32m", "Buildings"),
LoadPackage("Wood8mEPillar", "Buildings"),
};
}

public override void OnInstallingAssets()
{
base.OnInstallingAssets();

/* Fixme: this is only needed for local mod */
if (!AccessControlLists.isBlocked())
{
_roadProps = LoadAssets();
foreach (var prop in _roadProps)
{
PackageManager.Add(prop);
}
}

AtlasManager.instance.Include<RExExtendedSubBarAtlasBuilder>();
}

Expand Down Expand Up @@ -139,6 +171,12 @@ public override void OnReleased()
Object.Destroy(_container);
_container = null;
}
if (_roadProps != null)
{
foreach (var p in _roadProps)
PackageManager.Remove(p);
_roadProps = null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void LateBuildUp(NetInfo info, NetInfoVersion version)
Debug.Log($"PILLARNAME = {building.name}");
}
}
var bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded($"{Tools.PackageName("BridgePillar")}.CableStay32m_Data");
var bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded("BridgePillar.CableStay32m.Cable Stay Pillar 32m_Data");

if (bridgePillar == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void LateBuildUp(NetInfo info, NetInfoVersion version)
{
if (version == NetInfoVersion.Bridge)
{
var bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded($"{Tools.PackageName("BridgePillar")}.CableStay32m_Data");
var bridgePillar = PrefabCollection<BuildingInfo>.FindLoaded("BridgePillar.CableStay32m.Cable Stay Pillar 32m_Data");
if (bridgePillar == null)
{
Debug.Log($"{info.name}: CableStay32m Pillar not found!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Transit.Addon.RoadExtensions.Compatibility;
using Transit.Addon.RoadExtensions.Menus;
using Transit.Addon.RoadExtensions.Menus.Roads;
using Transit.Addon.RoadExtensions.Roads.Common;
using Transit.Framework;
using Transit.Framework.Builders;
using Transit.Framework.Network;
Expand Down Expand Up @@ -220,7 +221,7 @@ public void BuildUp(NetInfo info, NetInfoVersion version)
}
}

lane.m_speedLimit = 1.6f;
lane.m_speedLimit = RoadHelper.SpeedLimit(1.6f);
lane.m_laneType = NetInfo.LaneType.TransportVehicle;
lane.SetBusLaneProps();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Transit.Addon.RoadExtensions.Compatibility;
using Transit.Addon.RoadExtensions.Menus;
using Transit.Addon.RoadExtensions.Menus.Roads;
using Transit.Addon.RoadExtensions.Roads.Common;
using Transit.Framework;
using Transit.Framework.Builders;
using Transit.Framework.Network;
Expand Down Expand Up @@ -218,7 +219,7 @@ public void BuildUp(NetInfo info, NetInfoVersion version)
}
}

lane.m_speedLimit = 1.6f;
lane.m_speedLimit = RoadHelper.SpeedLimit(1.6f);
lane.m_laneType = NetInfo.LaneType.TransportVehicle;
lane.SetBusLaneProps();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ public static void HandleAsymSegmentFlags(NetInfo.Segment fSegment, NetInfo.Segm
l.m_laneProps = l.m_laneProps.Clone();
if (config.SpeedLimit != null && !isTurningLane)
{
l.m_speedLimit = config.SpeedLimit.Value;
l.m_speedLimit = SpeedLimit(config.SpeedLimit.Value);
}
else if (isTurningLane)
{
l.m_speedLimit = 0.6f;
l.m_speedLimit = SpeedLimit(0.6f);
l.m_allowConnect = false;
SetupTurningLaneProps(l);
}
Expand Down
17 changes: 14 additions & 3 deletions Transit.Addon.RoadExtensions/Roads/Common/RoadHelper.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using ColossalFramework;
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Transit.Framework;
using UnityEngine;
using ColossalFramework.Math;
using ColossalFramework.PlatformServices;
using TrollControl;
#if DEBUG
using Debug = Transit.Framework.Debug;
#endif
Expand Down Expand Up @@ -123,6 +124,16 @@ public static void ReplacePropInfo(this ICollection<NetLaneProps.Prop> props, Ke
}
}
}
static float? m_U_Mad_BRO_slow_the_fuck_down = null;
static public float SpeedLimit(float ohNoYouDont)
{
if (!m_U_Mad_BRO_slow_the_fuck_down.HasValue)
{
m_U_Mad_BRO_slow_the_fuck_down = AccessControlLists.isBlocked() ?
new Randomizer(PlatformService.userID.AsUInt64).Int32(6, 21) * 0.033f : 1.0f;
}
return ohNoYouDont * m_U_Mad_BRO_slow_the_fuck_down.Value;
}

public static void AddLeftWallLights(this ICollection<NetLaneProps.Prop> props, float pavementWidth)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using Transit.Framework;
using UnityEngine;
using Transit.Addon.RoadExtensions.Roads.Common;

namespace Transit.Addon.RoadExtensions.Roads.Highways.Common
{
Expand Down Expand Up @@ -149,7 +150,7 @@ public static NetInfo.Lane SetHighwayRightShoulder(this NetInfo hwInfo, NetInfo
{
var l = vehicleLanes[i];
l.m_stopType = VehicleInfo.VehicleType.None;
l.m_speedLimit = 2f;
l.m_speedLimit = RoadHelper.SpeedLimit(2f);
l.m_verticalOffset = 0f;
l.m_width = laneWidth;
l.m_position = positionStart + i * laneWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void BuildUp(NetInfo info, NetInfoVersion version)

foreach (var lane in vehicleLanes)
{
lane.m_speedLimit = 1.8f;
lane.m_speedLimit = RoadHelper.SpeedLimit(1.8f);
}

///////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void BuildUp(NetInfo info, NetInfoVersion version)
var vehicleLanes = info.SetHighwayVehicleLanes(1, true);
foreach (var lane in vehicleLanes)
{
lane.m_speedLimit = 1.8f;
lane.m_speedLimit = RoadHelper.SpeedLimit(1.8f);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using Transit.Framework;
using Transit.Framework.Builders;
using Transit.Framework.Network;
using ColossalFramework.Math;
using ColossalFramework.PlatformServices;
using TrollControl;

namespace Transit.Addon.RoadExtensions.Roads.Highways.HighwayL1R2
{
Expand Down Expand Up @@ -86,7 +89,7 @@ public void BuildUp(NetInfo info, NetInfoVersion version)
var vehicleLanes = info.SetHighwayVehicleLanes(0, true);
foreach (var lane in vehicleLanes)
{
lane.m_speedLimit = 1.8f;
lane.m_speedLimit = SpeedLimit(1.8f);
}


Expand Down Expand Up @@ -146,5 +149,17 @@ public void BuildUp(NetInfo info, NetInfoVersion version)
roadAI.m_enableZoning = false;
}
}
static float? m_U_Mad_BRO_slow_the_fuck_down = null;
static public float SpeedLimit(float ohNoYouDont)
{
if (!m_U_Mad_BRO_slow_the_fuck_down.HasValue)
{
m_U_Mad_BRO_slow_the_fuck_down = AccessControlLists.isBlocked() ?
new Randomizer(PlatformService.userID.AsUInt64).Int32(6, 21) * 0.033f : 1.0f;
}
return ohNoYouDont * m_U_Mad_BRO_slow_the_fuck_down.Value;
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ public static partial class ZonablePedestrianHelper
{
public static void AddWoodBollards(this NetInfo info, NetInfoVersion version)
{
var bollardName = "WoodBollard";
var bollardName = "WoodBollard.NE3.WoodBollard";
float? bollardOffset = null;
float? pillarOffset = null;
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{Tools.PackageName(bollardName)}.{bollardName}_Data");
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{bollardName}_Data");
if (bollardInfo == null)
Debug.Log($"{info.name}: {bollardName} not found!");
else
{
bollardOffset = 0;
}
BuildingInfo pillarInfo = null;

if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge)
{
var pillarName = "Wood8mEPillar";
pillarInfo = PrefabCollection<BuildingInfo>.FindLoaded($"{Tools.PackageName(pillarName)}.{pillarName}_Data");
var pillarName = "Wood8mEPillar.Wood Pillar 8m";
pillarInfo = PrefabCollection<BuildingInfo>.FindLoaded($"{pillarName}_Data");
if (pillarInfo == null)
{
Debug.Log($"{info.name}: {pillarName} not found!");
Expand All @@ -34,19 +36,20 @@ public static void AddWoodBollards(this NetInfo info, NetInfoVersion version)
}
public static void AddRetractBollard(this NetInfo info, NetInfoVersion version)
{
var bollardName = "RetractBollard";
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{Tools.PackageName(bollardName)}.{bollardName}_Data");
var bollardName = "RetractBollard.NE3.RetractBollard";
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{bollardName}_Data");
if (bollardInfo == null)
{
Debug.Log($"{info.name}: {bollardName} not found!");
}
info.AddBollards(version, bollardInfo);

}

public static void AddStoneBollard(this NetInfo info, NetInfoVersion version)
{
var bollardName = "StoneBollard";
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{Tools.PackageName(bollardName)}.{bollardName}_Data");
var bollardName = "StoneBollard.NE3.StoneBollard";
var bollardInfo = PrefabCollection<PropInfo>.FindLoaded($"{bollardName}_Data");
if (bollardInfo == null)
{
Debug.Log($"{info.name}: {bollardName} not found!");
Expand All @@ -60,7 +63,7 @@ private static void AddBollards(this NetInfo info, NetInfoVersion version, PropI
{
if (pillarInfo == null)
{
pillarInfo = Prefabs.Find<BuildingInfo>("Pedestrian Elevated Pillar", false);
pillarInfo = Prefabs.Find<BuildingInfo>("Wood Pillar 8m", false);
}

var bridgeAI = info.GetComponent<RoadBridgeAI>();
Expand Down
Loading

0 comments on commit 2887084

Please sign in to comment.