Ragdoll panicking when on fire, more configurations

This commit is contained in:
toasterpanic 2026-06-05 12:05:44 -04:00
parent ad9d0424bc
commit 9498fc4697
3 changed files with 33 additions and 5 deletions

View file

@ -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.")

View file

@ -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")

View file

@ -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