I'm not sure if this is a bug or not, I dealt with this back in 12 but I thought it would have been worked out with this update.
I'm working on shotgun reloading. Begine reload works fine, and so does the first shell. The second shell, and any others following it are not played at all, the weapon just hangs in the air, but ammo changes places like it should be. When reloading is complete, the reload finish animation plays just fine. The only issue I have is with the insert shell animation.
I get no errors, and this only happens in multiplayer. I've seen several fixes that involve running through the Think function but I want to stay away from that. Nothing changes when I run the animation through server only, and running the animation through client only get me no animations at all
And here's my code. [LUA]function SWEP:Reload()
if (timer.Exists("ShotgunReload")) then return end
self.Weapon:SetNextPrimaryFire(CurTime() + 1) -- wait one second before you can shoot again
self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START) -- sending start reload anim
if (SERVER) then
self.Owner:SetFOV( 0, 0.15 )
self:SetIronsights(false)
end
timer.Create("ShotgunReload", .3, 0, function() self:InsertShell() end)
-- put a variable here to change reload time across different sweps
end
function SWEP:InsertShell()
if IsFirstTimePredicted() then
local curwep = self.Owner:GetActiveWeapon()
if curwep:GetClass() != self.Gun then
timer.Destroy("ShotgunReload")
return end
if (self.Weapon:Clip1() >= self.Primary.ClipSize or self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0) then
-- if clip is full or ammo is out, then...
self.Weapon:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) -- send the pump anim
timer.Destroy("ShotgunReload") -- kill the timer
elseif (self.Weapon:Clip1() <= self.Primary.ClipSize and self.Owner:GetAmmoCount(self.Primary.Ammo) >= 0) then
self.Weapon:SendWeaponAnim(ACT_VM_RELOAD) --insert a shell
self.Owner:RemoveAmmo(1, self.Primary.Ammo, false) -- out of the frying pan
self.Weapon:SetClip1(self.Weapon:Clip1() + 1) -- into the fire
end
end
end[/LUA]
Is this a bug, or amd I missing something?
80 views and not a word. If there is no known fix, someone please say so. I don't want to cloud up the bug report thread without reason.
Sorry, you need to Log In to post a reply to this thread.