-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// <copyright file="ParkPatches.cs" company="dymanoid"> | ||
// Copyright (c) dymanoid. All rights reserved. | ||
// </copyright> | ||
|
||
namespace RealTime.GameConnection.Patches | ||
{ | ||
using System.Reflection; | ||
using RealTime.CustomAI; | ||
using SkyTools.Patching; | ||
|
||
/// <summary> | ||
/// A static class that provides the patch objects for the Park Life DLC related methods. | ||
/// </summary> | ||
internal static class ParkPatches | ||
{ | ||
/// <summary>Gets the patch for the district park simulation method.</summary> | ||
public static IPatch DistrictParkSimulation { get; } = new DistrictPark_SimulationStep(); | ||
|
||
/// <summary>Gets or sets the city spare time behavior.</summary> | ||
public static ISpareTimeBehavior SpareTimeBehavior { get; set; } | ||
|
||
private sealed class DistrictPark_SimulationStep : PatchBase | ||
{ | ||
protected override MethodInfo GetMethod() | ||
{ | ||
return typeof(DistrictPark).GetMethod( | ||
"SimulationStep", | ||
BindingFlags.Instance | BindingFlags.Public, | ||
null, | ||
new[] { typeof(byte) }, | ||
new ParameterModifier[0]); | ||
} | ||
|
||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1213", Justification = "Harmony patch")] | ||
private static void Postfix(byte parkID) | ||
{ | ||
if (SpareTimeBehavior == null) | ||
{ | ||
return; | ||
} | ||
|
||
ref DistrictPark park = ref DistrictManager.instance.m_parks.m_buffer[parkID]; | ||
|
||
if (!SpareTimeBehavior.AreFireworksAllowed) | ||
{ | ||
park.m_flags &= ~DistrictPark.Flags.SpecialMode; | ||
return; | ||
} | ||
|
||
if (park.m_dayNightCount == 6 || (park.m_parkPolicies & DistrictPolicies.Park.FireworksBoost) != 0) | ||
{ | ||
park.m_flags |= DistrictPark.Flags.SpecialMode; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters