Skip to content

Commit

Permalink
Fixes to "stopsounds" and better whitelisting code
Browse files Browse the repository at this point in the history
- Fixed "stopsounds" concommand not working on radios.
- Added GUI cases and controls to resume radios stopped by "stopsounds".
- Added context menu options for resuming radios stopped by "stopsounds".
- Improved Dropbox support with CFC HTTP Whitelist.
- Improved URL checks for addon's whitelist.
- Improved URL checks for CFC HTTP Whitelist.
- Improved rendering performance of GUIs a bit..
- Refactored auto converters for URLs and removed dead YouTube code.
- Added max age of files (7 days) to the cache system. Older cache files are deleted.
- Moved the file cache location to "cache-sv" and "cache-cl" for server/client. The old cache directory is wiped.
  • Loading branch information
Grocel committed Oct 26, 2023
1 parent 57cb64a commit d902a75
Show file tree
Hide file tree
Showing 45 changed files with 1,745 additions and 1,300 deletions.
16 changes: 2 additions & 14 deletions lua/entities/base_streamradio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ AddCSLuaFile()
DEFINE_BASECLASS("base_anim")

local StreamRadioLib = StreamRadioLib

local LIBNetwork = StreamRadioLib.Network
local LIBWire = StreamRadioLib.Wire
local LIBUtil = StreamRadioLib.Util
Expand Down Expand Up @@ -571,7 +572,6 @@ function ENT:InternalSlowThink()

StreamRadioLib.RegisterRadio(self)

self._isDebugCache = nil
self._beingLookedAtCache = nil
self._showDebugCache = nil

Expand Down Expand Up @@ -654,26 +654,14 @@ if SERVER then
end
end


function ENT:IsDebug()
if self._isDebugCache ~= nil then
return self._isDebugCache
end

local isDebug = LIBUtil.IsDebug()
self._isDebugCache = isDebug

return isDebug
end

function ENT:ShowDebug()
if self._showDebugCache ~= nil then
return self._showDebugCache
end

self._showDebugCache = false

if not self:IsDebug() then
if not LIBUtil.IsDebug() then
return false
end

Expand Down
5 changes: 3 additions & 2 deletions lua/entities/base_streamradio_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ AddCSLuaFile()
DEFINE_BASECLASS("base_streamradio")

local StreamRadioLib = StreamRadioLib
local LIBNetwork = StreamRadioLib.Network

local LIBModel = StreamRadioLib.Model
local LIBSkin = StreamRadioLib.Skin
local LIBWire = StreamRadioLib.Wire
local LIBUtil = StreamRadioLib.Util

ENT.RenderGroup = RENDERGROUP_BOTH
ENT.Spawnable = false
Expand Down Expand Up @@ -322,7 +323,7 @@ function ENT:SetupGui(callback)
GUI:SetEntity(self)
GUI:ActivateNetworkedMode()

if SERVER and self:IsDebug() then
if SERVER and LIBUtil.IsDebug() then
self:SetEnableDebug(true)
end

Expand Down
13 changes: 10 additions & 3 deletions lua/entities/sent_streamradio/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ function ENT:ApplyTuneSound()
return
end

if stream:IsKilled() then
self.streamswitchsound = true
self:StopTuneSound()
return
end

if IsValid(stream:GetChannel()) then
self:FadeoutTuneSound()
return
Expand Down Expand Up @@ -159,8 +165,9 @@ function ENT:Initialize()
self:ApplyTuneSound()
end)

stream:SetEvent("OnError", self, function()
stream:SetEvent("OnError", self, function(this, errorCode)
if not IsValid(self) then return end

self:ApplyTuneSound()
end)

Expand Down Expand Up @@ -581,7 +588,7 @@ function ENT:OnMasterradioChange(masterradio, oldmasterradio)
end

this_st:TimerRemove(timername)
this_st:Retry()
this_st:Reconnect()
end)

this_st:SetEvent("OnError", eventname, function()
Expand Down Expand Up @@ -622,7 +629,7 @@ function ENT:OnMasterradioChange(masterradio, oldmasterradio)
return
end

this_st:Retry()
this_st:Reconnect()
end)
end)
end
Expand Down
Loading

0 comments on commit d902a75

Please sign in to comment.