From cd8b03588044a934df3430c56998ded41d397063 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Wed, 15 May 2024 13:34:17 +0200 Subject: [PATCH] Fix malfunctions --- .../HandsControllers/CoopClientFirearmController.cs | 3 ++- .../HandsControllers/CoopObservedFirearmController.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Fika.Core/Coop/ClientClasses/HandsControllers/CoopClientFirearmController.cs b/Fika.Core/Coop/ClientClasses/HandsControllers/CoopClientFirearmController.cs index bd2b947b..f15ea5f6 100644 --- a/Fika.Core/Coop/ClientClasses/HandsControllers/CoopClientFirearmController.cs +++ b/Fika.Core/Coop/ClientClasses/HandsControllers/CoopClientFirearmController.cs @@ -446,7 +446,8 @@ public override void ShotMisfired(BulletClass ammo, Weapon.EMalfunctionState mal IsPrimaryActive = true, ShotType = shotType, AmmoAfterShot = Item.GetCurrentMagazineCount(), - Overheat = overheat + Overheat = overheat, + AmmoTemplate = ammo.TemplateId } }); diff --git a/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs b/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs index 3c5495b8..2fd070bc 100644 --- a/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs +++ b/Fika.Core/Coop/ObservedClasses/HandsControllers/CoopObservedFirearmController.cs @@ -197,6 +197,12 @@ public void HandleFirearmPacket(in WeaponPacket packet, InventoryControllerClass break; } + if (string.IsNullOrEmpty(packet.ShotInfoPacket.AmmoTemplate)) + { + FikaPlugin.Instance.FikaLogger.LogError("CoopObservedFirearmController::HandleFirearmPacket: AmmoTemplate was null or empty!"); + return; + } + Weapon.MalfState.MalfunctionedAmmo = (BulletClass)Singleton.Instance.CreateItem(MongoID.Generate(), packet.ShotInfoPacket.AmmoTemplate, null); if (weaponPrefab != null) {