mirror of
https://github.com/CapsAdmin/wowozela.git
synced 2025-03-04 03:13:27 -05:00
More optimizations
This commit is contained in:
parent
c440eaaabc
commit
e0ffc96650
@ -400,9 +400,8 @@ do -- sample meta
|
||||
if not snd or err then return end
|
||||
processing = false
|
||||
self.paused = true
|
||||
self.looping = true
|
||||
self.obj = snd
|
||||
snd:EnableLooping(true)
|
||||
snd:EnableLooping(sampler.Looping)
|
||||
snd:SetVolume(wowozela.intvolume or 1)
|
||||
snd:SetPlaybackRate((sampler.Pitch or 100) / 100)
|
||||
snd:Set3DEnabled(sampler.Player ~= LocalPlayer())
|
||||
@ -475,6 +474,20 @@ do -- sample meta
|
||||
end
|
||||
end
|
||||
|
||||
function META:SetLooping(loop)
|
||||
local lastVal = self.Looping
|
||||
|
||||
if lastVal ~= loop then
|
||||
self.Looping = loop
|
||||
for k,v in pairs(self.Samples) do
|
||||
if IsValid(v.obj) then
|
||||
v.obj:EnableLooping(loop)
|
||||
v.obj:SetTime(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function META:SetVolume(num)
|
||||
local lastVol = self.Volume
|
||||
self.Volume = math.Clamp(num or self.Volume, 0.0001, 1)
|
||||
@ -609,23 +622,9 @@ do -- sample meta
|
||||
|
||||
self.WasPlaying = true
|
||||
local wep = self.Player:GetActiveWeapon()
|
||||
if wep.GetLooping and not wep:GetLooping() then
|
||||
for k,v in pairs(self.Samples) do
|
||||
if IsValid(v.obj) and v.looping then
|
||||
v.obj:EnableLooping(false)
|
||||
v.obj:SetTime(0)
|
||||
v.looping = false
|
||||
end
|
||||
end
|
||||
else
|
||||
for k,v in pairs(self.Samples) do
|
||||
if IsValid(v.obj) and not v.looping then
|
||||
v.obj:EnableLooping(true)
|
||||
v.obj:SetTime(0)
|
||||
v.looping = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local looping = IsValid(wep) and wep.GetLooping and wep:GetLooping()
|
||||
self:SetLooping(looping)
|
||||
|
||||
self:SetPitch(self:GetPlayerPitch())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user