1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 12:13:31 +08:00

Dustbin: fix patch attributes to use nameof()

This commit is contained in:
2025-03-26 18:18:03 +08:00
parent 092795cbac
commit 69ab11c392
3 changed files with 13 additions and 13 deletions

View File

@@ -60,7 +60,7 @@ public static class BeltSignal
} }
[HarmonyPostfix, HarmonyPriority(Priority.Last)] [HarmonyPostfix, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")] [HarmonyPatch(typeof(VFPreload), nameof(VFPreload.InvokeOnLoadWorkEnded))]
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix() private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
{ {
if (_initialized) return; if (_initialized) return;
@@ -198,7 +198,7 @@ public static class BeltSignal
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), "GameTick")] [HarmonyPatch(typeof(GameData), nameof(GameData.GameTick))]
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);

View File

@@ -96,14 +96,14 @@ public static class StoragePatch
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(GameMain), "Start")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
private static void GameMain_Start_Prefix() private static void GameMain_Start_Prefix()
{ {
Reset(); Reset();
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(UIStorageWindow), "_OnCreate")] [HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance) private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
{ {
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 50f, 50f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin"); _storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 50f, 50f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
@@ -123,7 +123,7 @@ public static class StoragePatch
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(UIStorageWindow), "_OnUpdate")] [HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnUpdate))]
private static void UIStorageWindow__OnUpdate_Postfix(UIStorageWindow __instance) private static void UIStorageWindow__OnUpdate_Postfix(UIStorageWindow __instance)
{ {
var storageId = __instance.storageId; var storageId = __instance.storageId;
@@ -141,7 +141,7 @@ public static class StoragePatch
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */ /* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(UIStorageGrid), "OnStorageSizeChanged")] [HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
private static void UIStorageGrid_OnStorageSizeChanged_Postfix() private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
{ {
// Due to storage window is empty when open in client, the size will change after receiving data from host // Due to storage window is empty when open in client, the size will change after receiving data from host
@@ -149,8 +149,8 @@ public static class StoragePatch
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(StorageComponent), "AddItem", new[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool) }, [HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.AddItem), [typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool)],
new[] { ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal })] [ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal])]
private static IEnumerable<CodeInstruction> StorageComponent_AddItem_HarmonyTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> StorageComponent_AddItem_HarmonyTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
@@ -172,7 +172,7 @@ public static class StoragePatch
/* We keep this to make MOD compatible with older version */ /* We keep this to make MOD compatible with older version */
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(StorageComponent), "Import")] [HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.Import))]
private static void StorageComponent_Import_Postfix(StorageComponent __instance) private static void StorageComponent_Import_Postfix(StorageComponent __instance)
{ {
if (__instance.bans >= 0) if (__instance.bans >= 0)

View File

@@ -100,14 +100,14 @@ public static class TankPatch
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(GameMain), "Start")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
private static void GameMain_Start_Prefix() private static void GameMain_Start_Prefix()
{ {
Reset(); Reset();
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(UITankWindow), "_OnCreate")] [HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnCreate))]
private static void UITankWindow__OnCreate_Postfix(UITankWindow __instance) private static void UITankWindow__OnCreate_Postfix(UITankWindow __instance)
{ {
_tankDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 120f, 20f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin"); _tankDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 120f, 20f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
@@ -127,7 +127,7 @@ public static class TankPatch
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(UITankWindow), "_OnUpdate")] [HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnUpdate))]
private static void UITankWindow__OnUpdate_Postfix(UITankWindow __instance) private static void UITankWindow__OnUpdate_Postfix(UITankWindow __instance)
{ {
var tankId = __instance.tankId; var tankId = __instance.tankId;
@@ -142,7 +142,7 @@ public static class TankPatch
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(TankComponent), "GameTick")] [HarmonyPatch(typeof(TankComponent), nameof(TankComponent.GameTick))]
private static bool TankComponent_GameTick_Prefix(ref TankComponent __instance, PlanetFactory factory) private static bool TankComponent_GameTick_Prefix(ref TankComponent __instance, PlanetFactory factory)
{ {
if (__instance.fluidInc < 0) if (__instance.fluidInc < 0)