Skip to content
Merged
Show file tree
Hide file tree
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 @@ -22,13 +22,17 @@ public class UsingBreakneckSpeedsEventArgs : IScp173Event, IDeniableEvent
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="isActivationRequested">
/// <inheritdoc cref="IsActivationRequested" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public UsingBreakneckSpeedsEventArgs(Player player, bool isAllowed = true)
public UsingBreakneckSpeedsEventArgs(Player player, bool isActivationRequested, bool isAllowed = true)
{
Player = player;
Scp173 = player.Role.As<Scp173Role>();
IsActivationRequested = isActivationRequested;
IsAllowed = isAllowed;
}

Expand All @@ -37,6 +41,11 @@ public UsingBreakneckSpeedsEventArgs(Player player, bool isAllowed = true)
/// </summary>
public bool IsAllowed { get; set; }

/// <summary>
/// Gets a value indicating whether the player is attempting to activate breakneck speeds.
/// </summary>
public bool IsActivationRequested { get; }

/// <summary>
/// Gets the player who's using breakneck speeds.
/// </summary>
Expand All @@ -45,4 +54,4 @@ public UsingBreakneckSpeedsEventArgs(Player player, bool isAllowed = true)
/// <inheritdoc/>
public Scp173Role Scp173 { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Call, PropertyGetter(typeof(StandardSubroutine<Scp173Role>), nameof(StandardSubroutine<Scp173Role>.Owner))),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),

// value to be set (will the ability turn on or off)
new(OpCodes.Ldarg_1),

// this.Cooldown.Remaining == 0
new(OpCodes.Ldarg_0),
new(OpCodes.Ldfld, Field(typeof(Scp173BreakneckSpeedsAbility), nameof(Scp173BreakneckSpeedsAbility.Cooldown))),
new(OpCodes.Callvirt, PropertyGetter(typeof(AbilityCooldown), nameof(AbilityCooldown.Remaining))),
new(OpCodes.Ldc_R4, 0f),
new(OpCodes.Ceq),

// UsingBreakneckSpeedsEventArgs ev = new(Player, bool)
// UsingBreakneckSpeedsEventArgs ev = new(Player, bool, bool)
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(UsingBreakneckSpeedsEventArgs))[0]),
new(OpCodes.Dup),

Expand All @@ -82,4 +85,4 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
}
}
}