Skip to content

Commit

Permalink
Fix monument blueprints to use custom limit
Browse files Browse the repository at this point in the history
  • Loading branch information
KapitanOczywisty committed Sep 11, 2022
1 parent 5513dc9 commit 52dd4d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Source/ChangeMapEdgeHarmony.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ static ChangeMapEdgeHarmony()
MethodInfo innozone_targetmethod = AccessTools.Method(typeof(Verse.GenGrid), "InNoZoneEdgeArea");
HarmonyMethod innozone_postfixmethod = new HarmonyMethod(typeof(ChangeMapEdgeHarmony).GetMethod("InNoZoneEdgeArea_Postfix"));
harmony.Patch(innozone_targetmethod, ignorefunction_prefixmethod, innozone_postfixmethod);

MethodInfo cellrect_innobuild_targetmethod = AccessTools.Method(typeof(Verse.CellRect), "InNoBuildEdgeArea");
HarmonyMethod cellrect_innobuild_postfixmethod = new HarmonyMethod(typeof(ChangeMapEdgeHarmony).GetMethod("CellRectInNoBuildEdgeArea_Postfix"));
harmony.Patch(cellrect_innobuild_targetmethod, ignorefunction_prefixmethod, cellrect_innobuild_postfixmethod);
}

static Material LineMatMetaOverlay = MaterialPool.MatFrom(GenDraw.LineTexPath, ShaderDatabase.MetaOverlay);
Expand Down Expand Up @@ -76,5 +80,10 @@ public static void InNoZoneEdgeArea_Postfix(this IntVec3 c, Map map, ref bool __
{
__result = c.CloseToEdge(map, ChangeMapEdge.Instance.GetNoZoneLimit());
}
public static void CellRectInNoBuildEdgeArea_Postfix(Verse.CellRect __instance, Map map, ref bool __result)
{
int limit = ChangeMapEdge.Instance.GetNoBuildLimit();
__result = !__instance.IsEmpty && (__instance.minX < limit || __instance.minZ < limit || __instance.maxX >= map.Size.x - limit || __instance.maxZ >= map.Size.z - limit);
}
}
}
Binary file modified v1.3/Assemblies/ChangeMapEdge.dll
Binary file not shown.

0 comments on commit 52dd4d7

Please sign in to comment.