Skip to content

Commit

Permalink
refactor: rename to PlayerOnTickInventoryManager
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlucas committed Jun 17, 2024
1 parent 930379d commit b14346a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/InventorySimulator/InventorySimulator.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public HookResult OnPlayerConnect(EventPlayerConnect @event, GameEventInfo _)
var player = @event.Userid;
if (player != null && IsPlayerHumanAndValid(player))
{
if (PlayerOnTickManager.TryGetValue(player.SteamID, out var tuple))
if (PlayerOnTickInventoryManager.TryGetValue(player.SteamID, out var tuple))
{
PlayerOnTickManager[player.SteamID] = (player, tuple.Item2);
PlayerOnTickInventoryManager[player.SteamID] = (player, tuple.Item2);
}
RefreshPlayerInventory(player);
}
Expand Down
2 changes: 1 addition & 1 deletion source/InventorySimulator/InventorySimulator.Listeners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void OnTick()
// According to @bklol the right way to change the Music Kit is to update the player's inventory, I'm
// pretty sure that's the best way to change anything inventory-related, but that's not something
// public and we brute force the setting of the Music Kit here.
foreach (var (player, inventory) in PlayerOnTickManager.Values)
foreach (var (player, inventory) in PlayerOnTickInventoryManager.Values)
if (player != null)
{
GivePlayerMusicKit(player, inventory);
Expand Down
10 changes: 5 additions & 5 deletions source/InventorySimulator/InventorySimulator.Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void AddPlayerInventory(ulong steamId, PlayerInventory inventory)
Server.NextFrame(() =>
{
if (inventory.MusicKit != null)
PlayerOnTickManager[steamId] = (Utilities.GetPlayerFromSteamId(steamId), inventory);
else PlayerOnTickManager.Remove(steamId);
PlayerOnTickInventoryManager[steamId] = (Utilities.GetPlayerFromSteamId(steamId), inventory);
else PlayerOnTickInventoryManager.Remove(steamId);
});
}

Expand All @@ -63,11 +63,11 @@ public void RemovePlayerInventory(ulong steamId)
if (!LoadedPlayerInventory.Contains(steamId))
{
PlayerInventoryManager.Remove(steamId);
PlayerOnTickManager.Remove(steamId);
PlayerOnTickInventoryManager.Remove(steamId);
}
if (PlayerOnTickManager.TryGetValue(steamId, out var tuple))
if (PlayerOnTickInventoryManager.TryGetValue(steamId, out var tuple))
{
PlayerOnTickManager[steamId] = (null, tuple.Item2);
PlayerOnTickInventoryManager[steamId] = (null, tuple.Item2);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/InventorySimulator/InventorySimulator.State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class InventorySimulator
public readonly HashSet<ulong> LoadedPlayerInventory = new();

public readonly Dictionary<ulong, long> PlayerCooldownManager = new();
public readonly Dictionary<ulong, (CCSPlayerController?, PlayerInventory)> PlayerOnTickManager = new();
public readonly Dictionary<ulong, (CCSPlayerController?, PlayerInventory)> PlayerOnTickInventoryManager = new();
public readonly Dictionary<ulong, PlayerInventory> PlayerInventoryManager = new();

public readonly PlayerInventory EmptyInventory = new();
Expand Down

0 comments on commit b14346a

Please sign in to comment.