Skip to content

Commit

Permalink
Disable restricted construction if any buildings related mod is active
Browse files Browse the repository at this point in the history
  • Loading branch information
dymanoid committed Aug 21, 2018
1 parent 419f5e2 commit 6543a08
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/RealTime/Core/Compatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace RealTime.Core
/// </summary>
internal sealed class Compatibility
{
/// <summary>The Workshop ID of the 'CitizenLifecycleRebalance' mod.</summary>
public const ulong CitizenLifecycleRebalanceId = 654707599;
private static readonly ulong[] IncompatibleModIds =
{
605590542, // Rush Hour II
Expand Down
30 changes: 30 additions & 0 deletions src/RealTime/Core/ModIds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// <copyright file="ModIds.cs" company="dymanoid">
// Copyright (c) dymanoid. All rights reserved.
// </copyright>

namespace RealTime.Core
{
/// <summary>
/// A class containing various mods' Workshop IDs.
/// </summary>
internal static class ModIds
{
/// <summary>The Workshop ID of the 'Citizen Lifecycle Rebalance' mod.</summary>
public const ulong CitizenLifecycleRebalance = 654707599ul;

/// <summary>The Workshop ID of the 'Ploppable RICO' mod.</summary>
public const ulong PloppableRico = 586012417ul;

/// <summary>The Workshop ID of the 'Ploppable RICO - High Density Fix' mod.</summary>
public const ulong PloppableRicoHighDensityFix = 1204126182ul;

/// <summary>The Workshop ID of the 'Plop The Growables' mod.</summary>
public const ulong PlopTheGrowables = 924884948ul;

/// <summary>The Workshop ID of the 'Building Themes' mod.</summary>
public const ulong BuildingThemes = 466158459ul;

/// <summary>The Workshop ID of the 'Force Level Up' mod.</summary>
public const ulong ForceLevelUp = 523818382ul;
}
}
19 changes: 16 additions & 3 deletions src/RealTime/Core/RealTimeCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ private static List<IPatch> GetMethodPatches(Compatibility compatibility)
BuildingAIPatches.CommercialSimulation,
BuildingAIPatches.GetColor,
BuildingAIPatches.CalculateUnspawnPosition,
BuildingAIPatches.GetUpgradeInfo,
BuildingAIPatches.CreateBuilding,
BuildingAIPatches.ProduceGoods,
ResidentAIPatch.Location,
ResidentAIPatch.ArriveAtTarget,
Expand All @@ -312,7 +310,7 @@ private static List<IPatch> GetMethodPatches(Compatibility compatibility)
OutsideConnectionAIPatch.DummyTrafficProbability,
};

if (Compatibility.IsModActive(Compatibility.CitizenLifecycleRebalanceId))
if (compatibility.IsAnyModActive(ModIds.CitizenLifecycleRebalance))
{
Log.Info("The 'Real Time' mod will not change the citizens aging because the 'Citizen Lifecycle Rebalance' mod is active.");
}
Expand All @@ -322,6 +320,21 @@ private static List<IPatch> GetMethodPatches(Compatibility compatibility)
patches.Add(ResidentAIPatch.CanMakeBabies);
}

if (compatibility.IsAnyModActive(
ModIds.BuildingThemes,
ModIds.ForceLevelUp,
ModIds.PloppableRico,
ModIds.PloppableRicoHighDensityFix,
ModIds.PlopTheGrowables))
{
Log.Info("The 'Real Time' mod will not change the building construction and upgrading behavior because some building mod is active.");
}
else
{
patches.Add(BuildingAIPatches.GetUpgradeInfo);
patches.Add(BuildingAIPatches.CreateBuilding);
}

patches.AddRange(TimeControlCompatibility.GetCompatibilityPatches());

return patches;
Expand Down
1 change: 1 addition & 0 deletions src/RealTime/RealTime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Config\VirtualCitizensLevel.cs" />
<Compile Include="Core\ModIds.cs" />
<Compile Include="Core\RealTimeBenchmark.cs" />
<Compile Include="Core\Compatibility.cs" />
<Compile Include="Core\RealTimeStorage.cs" />
Expand Down

0 comments on commit 6543a08

Please sign in to comment.