Skip to content

Commit

Permalink
Merge branch 'dev' into IScp330Event
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 authored Aug 6, 2024
2 parents e291111 + 4e50826 commit 9153b43
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
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

0 comments on commit 9153b43

Please sign in to comment.