Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecontainedEventArgs more feature #20

Merged
merged 5 commits into from
Aug 6, 2024
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
25 changes: 23 additions & 2 deletions EXILED/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ public class RecontainedEventArgs : IScp079Event
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
public RecontainedEventArgs(Player player)
/// <param name="scp079Recontainer">
/// <inheritdoc cref="Recontainer" />
/// </param>
public RecontainedEventArgs(Player player, PlayerRoles.PlayableScps.Scp079.Scp079Recontainer scp079Recontainer)
{
Player = player;
Scp079 = player.Role.As<Scp079Role>();
Recontainer = scp079Recontainer;
Attacker = Player.Get(scp079Recontainer._activatorGlass.LastAttacker);
IsAutomatic = scp079Recontainer._activatorGlass.LastAttacker.IsSet;
}

/// <summary>
Expand All @@ -35,5 +41,20 @@ public RecontainedEventArgs(Player player)

/// <inheritdoc/>
public Scp079Role Scp079 { get; }

/// <summary>
/// Gets the instance that handle SCP-079 recontained proccess.
/// </summary>
public PlayerRoles.PlayableScps.Scp079.Scp079Recontainer Recontainer { get; }

/// <summary>
/// Gets the player who recontained SCP-079.
/// </summary>
public Player Attacker { get; }

/// <summary>
/// Gets a value indicating whether the recontainment has been made automatically or by triggering the process.
/// </summary>
public bool IsAutomatic { get; }
}
}
}
3 changes: 2 additions & 1 deletion EXILED/Exiled.Events/Patches/Events/Scp079/Recontain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

CodeInstruction[] recontainedEvent = new CodeInstruction[]
{
// Handlers.Scp079.OnRecontained(new RecontainedEventArgs(Player.Get(referenceHub2)));
// Handlers.Scp079.OnRecontained(new RecontainedEventArgs(Player.Get(referenceHub2), this));
new(OpCodes.Ldloc, 5),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),
new(OpCodes.Ldarg_0),
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RecontainedEventArgs))[0]),
new(OpCodes.Call, Method(typeof(Scp079), nameof(Scp079.OnRecontained))),
};
Expand Down
Loading