From 9498fc4697c083fdd13dd4fd8904aab03241bfe5 Mon Sep 17 00:00:00 2001 From: toasterpanic Date: Fri, 5 Jun 2026 12:05:44 -0400 Subject: [PATCH] Ragdoll panicking when on fire, more configurations --- lua/autorun/client/zcnpci_menu.lua | 8 +++++++- lua/zcnpci/modules/falling_legs.lua | 15 +++++++++++++-- lua/zcnpci/modules/falling_torso.lua | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/lua/autorun/client/zcnpci_menu.lua b/lua/autorun/client/zcnpci_menu.lua index 4d9c5d7..1b220b6 100644 --- a/lua/autorun/client/zcnpci_menu.lua +++ b/lua/autorun/client/zcnpci_menu.lua @@ -51,7 +51,13 @@ local function PopulateRagdollSBXToolMenu(pnl) pnl:ControlHelp("How long the ragdoll should hold its wound.") pnl:NumSlider("Writhing strength", "zcnpci_writhing_strength", 0, 5, 3) - pnl:ControlHelp("How hard should the ragdoll wriggle/writhe. 1 is default.") + pnl:ControlHelp("How hard should the ragdoll wriggle/writhe.") + + pnl:NumSlider("Flailing speed multiplier", "zcnpci_flailing_playback_rate", 0, 12, 3) + pnl:ControlHelp("How fast or slow should the NPC flail by default.") + + pnl:NumSlider("Flailing speed multiplier when panicking", "zcnpci_flailing_playback_rate", 0, 12, 3) + pnl:ControlHelp("How fast or slow should the NPC flail when panicking (on fire, falling, etc.).") pnl:NumSlider("Death timer", "zcnpci_death_timer", -1, 600, 3) pnl:ControlHelp("After an NPC is ragdolled for longer than this timer, they will die instantly. Set to -1 to disable.") diff --git a/lua/zcnpci/modules/falling_legs.lua b/lua/zcnpci/modules/falling_legs.lua index 64794b7..51ddfbd 100644 --- a/lua/zcnpci/modules/falling_legs.lua +++ b/lua/zcnpci/modules/falling_legs.lua @@ -105,6 +105,13 @@ local death_timer = CreateConVar("zcnpci_death_timer", "-1", {FCVAR_ARCHIVE, FCV -- Targeting local npc_targeting_enabled = CreateConVar("zcnpci_npc_targeting_enabled", "1", {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Should NPCs target downed NPCs") +-- Flailing +local flailing_playback_rate = CreateConVar("zcnpci_flailing_playback_rate", "1.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) +local flailing_panic_multiplier = CreateConVar("zcnpci_flailing_panic_multiplier", "2.5", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) + +-- Writhing +local writhing_strength = CreateConVar("zcnpci_writhing_strength", "1.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) + --[[------------------------------------------------------------------------- Tug function Applies a random impulse to one of the leg bones. @@ -385,7 +392,7 @@ function MODULE:PhysicsSimulate(phys, dt) end -- Force multiplier - local f = target.organism.consciousness + local f = target.organism.consciousness * writhing_strength:GetFloat() local minimum_down_timer = 0 if target.StartDie then @@ -547,7 +554,11 @@ function MODULE:PhysicsSimulate(phys, dt) -- Logic for fall animation local vel = phys:GetVelocity() - local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) + local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) * flailing_playback_rate:GetFloat() + + if target:IsOnFire() then + pbr = pbr * flailing_panic_multiplier:GetFloat() + end if self:GetSequence() ~= self:LookupSequence("Choked_Barnacle") or self:GetPlaybackRate() ~= pbr then local seq_idle = self:LookupSequence("Choked_Barnacle") diff --git a/lua/zcnpci/modules/falling_torso.lua b/lua/zcnpci/modules/falling_torso.lua index bf89e80..5b60599 100644 --- a/lua/zcnpci/modules/falling_torso.lua +++ b/lua/zcnpci/modules/falling_torso.lua @@ -35,6 +35,12 @@ local cv_anim_roll_duration = CreateConVar("zcnpci_falling_anim_roll_duration", local cv_anim_roll_impact_threshold = CreateConVar("zcnpci_falling_anim_roll_impact_threshold", "300", {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Мин. скорость удара для запуска анимации") local cv_anim_roll_playback_rate = CreateConVar("zcnpci_falling_anim_roll_playback_rate", "3.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Скорость воспроизведения анимации") +local flailing_playback_rate = CreateConVar("zcnpci_flailing_playback_rate", "1.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) +local flailing_panic_multiplier = CreateConVar("zcnpci_flailing_panic_multiplier", "2.5", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) + +-- Writhing +local writhing_strength = CreateConVar("zcnpci_writhing_strength", "1.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED}) + -- Do it! function MODULE:DoTwitch() @@ -187,7 +193,7 @@ function MODULE:PhysicsSimulate(phys, dt) -- --- логика идет нахуй -- Force multiplier - local f = target.organism.consciousness + local f = target.organism.consciousness * writhing_strength:GetFloat() -- ебаная логика для regmod if ragmod and ragmod:IsRagmodRagdoll(target) then @@ -233,7 +239,12 @@ function MODULE:PhysicsSimulate(phys, dt) -- логика для анимации переката local vel = phys:GetVelocity() - local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) + local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) * flailing_playback_rate:GetFloat() + + if target:IsOnFire() then + pbr = pbr * flailing_panic_multiplier:GetFloat() + end + -- падения и ебаная скорость -- если мы не в.. а впрочем иди нахуй if self:GetSequence() ~= self:LookupSequence("idleonfire") or self:GetPlaybackRate() ~= pbr then