Risk of Rain 2
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
174
Size
89KB

NoShardsFromEmpyreans

Really small mod to make empyrean elites not drop shard(s) on death in the beta version of Starstorm 2. They still drop a random item, it's just the shard drops that were removed.

This mod's so small that I didn't bother making a github repository for it, since this is all the relevant code for the harmony IL patch:

IL patch code
[HarmonyPatch(typeof(SS2.Components.Empyrean), nameof(SS2.Components.Empyrean.MakeElite))]
[HarmonyILManipulator]
public static void DoPatch(ILContext il)
{
    ILCursor c = new(il);
    ILLabel skipSettingShardDrops = il.DefineLabel();


    if (!c.TryGotoNext(MoveType.AfterLabel,
        x => x.MatchLdarg(1),
        x => x.MatchCallvirt<Component>("get_gameObject"),
        x => x.MatchCallvirt<GameObject>("AddComponent")
    ))
    {
        Log.Error("COULD NOT IL HOOK SS2.Components.Empyrean.MakeElite PART 1");
        Log.Warning($"il is {il}");
    }
    c.Emit(OpCodes.Br, skipSettingShardDrops);


    if (!c.TryGotoNext(MoveType.AfterLabel,
        x => x.MatchLdarg(1),
        x => x.MatchLdloca(4),
        x => x.MatchCallvirt<Component>("TryGetComponent")
    ))
    {
        Log.Error("COULD NOT IL HOOK SS2.Components.Empyrean.MakeElite PART 2");
        Log.Warning($"il is {il}");
    }
    c.MarkLabel(skipSettingShardDrops);
}
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.