From 581646982efb06ab794739a033ef10731f6c7995 Mon Sep 17 00:00:00 2001 From: algernon-A Date: Wed, 22 Mar 2023 20:50:58 +1100 Subject: [PATCH] 1.1.4 for game version 1.16.1. --- Changelog.txt | 5 ++++- Code/Loading/AssetLoader.cs | 16 ++++++++++++++++ Code/Loading/CustomDeserializer.cs | 21 ++++++++++++++++++--- Code/Loading/LevelLoader.cs | 30 ++++++++++++++++++++++++++++++ LoadingScreenModRevisited.csproj | 2 +- 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 461eadc..94f72fc 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,7 @@ -- Add additional null checks to API +Version 1.1.4 - + +- Support game version 1.16.1 and associated DLC +- Add additional null checks to API Version 1.1.3 diff --git a/Code/Loading/AssetLoader.cs b/Code/Loading/AssetLoader.cs index b487d78..7011649 100644 --- a/Code/Loading/AssetLoader.cs +++ b/Code/Loading/AssetLoader.cs @@ -313,6 +313,22 @@ public IEnumerator LoadCustomContent() } } + if (LevelLoader.DLC(2224691u)) + { + Package.Asset asset5 = PackageManager.FindAssetByName("System." + DistrictStyle.kModderPack16StyleName); + if (asset5 != null && asset5.isEnabled) + { + DistrictStyle districtStyle = new DistrictStyle(DistrictStyle.kModderPack16StyleName, builtIn: true); + Util.InvokeVoid(Singleton.instance, "AddChildrenToBuiltinStyle", GameObject.Find("Modder Pack 16"), districtStyle, false); + if (LSMRSettings.SkipPrefabs) + { + PrefabLoader.RemoveSkippedFromStyle(districtStyle); + } + + districtStyles.Add(districtStyle); + } + } + // LSM insert. // Unload any skipped assets. if (LSMRSettings.SkipPrefabs) diff --git a/Code/Loading/CustomDeserializer.cs b/Code/Loading/CustomDeserializer.cs index 34e44c0..55509b3 100644 --- a/Code/Loading/CustomDeserializer.cs +++ b/Code/Loading/CustomDeserializer.cs @@ -530,7 +530,7 @@ internal object CustomDeserialize(Package package, Type type, PackageReader read return ReadMessageInfo(reader); case TypeVehicleInfoEffect: - return ReadVehicleInfoEffect(reader); + return ReadVehicleInfoEffect(package, reader); case TypeTransportInfo: return ReadTransportInfo(reader); @@ -1056,11 +1056,12 @@ private MessageInfo ReadMessageInfo(PackageReader reader) /// /// Deserializes a VehicleInfo.Effect. /// + /// Package to deserialize. /// PackageReader instance. /// New VehicleInfo.Effect. - private VehicleInfo.Effect ReadVehicleInfoEffect(PackageReader reader) + private VehicleInfo.Effect ReadVehicleInfoEffect(Package package, PackageReader reader) { - return new VehicleInfo.Effect + VehicleInfo.Effect effect = new VehicleInfo.Effect { m_effect = EffectCollection.FindEffect(reader.ReadString()), m_parkedFlagsForbidden = (VehicleParked.Flags)reader.ReadInt32(), @@ -1068,6 +1069,20 @@ private VehicleInfo.Effect ReadVehicleInfoEffect(PackageReader reader) m_vehicleFlagsForbidden = (Vehicle.Flags)reader.ReadInt32(), m_vehicleFlagsRequired = (Vehicle.Flags)reader.ReadInt32(), }; + + // 1.16.1. + if (package.version >= 10) + { + effect.m_vehicleFlagsForbidden2 = (Vehicle.Flags2)reader.ReadInt32(); + effect.m_vehicleFlagsRequired2 = (Vehicle.Flags2)reader.ReadInt32(); + } + else + { + effect.m_vehicleFlagsForbidden2 = 0; + effect.m_vehicleFlagsRequired2 = 0; + } + + return effect; } /// diff --git a/Code/Loading/LevelLoader.cs b/Code/Loading/LevelLoader.cs index ba02d6c..71358be 100644 --- a/Code/Loading/LevelLoader.cs +++ b/Code/Loading/LevelLoader.cs @@ -1115,6 +1115,21 @@ private static List> SetLevels() prefabScenes.Add(new KeyValuePair("Station18Prefabs", 0.01f)); } + if (DLC(2148902u)) + { + prefabScenes.Add(new KeyValuePair("Station19Prefabs", 0.01f)); + } + + if (DLC(2225940u)) + { + prefabScenes.Add(new KeyValuePair("Station20Prefabs", 0.01f)); + } + + if (DLC(2225941u)) + { + prefabScenes.Add(new KeyValuePair("Station21Prefabs", 0.01f)); + } + if (DLC(563850u)) { prefabScenes.Add(new KeyValuePair("ChinaPackPrefabs", 0.02f)); @@ -1207,6 +1222,21 @@ private static List> SetLevels() prefabScenes.Add(new KeyValuePair("ModderPack14Prefabs", 0.03f)); } + if (DLC(2224691u)) + { + prefabScenes.Add(new KeyValuePair("ModderPack16Prefabs", 0.03f)); + } + + if (DLC(2224690u)) + { + prefabScenes.Add(new KeyValuePair("ModderPack17Prefabs", 0.03f)); + } + + if (DLC(2148900u)) + { + prefabScenes.Add(new KeyValuePair("ModderPack18Prefabs", 0.03f)); + } + Package.Asset europeanStyles = PackageManager.FindAssetByName("System." + DistrictStyle.kEuropeanStyleName); if (europeanStyles != null && europeanStyles.isEnabled) { diff --git a/LoadingScreenModRevisited.csproj b/LoadingScreenModRevisited.csproj index a72edb2..428d14b 100644 --- a/LoadingScreenModRevisited.csproj +++ b/LoadingScreenModRevisited.csproj @@ -8,7 +8,7 @@ algernon,thale5 Copyright © 2016-2023 algernon, thale5 $(Title) - 1.1.3 + 1.1.4 $(MSBuildProgramFiles32)/Steam/steamapps/common/Cities_Skylines/Cities_Data/Managed $(AssemblySearchPaths);