Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

Label returnLabel = generator.DefineLabel();
Label continueLabel = generator.DefineLabel();
Label jmp = generator.DefineLabel();

LocalBuilder changingRoleEventArgs = generator.DeclareLocal(typeof(ChangingRoleEventArgs));
LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player));
Expand All @@ -62,21 +60,9 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })),
new(OpCodes.Stloc_S, player.LocalIndex),

// if (Player.IsVerified)
// goto jmp
new(OpCodes.Ldloc_S, player.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(API.Features.Player), nameof(API.Features.Player.IsVerified))),
new(OpCodes.Brtrue_S, jmp),

// if (!Player.IsNpc)
// goto continueLabel;
new(OpCodes.Ldloc_S, player.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(API.Features.Player), nameof(API.Features.Player.IsNPC))),
new(OpCodes.Brfalse_S, continueLabel),

// jmp

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this too

// player
new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex).WithLabels(jmp),
new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex),

// newRole
new(OpCodes.Ldarg_1),
Expand Down Expand Up @@ -122,8 +108,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Ldloc_S, changingRoleEventArgs.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(ChangingRoleEventArgs), nameof(ChangingRoleEventArgs.Player))),
new(OpCodes.Call, Method(typeof(ChangingRoleAndSpawned), nameof(UpdatePlayerRole))),

new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel),
});

int offset = 1;
Expand Down
Loading