Skip to content

Commit

Permalink
1.5.5 update: compatibility updates for game version 1.15.
Browse files Browse the repository at this point in the history
  • Loading branch information
algernon-A committed Sep 14, 2022
1 parent dcc4b07 commit 7f35f55
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
7 changes: 6 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
1.5.4.2 -
1.5.5 -

- Compatibility updates for game version 1.15


1.5.4.2 -

- Update AlgernonCommons

Expand Down
27 changes: 18 additions & 9 deletions Code/Patches/CreateZoneBlocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace ZoningAdjuster
{
using ColossalFramework;
using ColossalFramework.Math;
using HarmonyLib;
using UnityEngine;

/// <summary>
Expand Down Expand Up @@ -51,11 +50,11 @@ public static bool Prefix(ushort segment, ref NetSegment data)
Vector3 endDirection = data.m_endDirection;
if (NetSegment.IsStraight(startPosition, startDirection, endPosition, endDirection))
{
StraightZoneBlocks(info, randomizer, ref data, startNode, endNode);
StraightZoneBlocks(info, randomizer, segment, ref data, startNode, endNode);
}
else
{
CurvedZoneBlocks(info, randomizer, ref data);
CurvedZoneBlocks(info, randomizer, segment, ref data);
}
}

Expand All @@ -68,8 +67,9 @@ public static bool Prefix(ushort segment, ref NetSegment data)
/// </summary>
/// <param name="info">Network prefab.</param>
/// <param name="randomizer">Randomizer.</param>
/// <param name="segmentID">Segment ID.</param>
/// <param name="segment">Network segment.</param>
private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref NetSegment segment)
private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ushort segmentID, ref NetSegment segment)
{
#pragma warning disable IDE0018 // Inline variable declaration

Expand Down Expand Up @@ -139,6 +139,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockStartRight,
ref randomizer,
segmentID,
position3,
angle,
insideBlockRows,
Expand All @@ -150,6 +151,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockStartLeft,
ref randomizer,
segmentID,
position3,
angle,
insideBlockRows,
Expand All @@ -173,6 +175,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockEndRight,
ref randomizer,
segmentID,
position4,
angle2,
insideBlockRows,
Expand All @@ -184,6 +187,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockEndLeft,
ref randomizer,
segmentID,
position4,
angle2,
insideBlockRows,
Expand Down Expand Up @@ -239,6 +243,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockStartLeft,
ref randomizer,
segmentID,
position5,
angle3,
outsideBlockRows,
Expand All @@ -250,6 +255,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockStartRight,
ref randomizer,
segmentID,
position5,
angle3,
outsideBlockRows,
Expand All @@ -271,6 +277,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockEndLeft,
ref randomizer,
segmentID,
position6,
angle4,
outsideBlockRows,
Expand All @@ -282,6 +289,7 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
Singleton<ZoneManager>.instance.CreateBlock(
out segment.m_blockEndRight,
ref randomizer,
segmentID,
position6,
angle4,
outsideBlockRows,
Expand All @@ -297,10 +305,11 @@ private static void CurvedZoneBlocks(NetInfo info, Randomizer randomizer, ref Ne
/// </summary>
/// <param name="info">Network prefab.</param>
/// <param name="randomizer">Randomizer.</param>
/// <param name="segmentID">Segment ID.</param>
/// <param name="segment">Segment data.</param>
/// <param name="startNode">Segment start node.</param>
/// <param name="endNode">Segment end node.</param>
private static void StraightZoneBlocks(NetInfo info, Randomizer randomizer, ref NetSegment segment, NetNode startNode, NetNode endNode)
private static void StraightZoneBlocks(NetInfo info, Randomizer randomizer, ushort segmentID, ref NetSegment segment, NetNode startNode, NetNode endNode)
{
// Zoning cell size, in metres.
const float CellSize = 8f;
Expand Down Expand Up @@ -383,12 +392,12 @@ private static void StraightZoneBlocks(NetInfo info, Randomizer randomizer, ref
// Left side of road.
Vector3 leftOffset = new Vector3((startDirection.x * MaxExtent) - (startDirection.z * maxDistance), 0f, (startDirection.z * MaxExtent) + (startDirection.x * maxDistance));
Vector3 position = startPosition + leftOffset;
zoneManager.CreateBlock(out segment.m_blockStartLeft, ref randomizer, position, startAngle, segmentStartRows, distance, segment.m_buildIndex);
zoneManager.CreateBlock(out segment.m_blockStartLeft, ref randomizer, segmentID, position, startAngle, segmentStartRows, distance, segment.m_buildIndex);

// Right side of road.
Vector3 rightOffset = new Vector3((startDirection.x * (float)(segmentStartRows - 4) * CellSize) + (startDirection.z * maxDistance), 0f, (startDirection.z * (float)(segmentStartRows - 4) * CellSize) - (startDirection.x * maxDistance));
position = startPosition + rightOffset;
zoneManager.CreateBlock(out segment.m_blockStartRight, ref randomizer, position, startAngle + 3.14159274f, segmentStartRows, distance, segment.m_buildIndex);
zoneManager.CreateBlock(out segment.m_blockStartRight, ref randomizer, segmentID, position, startAngle + 3.14159274f, segmentStartRows, distance, segment.m_buildIndex);
}

// Add second group of eight (if any).
Expand All @@ -399,12 +408,12 @@ private static void StraightZoneBlocks(NetInfo info, Randomizer randomizer, ref
// Left side of road.
Vector3 leftOffset = new Vector3((endDirection.x * (((float)(segmentEndRows - 4) * CellSize) + endOffset)) + (endDirection.z * maxDistance), 0f, (endDirection.z * (((float)(segmentEndRows - 4) * CellSize) + endOffset)) - (endDirection.x * maxDistance));
Vector3 position = endPosition + leftOffset;
zoneManager.CreateBlock(out segment.m_blockEndLeft, ref randomizer, position, endAngle + 3.14159274f, segmentEndRows, distance, segment.m_buildIndex + 1u);
zoneManager.CreateBlock(out segment.m_blockEndLeft, ref randomizer, segmentID, position, endAngle + 3.14159274f, segmentEndRows, distance, segment.m_buildIndex + 1u);

// Right side of road.
Vector3 rightOffset = new Vector3((endDirection.x * (MaxExtent + endOffset)) - (endDirection.z * maxDistance), 0f, (endDirection.z * (MaxExtent + endOffset)) + (endDirection.x * maxDistance));
position = endPosition + rightOffset;
zoneManager.CreateBlock(out segment.m_blockEndRight, ref randomizer, position, endAngle, segmentEndRows, distance, segment.m_buildIndex + 1u);
zoneManager.CreateBlock(out segment.m_blockEndRight, ref randomizer, segmentID, position, endAngle, segmentEndRows, distance, segment.m_buildIndex + 1u);
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions Code/WhatsNewMessageListing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ internal class WhatsNewMessageListing
/// </summary>
internal WhatsNewMessage[] Messages => new WhatsNewMessage[]
{
new WhatsNewMessage
{
Version = new Version("1.5.5.0"),
MessagesAreKeys = true,
Messages = new string[]
{
"ZMD_155_0",
},
},
new WhatsNewMessage
{
Version = new Version("1.4.0.0"),
Expand Down
3 changes: 2 additions & 1 deletion Translations/en-EN.csv
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ LANGUAGE","English"
"ZMD_120_4","Allow negative zoning setback (move zoning closer to the road)"
"ZMD_120_5","Add zoning tool hotkey (default Alt-Z)"
"ZMD_130_0","Add adjustable zone depth"
"ZMD_140_0","Add option to disable panel button (the Unified UI button is always available)"
"ZMD_140_0","Add option to disable panel button (the Unified UI button is always available)"
"ZMD_155_0","Compatiblility with game version 1.15 (Plazas & Promenades)"
2 changes: 1 addition & 1 deletion ZoningAdjuster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net35</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>A Cities: Skylines mod.</Description>
<Version>1.5.4.2</Version>
<Version>1.5.5</Version>
<ManagedDLLPath>$(MSBuildProgramFiles32)/Steam/steamapps/common/Cities_Skylines/Cities_Data/Managed</ManagedDLLPath>
<AssemblySearchPaths>
$(AssemblySearchPaths);
Expand Down

0 comments on commit 7f35f55

Please sign in to comment.