Fix up fast zombie pounce behavior.
Pounces no longer hit the floor. Pouncing facing down will no longer pounce upwards. Reduced pounce hit box size 32 -> 24
This commit is contained in:
parent
e76f3779d8
commit
20b510af8a
2 changed files with 19 additions and 13 deletions
|
@ -19,8 +19,8 @@ SWEP.Primary.Delay = 0.32
|
||||||
|
|
||||||
SWEP.PounceDamage = 10
|
SWEP.PounceDamage = 10
|
||||||
SWEP.PounceDamageType = DMG_IMPACT
|
SWEP.PounceDamageType = DMG_IMPACT
|
||||||
SWEP.PounceReach = 32
|
SWEP.PounceReach = 20
|
||||||
SWEP.PounceSize = 16
|
SWEP.PounceSize = 12
|
||||||
SWEP.PounceStartDelay = 0.5
|
SWEP.PounceStartDelay = 0.5
|
||||||
SWEP.PounceDelay = 1.25
|
SWEP.PounceDelay = 1.25
|
||||||
SWEP.PounceVelocity = 700
|
SWEP.PounceVelocity = 700
|
||||||
|
@ -85,22 +85,28 @@ function SWEP:Think()
|
||||||
if owner:IsOnGround() or owner:WaterLevel() >= 2 then
|
if owner:IsOnGround() or owner:WaterLevel() >= 2 then
|
||||||
self:StopPounce()
|
self:StopPounce()
|
||||||
else
|
else
|
||||||
|
local dir = owner:GetAimVector()
|
||||||
|
dir.z = math.Clamp(dir.z, -0.5, 0.9)
|
||||||
|
dir:Normalize()
|
||||||
|
|
||||||
owner:LagCompensation(true)
|
owner:LagCompensation(true)
|
||||||
|
|
||||||
local hit = false
|
local traces = owner:PenetratingMeleeTrace(self.PounceReach, self.PounceSize, nil, owner:LocalToWorld(owner:OBBCenter()), dir)
|
||||||
local traces = owner:PenetratingMeleeTrace(self.PounceReach, self.PounceSize, nil, owner:LocalToWorld(owner:OBBCenter()))
|
|
||||||
local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.PounceDamage)
|
local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.PounceDamage)
|
||||||
|
|
||||||
|
local hit = false
|
||||||
for _, trace in ipairs(traces) do
|
for _, trace in ipairs(traces) do
|
||||||
if not trace.Hit then continue end
|
if not trace.Hit then continue end
|
||||||
|
|
||||||
hit = true
|
|
||||||
|
|
||||||
if trace.HitWorld then
|
if trace.HitWorld then
|
||||||
self:MeleeHitWorld(trace)
|
if trace.HitNormal.z < 0.8 then
|
||||||
|
hit = true
|
||||||
|
self:MeleeHitWorld(trace)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local ent = trace.Entity
|
local ent = trace.Entity
|
||||||
if ent and ent:IsValid() then
|
if ent and ent:IsValid() then
|
||||||
|
hit = true
|
||||||
self:MeleeHit(ent, trace, damage, 10)
|
self:MeleeHit(ent, trace, damage, 10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -218,12 +224,11 @@ function SWEP:StartPounce()
|
||||||
owner:EmitSound("NPC_FastZombie.Scream")
|
owner:EmitSound("NPC_FastZombie.Scream")
|
||||||
end
|
end
|
||||||
|
|
||||||
local dir = owner:GetAimVector()
|
local ang = owner:EyeAngles()
|
||||||
dir.z = math.max(0.25, dir.z)
|
ang.pitch = math.min(-20, ang.pitch)
|
||||||
dir:Normalize()
|
|
||||||
|
|
||||||
owner:SetGroundEntity(NULL)
|
owner:SetGroundEntity(NULL)
|
||||||
owner:SetVelocity((1 - 0.5 * (owner:GetLegDamage() / GAMEMODE.MaxLegDamage)) * self.PounceVelocity * dir)
|
owner:SetVelocity((1 - 0.5 * (owner:GetLegDamage() / GAMEMODE.MaxLegDamage)) * self.PounceVelocity * ang:Forward())
|
||||||
owner:SetAnimation(PLAYER_JUMP)
|
owner:SetAnimation(PLAYER_JUMP)
|
||||||
else
|
else
|
||||||
self:SetNextSecondaryFire(CurTime())
|
self:SetNextSecondaryFire(CurTime())
|
||||||
|
|
|
@ -505,11 +505,12 @@ function meta:MeleeTrace(distance, size, filter, start)
|
||||||
return self:TraceHull(distance, MASK_SOLID, size, filter, start)
|
return self:TraceHull(distance, MASK_SOLID, size, filter, start)
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:PenetratingMeleeTrace(distance, size, prehit, start)
|
function meta:PenetratingMeleeTrace(distance, size, prehit, start, dir)
|
||||||
start = start or self:GetShootPos()
|
start = start or self:GetShootPos()
|
||||||
|
dir = dir or self:GetAimVector()
|
||||||
|
|
||||||
local t = {}
|
local t = {}
|
||||||
local trace = {start = start, endpos = start + self:GetAimVector() * distance, filter = self:GetMeleeFilter(), mask = MASK_SOLID, mins = Vector(-size, -size, -size), maxs = Vector(size, size, size)}
|
local trace = {start = start, endpos = start + dir * distance, filter = self:GetMeleeFilter(), mask = MASK_SOLID, mins = Vector(-size, -size, -size), maxs = Vector(size, size, size)}
|
||||||
local onlyhitworld
|
local onlyhitworld
|
||||||
for i=1, 50 do
|
for i=1, 50 do
|
||||||
local tr = util.TraceHull(trace)
|
local tr = util.TraceHull(trace)
|
||||||
|
|
Loading…
Reference in a new issue