Giga Gore Child now cannot throw while feigning

Addresses https://github.com/JetBoom/zombiesurvival/issues/122
This commit is contained in:
JetBoom 2015-04-19 06:15:54 -04:00
parent f92ab98363
commit 95422d5a54
2 changed files with 16 additions and 8 deletions

View file

@ -42,7 +42,7 @@ function SWEP:PrimaryAttack()
end end
function SWEP:SecondaryAttack() 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:SetThrowTime(CurTime() + self.ThrowDelay)
self.Owner:DoReloadEvent() -- Handled in the class file. Fires the throwing anim. 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 if self:GetThrowing() and CurTime() >= self:GetThrowTime() then
self:SetThrowTime(0) 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 if SERVER then
local ent = ents.Create("prop_thrownbaby") local ent = ents.Create("prop_thrownbaby")
if ent:IsValid() then if ent:IsValid() then
ent:SetPos(self.Owner:GetShootPos()) ent:SetPos(owner:GetShootPos())
ent:SetAngles(AngleRand()) ent:SetAngles(AngleRand())
ent:SetOwner(self.Owner) ent:SetOwner(owner)
ent:Spawn() ent:Spawn()
local phys = ent:GetPhysicsObject() local phys = ent:GetPhysicsObject()
if phys:IsValid() then if phys:IsValid() then
phys:Wake() phys:Wake()
phys:SetVelocityInstantaneous(self.Owner:GetAimVector() * 500) phys:SetVelocityInstantaneous(owner:GetAimVector() * 500)
phys:AddAngleVelocity(VectorRand() * math.Rand(200, 300)) phys:AddAngleVelocity(VectorRand() * math.Rand(200, 300))
ent:SetPhysicsAttacker(self.Owner) ent:SetPhysicsAttacker(owner)
end end
end end
end end

View file

@ -3,6 +3,7 @@
GM.ProfilerNodes = {} GM.ProfilerNodes = {}
GM.ProfilerFolder = "zsprofiler" GM.ProfilerFolder = "zsprofiler"
GM.ProfilerFolderPreMade = "profiler_premade" GM.ProfilerFolderPreMade = "profiler_premade"
GM.ProfilerVersion = 0
GM.MaxProfilerNodes = 128 GM.MaxProfilerNodes = 128
hook.Add("Initialize", "ZSProfiler", function() hook.Add("Initialize", "ZSProfiler", function()
@ -39,7 +40,7 @@ end
function GM:SaveProfiler() function GM:SaveProfiler()
if not self:ProfilerEnabled() or self.ProfilerIsPreMade then return end 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 end
function GM:LoadProfiler() function GM:LoadProfiler()
@ -47,7 +48,12 @@ function GM:LoadProfiler()
local filename = self:GetProfilerFile() local filename = self:GetProfilerFile()
if file.Exists(filename, "DATA") then 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
end end