mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-05 20:50:25 +08:00
fix(CheatEnabler): restore BuildToolOpt station replacement
This commit is contained in:
@@ -12,7 +12,7 @@ internal class ArchitectMode : PatchImpl<ArchitectMode>
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory?.planet?.data != null)
|
||||
{
|
||||
FactoryPatch.ArrivePlanet(factory);
|
||||
global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet(factory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
var main = GameMain.instance;
|
||||
if (main != null && main._running && __instance.factory?.planet?.data != null)
|
||||
{
|
||||
ArrivePlanet(__instance.factory);
|
||||
global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet(__instance.factory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory?.planet?.data != null)
|
||||
{
|
||||
ArrivePlanet(factory);
|
||||
global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet(factory);
|
||||
}
|
||||
GameMain.data?.warningSystem?.UpdateCriticalWarningText();
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory?.planet?.data != null)
|
||||
{
|
||||
FactoryPatch.ArrivePlanet(factory);
|
||||
global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet(factory);
|
||||
}
|
||||
}
|
||||
// Harmony transpiler: Transpiler
|
||||
@@ -157,7 +157,7 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(BuildTool), nameof(BuildTool.factory))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(FactoryPatch), nameof(FactoryPatch.ArrivePlanet)))
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(global::CheatEnabler.Patches.FactoryPatch), nameof(global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
@@ -255,7 +255,7 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory?.planet?.data != null)
|
||||
{
|
||||
FactoryPatch.ArrivePlanet(factory);
|
||||
global::CheatEnabler.Patches.FactoryPatch.ArrivePlanet(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CheatEnabler.Patches;
|
||||
|
||||
/// <summary>
|
||||
/// Preserves the pre-refactor type and method identity used by mods that locate FactoryPatch through reflection.
|
||||
/// </summary>
|
||||
public static class FactoryPatch
|
||||
{
|
||||
public static void ArrivePlanet(PlanetFactory factory)
|
||||
{
|
||||
Factory.FactoryPatch.ArrivePlanet(factory);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user