From 794d93f0870af65d6f64a6c0108b07c6ef3fc465 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:55:39 +0200 Subject: [PATCH] Sync triggerzones on death --- Fika.Core/Coop/Players/CoopPlayer.cs | 11 ++--------- .../Networking/Packets/Player/HealthSyncPacket.cs | 3 +++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Fika.Core/Coop/Players/CoopPlayer.cs b/Fika.Core/Coop/Players/CoopPlayer.cs index a7439a74..256a64cd 100644 --- a/Fika.Core/Coop/Players/CoopPlayer.cs +++ b/Fika.Core/Coop/Players/CoopPlayer.cs @@ -535,7 +535,8 @@ public HealthSyncPacket SetupDeathPacket(GStruct347 packet) Force = _corpseAppliedForce, OverallVelocity = Velocity }, - Equipment = Equipment + Equipment = Equipment, + TriggerZones = TriggerZones.Count > 0 ? [.. TriggerZones] : null, }; } @@ -1308,14 +1309,6 @@ public virtual void HandleDamagePacket(DamagePacket packet) ClientApplyShot(damageInfo, packet.DamageInfo.BodyPartType, packet.DamageInfo.ColliderType, packet.DamageInfo.ArmorPlateCollider); } - public void HandleDeathPatchet(DeathPacket packet) - { - if (packet.HasInventory) - { - SetInventory(packet.Equipment); - } - } - public virtual void SetupDogTag() { if (LastAggressor != null) diff --git a/Fika.Core/Networking/Packets/Player/HealthSyncPacket.cs b/Fika.Core/Networking/Packets/Player/HealthSyncPacket.cs index 28177c14..d559ede3 100644 --- a/Fika.Core/Networking/Packets/Player/HealthSyncPacket.cs +++ b/Fika.Core/Networking/Packets/Player/HealthSyncPacket.cs @@ -12,6 +12,7 @@ public struct HealthSyncPacket(int netId) : INetSerializable public string KillerWeaponId; public RagdollPacket RagdollPacket; public EquipmentClass Equipment; + public string[] TriggerZones; public void Deserialize(NetDataReader reader) { @@ -138,6 +139,7 @@ public void Deserialize(NetDataReader reader) KillerWeaponId = reader.GetString(); RagdollPacket = RagdollPacket.Deserialize(reader); Equipment = (EquipmentClass)reader.GetItem(); + TriggerZones = reader.GetStringArray(); break; } break; @@ -349,6 +351,7 @@ public void Serialize(NetDataWriter writer) writer.Put(KillerWeaponId); RagdollPacket.Serialize(writer, RagdollPacket); writer.PutItem(Equipment); + writer.PutArray(TriggerZones); break; } break;