Giga Gore Child now cannot throw while feigning
Addresses https://github.com/JetBoom/zombiesurvival/issues/122
This commit is contained in:
parent
f92ab98363
commit
95422d5a54
2 changed files with 16 additions and 8 deletions
|
@ -42,7 +42,7 @@ function SWEP:PrimaryAttack()
|
|||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
if self:IsSwinging() or CurTime() <= self:GetNextSecondaryAttack() then return end
|
||||
if self:IsSwinging() or CurTime() <= self:GetNextSecondaryAttack() or IsValid(self.Owner.FeignDeath) then return end
|
||||
|
||||
self:SetThrowTime(CurTime() + self.ThrowDelay)
|
||||
self.Owner:DoReloadEvent() -- Handled in the class file. Fires the throwing anim.
|
||||
|
@ -54,23 +54,25 @@ function SWEP:CheckThrow()
|
|||
if self:GetThrowing() and CurTime() >= self:GetThrowTime() then
|
||||
self:SetThrowTime(0)
|
||||
|
||||
self.Owner:EmitSound("weapons/slam/throw.wav", 70, math.random(78, 82))
|
||||
local owner = self.Owner
|
||||
|
||||
owner:EmitSound("weapons/slam/throw.wav", 70, math.random(78, 82))
|
||||
|
||||
if SERVER then
|
||||
local ent = ents.Create("prop_thrownbaby")
|
||||
if ent:IsValid() then
|
||||
ent:SetPos(self.Owner:GetShootPos())
|
||||
ent:SetPos(owner:GetShootPos())
|
||||
ent:SetAngles(AngleRand())
|
||||
ent:SetOwner(self.Owner)
|
||||
ent:SetOwner(owner)
|
||||
ent:Spawn()
|
||||
|
||||
local phys = ent:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 500)
|
||||
phys:SetVelocityInstantaneous(owner:GetAimVector() * 500)
|
||||
phys:AddAngleVelocity(VectorRand() * math.Rand(200, 300))
|
||||
|
||||
ent:SetPhysicsAttacker(self.Owner)
|
||||
ent:SetPhysicsAttacker(owner)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
GM.ProfilerNodes = {}
|
||||
GM.ProfilerFolder = "zsprofiler"
|
||||
GM.ProfilerFolderPreMade = "profiler_premade"
|
||||
GM.ProfilerVersion = 0
|
||||
GM.MaxProfilerNodes = 128
|
||||
|
||||
hook.Add("Initialize", "ZSProfiler", function()
|
||||
|
@ -39,7 +40,7 @@ end
|
|||
function GM:SaveProfiler()
|
||||
if not self:ProfilerEnabled() or self.ProfilerIsPreMade then return end
|
||||
|
||||
file.Write(self:GetProfilerFile(), Serialize(self.ProfilerNodes))
|
||||
file.Write(self:GetProfilerFile(), Serialize({Nodes = self.ProfilerNodes, Version = self.ProfilerVersion}))
|
||||
end
|
||||
|
||||
function GM:LoadProfiler()
|
||||
|
@ -47,7 +48,12 @@ function GM:LoadProfiler()
|
|||
|
||||
local filename = self:GetProfilerFile()
|
||||
if file.Exists(filename, "DATA") then
|
||||
self.ProfilerNodes = Deserialize(file.Read(filename, "DATA"))
|
||||
local data = Deserialize(file.Read(filename, "DATA"))
|
||||
if not data.Version and self.ProfilerVersion == 0 then -- old, versionless format
|
||||
self.ProfilerNodes = data
|
||||
elseif data.Nodes and data.Version >= self.ProfilerVersion then
|
||||
self.ProfilerNodes = data.Nodes
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue