From 51685daedad84e204bf1a5ee98e311bcbdf1eddb Mon Sep 17 00:00:00 2001
From: Lacyway <20912169+Lacyway@users.noreply.github.com>
Date: Wed, 19 Jun 2024 09:24:57 +0200
Subject: [PATCH] Update logging
---
Fika.Core/Coop/Components/CoopHandler.cs | 26 ++++++++----------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/Fika.Core/Coop/Components/CoopHandler.cs b/Fika.Core/Coop/Components/CoopHandler.cs
index 5d069de1..a3db9768 100644
--- a/Fika.Core/Coop/Components/CoopHandler.cs
+++ b/Fika.Core/Coop/Components/CoopHandler.cs
@@ -511,7 +511,7 @@ private ObservedCoopPlayer SpawnObservedPlayer(Profile profile, Vector3 position
Logger.LogDebug($"CreateLocalPlayer::{profile.Info.Nickname}::Spawned.");
- SetWeaponInHandsOfNewPlayer(otherPlayer, () => { });
+ SetWeaponInHandsOfNewPlayer(otherPlayer);
return otherPlayer;
}
@@ -559,13 +559,13 @@ private IEnumerator AddClientToBotEnemies(BotsController botController, LocalPla
///
/// Attempts to set up the New Player with the current weapon after spawning
///
- /// The player to set the item on
- public void SetWeaponInHandsOfNewPlayer(Player person, Action successCallback)
+ /// The player to set the item on
+ public void SetWeaponInHandsOfNewPlayer(Player player)
{
- EquipmentClass equipment = person.Profile.Inventory.Equipment;
+ EquipmentClass equipment = player.Profile.Inventory.Equipment;
if (equipment == null)
{
- Logger.LogError($"SetWeaponInHandsOfNewPlayer: {person.Profile.ProfileId} has no Equipment!");
+ Logger.LogError($"SetWeaponInHandsOfNewPlayer: {player.Profile.Nickname}, {player.Profile.ProfileId} has no Equipment!");
}
Item item = null;
@@ -591,24 +591,14 @@ public void SetWeaponInHandsOfNewPlayer(Player person, Action successCallback)
if (item == null)
{
- Logger.LogError($"SetWeaponInHandsOfNewPlayer:Unable to find any weapon for {person.Profile.ProfileId}");
+ Logger.LogError($"SetWeaponInHandsOfNewPlayer: Unable to find any weapon for {player.Profile.Nickname}, {player.Profile.ProfileId}");
}
- person.SetItemInHands(item, (IResult) =>
+ player.SetItemInHands(item, (IResult) =>
{
if (IResult.Failed == true)
{
- Logger.LogError($"SetWeaponInHandsOfNewPlayer:Unable to set item {item} in hands for {person.Profile.ProfileId}");
- }
-
- if (IResult.Succeed == true)
- {
- successCallback?.Invoke();
- }
-
- if (person.TryGetItemInHands- () != null)
- {
- successCallback?.Invoke();
+ Logger.LogError($"SetWeaponInHandsOfNewPlayer: Unable to set item {item} in hands for {player.Profile.Nickname}, {player.Profile.ProfileId}");
}
});
}