diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua index 68c15bb..2a3799d 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_fastzombie.lua @@ -19,8 +19,8 @@ SWEP.Primary.Delay = 0.32 SWEP.PounceDamage = 10 SWEP.PounceDamageType = DMG_IMPACT -SWEP.PounceReach = 32 -SWEP.PounceSize = 16 +SWEP.PounceReach = 20 +SWEP.PounceSize = 12 SWEP.PounceStartDelay = 0.5 SWEP.PounceDelay = 1.25 SWEP.PounceVelocity = 700 @@ -85,22 +85,28 @@ function SWEP:Think() if owner:IsOnGround() or owner:WaterLevel() >= 2 then self:StopPounce() else + local dir = owner:GetAimVector() + dir.z = math.Clamp(dir.z, -0.5, 0.9) + dir:Normalize() + owner:LagCompensation(true) - local hit = false - local traces = owner:PenetratingMeleeTrace(self.PounceReach, self.PounceSize, nil, owner:LocalToWorld(owner:OBBCenter())) + local traces = owner:PenetratingMeleeTrace(self.PounceReach, self.PounceSize, nil, owner:LocalToWorld(owner:OBBCenter()), dir) local damage = self:GetDamage(self:GetTracesNumPlayers(traces), self.PounceDamage) + local hit = false for _, trace in ipairs(traces) do if not trace.Hit then continue end - hit = true - if trace.HitWorld then - self:MeleeHitWorld(trace) + if trace.HitNormal.z < 0.8 then + hit = true + self:MeleeHitWorld(trace) + end else local ent = trace.Entity if ent and ent:IsValid() then + hit = true self:MeleeHit(ent, trace, damage, 10) end end @@ -218,12 +224,11 @@ function SWEP:StartPounce() owner:EmitSound("NPC_FastZombie.Scream") end - local dir = owner:GetAimVector() - dir.z = math.max(0.25, dir.z) - dir:Normalize() + local ang = owner:EyeAngles() + ang.pitch = math.min(-20, ang.pitch) 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) else self:SetNextSecondaryFire(CurTime()) diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua index b06c0c1..cf54f90 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua @@ -505,11 +505,12 @@ function meta:MeleeTrace(distance, size, filter, start) return self:TraceHull(distance, MASK_SOLID, size, filter, start) end -function meta:PenetratingMeleeTrace(distance, size, prehit, start) +function meta:PenetratingMeleeTrace(distance, size, prehit, start, dir) start = start or self:GetShootPos() + dir = dir or self:GetAimVector() 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 for i=1, 50 do local tr = util.TraceHull(trace)