Skip to content
Open
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
13 changes: 11 additions & 2 deletions EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
using Exiled.API.Features.Pools;
using Interfaces;
using InventorySystem;
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers;
using PlayerRoles;

/// <summary>
Expand Down Expand Up @@ -72,10 +74,17 @@
Items.Clear();
Ammo.Clear();

foreach (ItemType itemType in inventory.Items)
PlayerReceivingLoadoutEventArgs playerReceivingLoadoutEventArgs = new(Player.ReferenceHub, inventory.Items, inventory.Ammo, !ShouldPreserveInventory);

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'

Check failure on line 77 in EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'ItemType[]' to 'System.Collections.Generic.List<ItemType>'
PlayerEvents.OnReceivingLoadout(playerReceivingLoadoutEventArgs);
if (!playerReceivingLoadoutEventArgs.IsAllowed)
{
return;
}

foreach (ItemType itemType in playerReceivingLoadoutEventArgs.Items)
Items.Add(itemType);

foreach (KeyValuePair<ItemType, ushort> ammoPair in inventory.Ammo)
foreach (KeyValuePair<ItemType, ushort> ammoPair in playerReceivingLoadoutEventArgs.Ammo)
Ammo.Add(ammoPair.Key, ammoPair.Value);

field = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace Exiled.Events.Patches.Events.Player
using InventorySystem.Items.Armor;
using InventorySystem.Items.Pickups;
using InventorySystem.Items.Usables.Scp1344;
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.Handlers;
using Mirror;

using PlayerRoles;
Expand Down Expand Up @@ -230,6 +232,7 @@ private static void ChangeInventory(ChangingRoleEventArgs ev)
InventoryItemProvider.OnItemProvided?.Invoke(ev.Player.ReferenceHub, itemBase);
}

PlayerEvents.OnReceivedLoadout(new PlayerReceivedLoadoutEventArgs(ev.Player.ReferenceHub, ev.Items, ev.Ammo, !ev.ShouldPreserveInventory));
InventoryItemProvider.InventoriesToReplenish.Enqueue(ev.Player.ReferenceHub);
}
catch (Exception exception)
Expand Down
Loading