diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index ac63fa67..6b8fe08c 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -873,7 +873,6 @@ public override async Task vmethod_2(int playerId, Vector3 position } CoopPlayer coopPlayer = (CoopPlayer)myPlayer; - coopPlayer.SetupMainPlayer(); coopHandler.Players.Add(coopPlayer.NetId, coopPlayer); PlayerSpawnRequest body = new(myPlayer.ProfileId, FikaBackendUtils.GetGroupId()); diff --git a/Fika.Core/Coop/Players/CoopPlayer.cs b/Fika.Core/Coop/Players/CoopPlayer.cs index f361a69f..2dc3fd61 100644 --- a/Fika.Core/Coop/Players/CoopPlayer.cs +++ b/Fika.Core/Coop/Players/CoopPlayer.cs @@ -107,6 +107,8 @@ await player.Init(rotation, layerName, pointOfView, profile, inventoryController player.Profile.Info.MainProfileNickname = FikaBackendUtils.PMCName; + player.SetupMainPlayer(); + return player; } @@ -879,6 +881,7 @@ public void SetupMainPlayer() // Setup own dog tag if (Side != EPlayerSide.Savage) { + FikaPlugin.Instance.FikaLogger.LogInfo("Setting up DogTag"); if (Equipment.GetSlot(EquipmentSlot.Dogtag).ContainedItem != null) { GStruct414 result = InteractionsHandlerClass.Remove(Equipment.GetSlot(EquipmentSlot.Dogtag).ContainedItem, _inventoryController, false, true); @@ -894,7 +897,16 @@ public void SetupMainPlayer() { Item item = Singleton.Instance.CreateItem(MongoID.Generate(), templateId, null); - Equipment.GetSlot(EquipmentSlot.Dogtag).Add(item, false); + Slot dogtagSlot = Equipment.GetSlot(EquipmentSlot.Dogtag); + ItemFilter[] filters = dogtagSlot.Filters; // We need to temporarily remove and then re-add these as BSG did not include the new dog tags in their ItemFilter[] + dogtagSlot.Filters = null; + GStruct416 addResult = dogtagSlot.Add(item, false); + dogtagSlot.Filters = filters; + + if (addResult.Error != null) + { + FikaPlugin.Instance.FikaLogger.LogError("CoopPlayer::SetupMainPlayer: Error adding dog tag to slot: " + addResult.Error); + } DogtagComponent dogtagComponent = item.GetItemComponent(); if (dogtagComponent != null) @@ -907,6 +919,10 @@ public void SetupMainPlayer() FikaPlugin.Instance.FikaLogger.LogWarning("Unable to find DogTagComponent"); } } + else + { + FikaPlugin.Instance.FikaLogger.LogError("Could not get templateId for DogTag!"); + } } // Delete labs card on labs @@ -925,7 +941,9 @@ public void SetupMainPlayer() private string GetDogTagTemplateId() { - if (Profile.Side is EPlayerSide.Usec) + //return Profile.Side == EPlayerSide.Usec ? "6662ea05f6259762c56f3189" : "59f32bb586f774757e1e8442"; + + if (Side is EPlayerSide.Usec) { switch (Profile.Info.MemberCategory) { @@ -937,7 +955,7 @@ private string GetDogTagTemplateId() return "6662ea05f6259762c56f3189"; } } - else if (Profile.Side is EPlayerSide.Bear) + else if (Side is EPlayerSide.Bear) { switch (Profile.Info.MemberCategory) {