Ragdoll panicking when midair or in lots of pain
This commit is contained in:
parent
9498fc4697
commit
3790041d17
2 changed files with 20 additions and 2 deletions
|
|
@ -108,6 +108,7 @@ local npc_targeting_enabled = CreateConVar("zcnpci_npc_targeting_enabled", "1",
|
|||
-- 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})
|
||||
local flailing_panic_airbone_check_distance = CreateConVar("zcnpci_flailing_panic_airbone_check_distance", "128", {FCVAR_ARCHIVE, FCVAR_REPLICATED})
|
||||
|
||||
-- Writhing
|
||||
local writhing_strength = CreateConVar("zcnpci_writhing_strength", "1.0", {FCVAR_ARCHIVE, FCVAR_REPLICATED})
|
||||
|
|
@ -428,6 +429,17 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
target.StartDie = cur_time
|
||||
end
|
||||
|
||||
local distance_check = util.TraceLine({
|
||||
start = target:GetPos(),
|
||||
endpos = target:GetPos() + Vector(0, 0, -128),
|
||||
filter = {target},
|
||||
mask = MASK_SOLID
|
||||
}).Hit
|
||||
|
||||
if !distance_check then
|
||||
target.StartDie = cur_time
|
||||
end
|
||||
|
||||
if ((CurTime() - self.LastFakeUpCheck) >= 1.0) and (can_unfake:GetBool()) then
|
||||
self.LastFakeUpCheck = CurTime()
|
||||
|
||||
|
|
@ -556,7 +568,13 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
local vel = phys:GetVelocity()
|
||||
local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) * flailing_playback_rate:GetFloat()
|
||||
|
||||
if target:IsOnFire() then
|
||||
target.panicking = (
|
||||
target:IsOnFire() or
|
||||
(!distance_check) or
|
||||
(target.organism.pain > 80)
|
||||
)
|
||||
|
||||
if target.panicking then
|
||||
pbr = pbr * flailing_panic_multiplier:GetFloat()
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
local vel = phys:GetVelocity()
|
||||
local pbr = math_Clamp(vel.z / -600, 0.5, 1.5) * flailing_playback_rate:GetFloat()
|
||||
|
||||
if target:IsOnFire() then
|
||||
if target.panicking then
|
||||
pbr = pbr * flailing_panic_multiplier:GetFloat()
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue