From 72c451540218b065e7b818d4e488688670c9ade5 Mon Sep 17 00:00:00 2001 From: toasterpanic Date: Sun, 31 May 2026 21:12:19 -0400 Subject: [PATCH] Various fixings --- README.md | 14 ++++++++++++++ lua/zcnpci.lua | 11 +++++++++++ lua/zcnpci/modules/stumble_legs.lua | 15 +++++---------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 37be3b0..a7858bb 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,20 @@ It is, however, not compatbile with: ## Todo list +Urgent shit: + +- Large amounts of damage (such as shotguns) fling NPC ragdolls to ridiculous lengths, sometimes severely injuring the player. While this is absolutely fucking hilarious, it also isn't the best experience. + +Stuff to do: + +- Facial expressions +- Actual specific reactions to being on fire / falling / lots of pain +- Wound holding +- NPCs should not stumble when dead +- Generally improve stumbling + +Stuff to fix possibly: + - NPC targeting works, but works really weirdly (sometimes it just. keeps targeting corpses when it shouldn't.) Why? Who knows!!!! - Look into improving the unfake animation? Really scared to try and touch it again but it would be worthwhile diff --git a/lua/zcnpci.lua b/lua/zcnpci.lua index 802acd2..a50347e 100644 --- a/lua/zcnpci.lua +++ b/lua/zcnpci.lua @@ -121,6 +121,11 @@ hook.Add("CreateEntityRagdoll", "zcnpci", function(ent, ragdoll) ragdoll:GetPhysicsObject():SetVelocity(ent.npcfakeknockback) end + local velocity = ragdoll:GetPhysicsObject():GetVelocity() + + print(velocity) + print(max_clamp) + -- For some reason, citizen types such as rebels, medics, refugees, etc. use a keyvalue. -- That keyvalue does not transfer over to the ragdoll, despite it looking like the NPC, -- and you have to manually save it to the ragdoll to be able to make it work. @@ -160,6 +165,12 @@ hook.Add("HomigradDamage", "zcnpci", function(ent, dmginfo) if dmginfo:IsDamageType(DMG_BULLET + DMG_BUCKSHOT + DMG_BLAST) then if dmginfo:GetDamage() > 3 then table.insert(npcs_to_fake, ent) + + local attacker_angle = dmginfo:GetAttacker():EyeAngles() + + local normal = attacker_angle:Forward(normal) + + ent.npcfakeknockback = normal * dmginfo:GetDamage() * 0 end elseif dmginfo:IsDamageType(DMG_CLUB + DMG_SLASH) then local attacker = dmginfo:GetAttacker() diff --git a/lua/zcnpci/modules/stumble_legs.lua b/lua/zcnpci/modules/stumble_legs.lua index 917f36c..85a24e4 100644 --- a/lua/zcnpci/modules/stumble_legs.lua +++ b/lua/zcnpci/modules/stumble_legs.lua @@ -293,6 +293,11 @@ function MODULE:PhysicsSimulate(phys, dt) local st = stumble_time:GetFloat() + -- End stumbling if player is dead + if !target.organism or !target.organism.alive then + st = 0 + end + if (st <= 0) then self:Remove() return false @@ -300,16 +305,6 @@ function MODULE:PhysicsSimulate(phys, dt) local f = 1 - (CurTime() - self.Created) / st - --RagMod Reworked support - if ragmod and ragmod:IsRagmodRagdoll(target) then - local owner = target:GetOwningPlayer() - if !IsValid(owner) or !owner:Alive() then - f = 0 - else - f = 1 - end - end - if (f <= 0) then self:Remove() return false