1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 20:53:28 +08:00
This commit is contained in:
2025-09-06 17:06:13 +08:00
parent 9d586d68e0
commit 9bfa74edf2

View File

@@ -303,6 +303,34 @@ public class MoreSettings
matcher.Repeat(m => m.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldarg_3)));
return matcher.InstructionEnumeration();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIVirtualStarmap), nameof(UIVirtualStarmap._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIVirtualStarmap__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
var local1 = generator.DeclareLocal(typeof(UIVirtualStarmap.StarNode));
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIVirtualStarmap.StarNode), nameof(UIVirtualStarmap.StarNode.nameText))),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(UnityEngine.Component), nameof(UnityEngine.Component.gameObject))),
new CodeMatch(ci => ci.IsLdloc()),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(GameObject), nameof(GameObject.SetActive)))
).InsertAndAdvance(
new CodeInstruction(OpCodes.Dup),
new CodeInstruction(OpCodes.Stloc, local1)
).Advance(3).Insert(
new CodeInstruction(OpCodes.Ldloc, local1),
Transpilers.EmitDelegate(bool (UIVirtualStarmap.StarNode starNode) => {
return starNode.starData.type switch
{
EStarType.NeutronStar or EStarType.BlackHole => true,
_ => false,
};
}),
new CodeInstruction(OpCodes.Or)
);
return matcher.InstructionEnumeration();
}
}
#region CombatSettings