From 02210df130633a6a0a4c55a6ad0de3523e2c5967 Mon Sep 17 00:00:00 2001 From: toasterpanic Date: Thu, 28 May 2026 16:48:45 -0400 Subject: [PATCH] Fix bodygroup issues --- README.md | 15 ++++++++++----- lua/zcnpci/modules/falling_legs.lua | 11 ++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3eae5a9..4c62fb5 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,20 @@ This addon is based off of Kazarei's Euphoria, which in turn is a fork of Fedhor ## Known issues -- Kicking NPCs does not knock them down. The same goes for many melee attacks. This is not something I know how to easily fix -- I would have to override code in Z-City, which I would rather not do. If you do know how to easily fix this, reach out, I would love to add it. -- Bandages, tourniquets, etc. that are on the ragdoll or NPC body will not be there when they get back up. - +- Bandages, tourniquets, etc. that are on the ragdoll or NPC body will not be there when they get back up. Don't know how to fix this unfortunately. - NPCs currently instantly get up, with no animation. I plan on remedying this in the future. - Enemy NPCs will not target living downed NPCs like how they do players. This will be fixed. -## Incompatibilities +## Compatibility -- Any mod that modifies the behavior of death ragdolls (Reagdoll, Artagdoll, Fedhoria) +This should be compatible with: + +- The majority of NPC AI improvement mods +- Competently-programmed Z-City addons + +It is, however, not compatbile with: + +- Most mods that modify the behavior of death ragdolls (Reagdoll, Artagdoll, especially Fedhoria.) - Mods that automatically remove death ragdolls (it will delete all ragdolled NPCs, even if they're still alive! Try the built-in automatic corpse removal instead.) ## Future plans diff --git a/lua/zcnpci/modules/falling_legs.lua b/lua/zcnpci/modules/falling_legs.lua index 4b48c66..bed1e9c 100644 --- a/lua/zcnpci/modules/falling_legs.lua +++ b/lua/zcnpci/modules/falling_legs.lua @@ -157,7 +157,7 @@ function MODULE:Init() if seq then self:ResetSequence(seq) end local target = self:GetTarget() - + self:SetPlaybackRate(1) self.LastCollideTime = 0 self.LastGroundCollideTime = 0 @@ -298,13 +298,10 @@ function MODULE:PhysicsSimulate(phys, dt) ent:SetPos(target:GetPos()) ent:SetModel(target:GetModel()) - if target:GetNumBodyGroups() > 0 then - local i = 1 - while (i <= target:GetNumBodyGroups()) do - ent:SetBodygroup(i, target:GetBodygroup(i)) + ent:SetSkin(ragdoll:GetSkin()) - i = i + 1 - end + for i = 0, ragdoll:GetNumBodyGroups() - 1 do + ent:SetBodygroup(i, ragdoll:GetBodygroup(i)) end ent:Spawn()