Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Progress-Renderer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Compile Include="Source\Harmony_Patches\Harmony_OptionListingUtility.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_OverlayDrawer.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_OverlayDrawHandler.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_PlanDesignation_DesignationDraw.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_RoofGrid.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_ScreenshotModeHandler.cs" />
<Compile Include="Source\Harmony_Patches\Harmony_Targeter.cs" />
Expand Down
7 changes: 5 additions & 2 deletions Source/Harmony_Patches/HarmonySetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

namespace ProgressRenderer
{

[StaticConstructorOnStartup]
static class HarmonySetup
{
static HarmonySetup()
{
var harmony = new Harmony("rimworld.neptimus7.progressrenderer");
harmony.PatchAll(Assembly.GetExecutingAssembly());

if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "scherub.planningextended"))
harmony.PatchCategory("PlanningExtended");

harmony.PatchAllUncategorized(Assembly.GetExecutingAssembly());
}
}
}
35 changes: 35 additions & 0 deletions Source/Harmony_Patches/Harmony_PlanDesignation_DesignationDraw.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using HarmonyLib;
using Verse;

namespace ProgressRenderer
{
[HarmonyPatchCategory("PlanningExtended")]
[HarmonyPatch("PlanDesignation", nameof(Designation.DesignationDraw))]
public static class Harmony_PlanDesignation_DesignationDraw
{
public static bool Prefix(Designation __instance)
{
try
{
if (__instance.def == null) return true;

var target = __instance.target;

Map map = target.HasThing ? target.Thing.MapHeld : Find.CurrentMap;

var renderManager = map?.GetComponent<MapComponent_RenderManager>();

if (renderManager?.Rendering == false) return true;

return PrModSettings.RenderDesignations;
}
catch (Exception ex)
{
// 1.6 UPDATE: Enhanced error reporting
Log.Error($"[ProgressRenderer] DesignationDraw patch error in 1.6: {ex}\n{ex.StackTrace}");
return true;
}
}
}
}