From 8ffd79a39317858074ad42f8aadd572bb4515a69 Mon Sep 17 00:00:00 2001 From: Grocel Date: Thu, 4 Jan 2024 23:43:19 +0100 Subject: [PATCH] Improved error handling and fixed broken loading --- lua/autorun/streamradio_loader.lua | 4 +- .../{init.lua => _include.lua} | 72 +++---------------- lua/streamradio_core/{load.lua => _load.lua} | 54 ++++++++------ lua/streamradio_core/classes.lua | 15 ++-- lua/streamradio_core/classes/base.lua | 3 + .../classes/base_listener.lua | 3 + lua/streamradio_core/classes/clientconvar.lua | 3 + .../classes/gui_controller.lua | 5 +- lua/streamradio_core/classes/rendertarget.lua | 4 +- .../classes/skin_controller.lua | 3 + lua/streamradio_core/classes/stream.lua | 3 + lua/streamradio_core/classes/ui/button.lua | 3 + lua/streamradio_core/classes/ui/debug.lua | 3 + .../classes/ui/highlighter.lua | 3 + lua/streamradio_core/classes/ui/image.lua | 3 + lua/streamradio_core/classes/ui/label.lua | 3 + .../classes/ui/label_fade.lua | 3 + lua/streamradio_core/classes/ui/list.lua | 3 + .../classes/ui/list_files.lua | 2 + lua/streamradio_core/classes/ui/panel.lua | 3 + .../classes/ui/progressbar.lua | 3 + .../classes/ui/radio/gui_browser.lua | 3 + .../classes/ui/radio/gui_errorbox.lua | 5 +- .../classes/ui/radio/gui_main.lua | 3 + .../classes/ui/radio/gui_player.lua | 3 + .../classes/ui/radio/gui_player_controls.lua | 3 + .../classes/ui/radio/gui_player_spectrum.lua | 3 + .../classes/ui/radio/list_playlists.lua | 3 + .../classes/ui/radio/list_playlistview.lua | 3 + .../classes/ui/round_panel.lua | 3 + lua/streamradio_core/classes/ui/scrollbar.lua | 3 + .../classes/ui/shadow_panel.lua | 3 + lua/streamradio_core/classes/ui/text.lua | 3 + lua/streamradio_core/classes/ui/textview.lua | 3 + lua/streamradio_core/classes/ui/tooltip.lua | 3 + lua/streamradio_core/client/cl_presets.lua | 2 +- lua/streamradio_core/filesystem.lua | 4 +- lua/streamradio_core/filesystem/_folder.lua | 3 + lua/streamradio_core/filesystem/_generic.lua | 3 + .../filesystem/addon-mx-radio.lua | 5 +- .../filesystem/addon-web-radio.lua | 5 +- .../filesystem/files-sound-folder.lua | 3 + lua/streamradio_core/filesystem/json.lua | 3 + lua/streamradio_core/filesystem/m3u.lua | 3 + lua/streamradio_core/filesystem/pls.lua | 3 + lua/streamradio_core/filesystem/shoutcast.lua | 3 + lua/streamradio_core/filesystem/vdf.lua | 3 + lua/streamradio_core/interface.lua | 11 +-- lua/streamradio_core/interfaces/cache.lua | 3 + lua/streamradio_core/interfaces/dropbox.lua | 3 + lua/streamradio_core/interfaces/file.lua | 3 + lua/streamradio_core/interfaces/online.lua | 3 + lua/streamradio_core/interfaces/shoutcast.lua | 3 + lua/streamradio_core/interfaces/youtube.lua | 3 + lua/streamradio_core/models.lua | 25 ++++--- .../models/111as_h500_radio.lua | 3 + lua/streamradio_core/models/_nm_speakers.lua | 3 + .../models/cs_office_radio.lua | 3 + lua/streamradio_core/models/cs_office_tv.lua | 3 + .../models/csgo_italy_radio.lua | 2 + lua/streamradio_core/models/default.lua | 2 + .../models/fallout3_jukebox.lua | 3 + .../models/hl2_crtscreen_big.lua | 3 + .../models/hl2_crtscreen_small.lua | 2 + lua/streamradio_core/models/hl2_radio.lua | 3 + lua/streamradio_core/models/hl2_speaker.lua | 2 + lua/streamradio_core/models/kankan_radio.lua | 3 + .../models/kresopolski_radio.lua | 3 + .../models/minecraft_jukebox.lua | 3 + .../models/minecraft_noteblock.lua | 2 + lua/streamradio_core/models/nm_screen.lua | 3 + lua/streamradio_core/models/plasma_tv.lua | 3 + lua/streamradio_core/models/portal_ball.lua | 3 + .../models/portal_gladosball.lua | 2 + lua/streamradio_core/models/portal_radio.lua | 3 + .../models/portal_speaker_big.lua | 2 + .../models/portal_speaker_small.lua | 2 + lua/streamradio_core/models/portal_turret.lua | 3 + .../models/sw_ghettoblaster.lua | 3 + lua/streamradio_core/models/sw_gramophone.lua | 3 + lua/streamradio_core/models/sw_jukebox.lua | 3 + lua/streamradio_core/models/sw_radio.lua | 3 + .../models/wire_monitor_big.lua | 3 + .../models/wire_monitor_small.lua | 2 + lua/streamradio_core/models/wire_speaker1.lua | 2 + lua/streamradio_core/models/wire_speaker2.lua | 2 + lua/streamradio_core/models/wire_speaker3.lua | 2 + .../models/wire_subwoofer_big.lua | 2 + .../models/wire_subwoofer_small.lua | 2 + lua/streamradio_core/server/sv_res.lua | 4 +- lua/streamradio_core/util.lua | 4 +- materials/3dstreamradio/_data/version.vmt | 4 +- 92 files changed, 312 insertions(+), 124 deletions(-) rename lua/streamradio_core/{init.lua => _include.lua} (69%) rename lua/streamradio_core/{load.lua => _load.lua} (86%) diff --git a/lua/autorun/streamradio_loader.lua b/lua/autorun/streamradio_loader.lua index d284cd6..849d3a8 100644 --- a/lua/autorun/streamradio_loader.lua +++ b/lua/autorun/streamradio_loader.lua @@ -117,8 +117,8 @@ do initStreamRadioLibGlobal() local status, loaded = xpcall(function() - AddCSLuaFile("streamradio_core/load.lua") - return include("streamradio_core/load.lua") + AddCSLuaFile("streamradio_core/_load.lua") + return include("streamradio_core/_load.lua") end, ErrorNoHaltWithStack) if not _G.StreamRadioLib then diff --git a/lua/streamradio_core/init.lua b/lua/streamradio_core/_include.lua similarity index 69% rename from lua/streamradio_core/init.lua rename to lua/streamradio_core/_include.lua index 4e51fc7..85f997a 100644 --- a/lua/streamradio_core/init.lua +++ b/lua/streamradio_core/_include.lua @@ -3,74 +3,22 @@ if not StreamRadioLib then return end local LIB = StreamRadioLib -local LIBLoadSH = LIB.LoadSH -local LIBLoadCL = LIB.LoadCL -local LIBLoadSV = LIB.LoadSV +local loadSH = LIB.LoadSH +local loadCL = LIB.LoadCL +local loadSV = LIB.LoadSV -if not LIBLoadSH then return end -if not LIBLoadCL then return end -if not LIBLoadSV then return end - -local g_ok = true - -local function loadSH(lua, ...) - local status, loaded = LIBLoadSH(lua, ...) - - if not status then - g_ok = false - return false - end - - if not loaded then - g_ok = false - return false - end - - return true -end - -local function loadCL(lua, ...) - local status, loaded = LIBLoadCL(lua, ...) - - if not status then - g_ok = false - return false - end - - if CLIENT and not loaded then - g_ok = false - return false - end - - return true -end - -local function loadSV(lua, ...) - local status, loaded = LIBLoadSV(lua, ...) - - if not status then - g_ok = false - return false - end - - if SERVER and not loaded then - g_ok = false - return false - end - - return true -end +if not loadSH then return end +if not loadCL then return end +if not loadSV then return end LIB.DataDirectory = "streamradio" do - local status, lib = LIBLoadSH("streamradio_core/external/neturl.lua") + local status, lib = loadSH("streamradio_core/external/neturl.lua") LIB.NetURL = nil - if not status then - g_ok = false - else + if status then LIB.NetURL = lib end end @@ -140,9 +88,5 @@ end StreamRadioLib.Cfchttp.Load() StreamRadioLib.Cache.Load() -if not g_ok then - return -end - return true diff --git a/lua/streamradio_core/load.lua b/lua/streamradio_core/_load.lua similarity index 86% rename from lua/streamradio_core/load.lua rename to lua/streamradio_core/_load.lua index a4c2ed0..1751133 100644 --- a/lua/streamradio_core/load.lua +++ b/lua/streamradio_core/_load.lua @@ -129,8 +129,6 @@ local function registerErrorFeedbackHook() end end -local g_lua_path = SERVER and "lsv" or "lcl" - local function luaExists(lua) lua = tostring(lua or "") lua = string.lower(lua or "") @@ -140,22 +138,16 @@ local function luaExists(lua) end if g_exists_lua[lua] ~= nil then - -- Cache the results for an even faster performance return g_exists_lua[lua] or false end - -- We use a manual implementation, because file.Exists() on "LUA" paths can be VERY slow on some systems. - -- See https://github.com/Facepunch/garrysmod-issues/issues/5674 - - local f = file.Open(lua, "r", g_lua_path) + local exists = file.Exists(lua, "LUA") - if not f then + if not exists then g_exists_lua[lua] = false return false end - f:Close() - g_exists_lua[lua] = true return true end @@ -215,11 +207,24 @@ local function saveInclude(lua, force) end local status, result = xpcall(function() - if not luaExists(lua) then - error("Couldn't include file '" .. lua .. "' (File not found)") + if SERVER then + -- Too slow on clientside on some servers + -- See: https://github.com/Facepunch/garrysmod-issues/issues/5674 + + if not luaExists(lua) then + error("Couldn't include file '" .. lua .. "' (File not found)") + return nil + end end - return include(lua) + local r = include(lua) + + if not r then + error("Couldn't include file '" .. lua .. "' (Error during execution or file not found)") + return nil + end + + return r end, throwError) if not status then @@ -253,11 +258,11 @@ function LIB.LoadSV(lua, force) return saveInclude(lua, force) end -function LIB.LuaExists(lua) - return luaExists(lua) -end +local g_loadTime = 0 local function loadAddon() + local loadStartTime = SysTime() + local VERSION = VERSION or 0 local versionError = nil @@ -285,7 +290,7 @@ local function loadAddon() LIB.Loaded = true LIB.Loading = true - local status, loaded = LIB.LoadSH("streamradio_core/init.lua") + local status, loaded = LIB.LoadSH("streamradio_core/_include.lua") if not status then g_loader_ok = false @@ -301,6 +306,8 @@ local function loadAddon() end LIB.Loading = nil + + g_loadTime = SysTime() - loadStartTime end local g_colDefault = Color(255, 255, 255) @@ -322,9 +329,12 @@ local function printAddon() realmcol = g_colSV end + local loadTimeString = string.format("Took %0.3f sec.", g_loadTime) + local border = "##########################################################################################" + MsgN() MsgN() - MsgC(realmcol, "###########################################################################") + MsgC(realmcol, border) MsgN() MsgN() @@ -335,11 +345,11 @@ local function printAddon() appendError(string.format("Error loading addon on the %s!", realmname)) end - MsgC(g_colError, "could not be loaded on the " .. realmname .. ".") + MsgC(g_colError, "could not be loaded on the " .. realmname .. ". " .. loadTimeString) MsgN() MsgN() - MsgC(realmcol, "###########################################################################") + MsgC(realmcol, border) MsgN() MsgN() @@ -358,12 +368,12 @@ local function printAddon() MsgN() end else - MsgC(g_colOk, "is loaded on the " .. realmname .. ".") + MsgC(g_colOk, "is loaded on the " .. realmname .. ". " .. loadTimeString) MsgN() end MsgN() - MsgC(realmcol, "###########################################################################") + MsgC(realmcol, border) MsgN() MsgN() end diff --git a/lua/streamradio_core/classes.lua b/lua/streamradio_core/classes.lua index 6f361bf..6a8467f 100644 --- a/lua/streamradio_core/classes.lua +++ b/lua/streamradio_core/classes.lua @@ -150,17 +150,15 @@ local function AddClass(name, parentname) name = normalize_classname(name) parentname = normalize_classname(parentname) - if ( name == "" ) then return false end - if ( parentname == "" ) then + if name == "" then return false end + if parentname == "" then parentname = "base" end - if ( StreamRadioLib.Classes[name] ) then return true end + if StreamRadioLib.Classes[name] then return true end local scriptfile = LuaClassDirectory .. "/" .. name .. ".lua" - if ( not StreamRadioLib.LuaExists( scriptfile ) ) then return false end - if name ~= parentname and not AddClass( parentname ) then return false end @@ -168,7 +166,12 @@ local function AddClass(name, parentname) local parent = StreamRadioLib.Classes[parentname] CLASS = CreateClass(name, parent) - StreamRadioLib.LoadSH(scriptfile, true) + local loaded = StreamRadioLib.LoadSH(scriptfile, true) + + if not loaded then + CLASS = nil + return false + end if not CLASS then CLASS = nil diff --git a/lua/streamradio_core/classes/base.lua b/lua/streamradio_core/classes/base.lua index 333b567..4003621 100644 --- a/lua/streamradio_core/classes/base.lua +++ b/lua/streamradio_core/classes/base.lua @@ -247,3 +247,6 @@ function CLASS:__eg(other) if not other then return false end return self:GetID() ~= other:GetID() end + +return true + diff --git a/lua/streamradio_core/classes/base_listener.lua b/lua/streamradio_core/classes/base_listener.lua index 0ce423c..18cc768 100644 --- a/lua/streamradio_core/classes/base_listener.lua +++ b/lua/streamradio_core/classes/base_listener.lua @@ -1079,3 +1079,6 @@ end function CLASS:PostDupe(data) end + +return true + diff --git a/lua/streamradio_core/classes/clientconvar.lua b/lua/streamradio_core/classes/clientconvar.lua index 9ea909e..02df7c4 100644 --- a/lua/streamradio_core/classes/clientconvar.lua +++ b/lua/streamradio_core/classes/clientconvar.lua @@ -377,3 +377,6 @@ function CLASS:Remove() self._convar = nil BASE.Remove(self) end + +return true + diff --git a/lua/streamradio_core/classes/gui_controller.lua b/lua/streamradio_core/classes/gui_controller.lua index 0b08483..d627fdb 100644 --- a/lua/streamradio_core/classes/gui_controller.lua +++ b/lua/streamradio_core/classes/gui_controller.lua @@ -806,4 +806,7 @@ end function CLASS:IsReady() return self.isReady or false -end \ No newline at end of file +end + +return true + diff --git a/lua/streamradio_core/classes/rendertarget.lua b/lua/streamradio_core/classes/rendertarget.lua index 0943bae..7bdb4d3 100644 --- a/lua/streamradio_core/classes/rendertarget.lua +++ b/lua/streamradio_core/classes/rendertarget.lua @@ -1,6 +1,6 @@ if SERVER then CLASS = nil - return + return true end local StreamRadioLib = StreamRadioLib @@ -515,3 +515,5 @@ function CLASS:__eg(other) return true end +return true + diff --git a/lua/streamradio_core/classes/skin_controller.lua b/lua/streamradio_core/classes/skin_controller.lua index 0a77342..0033add 100644 --- a/lua/streamradio_core/classes/skin_controller.lua +++ b/lua/streamradio_core/classes/skin_controller.lua @@ -282,3 +282,6 @@ end function CLASS:PostDupe(data) self:SetSkin(data.skin) end + +return true + diff --git a/lua/streamradio_core/classes/stream.lua b/lua/streamradio_core/classes/stream.lua index 44b74ab..844783d 100644 --- a/lua/streamradio_core/classes/stream.lua +++ b/lua/streamradio_core/classes/stream.lua @@ -2899,3 +2899,6 @@ end function CLASS:OnMute(muted) -- override end + +return true + diff --git a/lua/streamradio_core/classes/ui/button.lua b/lua/streamradio_core/classes/ui/button.lua index 5dfd235..d3e9005 100644 --- a/lua/streamradio_core/classes/ui/button.lua +++ b/lua/streamradio_core/classes/ui/button.lua @@ -524,3 +524,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/debug.lua b/lua/streamradio_core/classes/ui/debug.lua index e393da5..17c46b1 100644 --- a/lua/streamradio_core/classes/ui/debug.lua +++ b/lua/streamradio_core/classes/ui/debug.lua @@ -288,3 +288,6 @@ end function CLASS:ActivateNetworkedMode() end + +return true + diff --git a/lua/streamradio_core/classes/ui/highlighter.lua b/lua/streamradio_core/classes/ui/highlighter.lua index e305f1d..6d8267b 100644 --- a/lua/streamradio_core/classes/ui/highlighter.lua +++ b/lua/streamradio_core/classes/ui/highlighter.lua @@ -168,3 +168,6 @@ end function CLASS:ActivateNetworkedMode() end + +return true + diff --git a/lua/streamradio_core/classes/ui/image.lua b/lua/streamradio_core/classes/ui/image.lua index 20ba2a8..03ea136 100644 --- a/lua/streamradio_core/classes/ui/image.lua +++ b/lua/streamradio_core/classes/ui/image.lua @@ -217,3 +217,6 @@ function CLASS:IsVisible() return BASE.IsVisible(self) end + +return true + diff --git a/lua/streamradio_core/classes/ui/label.lua b/lua/streamradio_core/classes/ui/label.lua index 2370089..dac08ae 100644 --- a/lua/streamradio_core/classes/ui/label.lua +++ b/lua/streamradio_core/classes/ui/label.lua @@ -309,3 +309,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/label_fade.lua b/lua/streamradio_core/classes/ui/label_fade.lua index 7c17b49..5e54561 100644 --- a/lua/streamradio_core/classes/ui/label_fade.lua +++ b/lua/streamradio_core/classes/ui/label_fade.lua @@ -200,3 +200,6 @@ function CLASS:Render() self:DrawText(self.InternalText, x, y, w, h) end + +return true + diff --git a/lua/streamradio_core/classes/ui/list.lua b/lua/streamradio_core/classes/ui/list.lua index 8886c51..94c12f7 100644 --- a/lua/streamradio_core/classes/ui/list.lua +++ b/lua/streamradio_core/classes/ui/list.lua @@ -565,3 +565,6 @@ function CLASS:OnModelSetup(setup) self:SetGridSize(w, h) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/list_files.lua b/lua/streamradio_core/classes/ui/list_files.lua index abc5e49..04ce7f5 100644 --- a/lua/streamradio_core/classes/ui/list_files.lua +++ b/lua/streamradio_core/classes/ui/list_files.lua @@ -153,3 +153,5 @@ function CLASS:PostDupe(data) self:SetPath(data.Path) end +return true + diff --git a/lua/streamradio_core/classes/ui/panel.lua b/lua/streamradio_core/classes/ui/panel.lua index acc4836..0881ec3 100644 --- a/lua/streamradio_core/classes/ui/panel.lua +++ b/lua/streamradio_core/classes/ui/panel.lua @@ -1638,3 +1638,6 @@ function CLASS:OnModelSetup(setup) self:SetPosY(x) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/progressbar.lua b/lua/streamradio_core/classes/ui/progressbar.lua index 8880453..53b2836 100644 --- a/lua/streamradio_core/classes/ui/progressbar.lua +++ b/lua/streamradio_core/classes/ui/progressbar.lua @@ -405,3 +405,6 @@ function CLASS:PostDupe(data) self:SetFraction(data.Fraction) self:SetAllowFractionEdit(data.AllowEdit) end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_browser.lua b/lua/streamradio_core/classes/ui/radio/gui_browser.lua index dea4314..5ea2ec0 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_browser.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_browser.lua @@ -540,3 +540,6 @@ end function CLASS:PostDupe(data) self.State.PlaylistOpened = data.PlaylistOpened end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_errorbox.lua b/lua/streamradio_core/classes/ui/radio/gui_errorbox.lua index dd1f7cd..ac7347f 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_errorbox.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_errorbox.lua @@ -273,4 +273,7 @@ function CLASS:PerformLayout(...) end self:_PerformButtonLayout(margin, margin) -end \ No newline at end of file +end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_main.lua b/lua/streamradio_core/classes/ui/radio/gui_main.lua index 32d0c2f..c3d7e77 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_main.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_main.lua @@ -238,3 +238,6 @@ end function CLASS:PostDupe(data) self.State.PlayerOpened = data.PlayerOpened end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_player.lua b/lua/streamradio_core/classes/ui/radio/gui_player.lua index f0923a6..ed6066c 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_player.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_player.lua @@ -532,3 +532,6 @@ end function CLASS:GetSyncMode() return self._syncmode or false end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_player_controls.lua b/lua/streamradio_core/classes/ui/radio/gui_player_controls.lua index 7208fe0..f7ff416 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_player_controls.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_player_controls.lua @@ -746,3 +746,6 @@ end function CLASS:GetSyncMode() return self._syncmode or false end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/gui_player_spectrum.lua b/lua/streamradio_core/classes/ui/radio/gui_player_spectrum.lua index 9077821..73e4094 100644 --- a/lua/streamradio_core/classes/ui/radio/gui_player_spectrum.lua +++ b/lua/streamradio_core/classes/ui/radio/gui_player_spectrum.lua @@ -309,3 +309,6 @@ end function CLASS:GetStream() return self.StreamOBJ end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/list_playlists.lua b/lua/streamradio_core/classes/ui/radio/list_playlists.lua index f1ae273..7aad665 100644 --- a/lua/streamradio_core/classes/ui/radio/list_playlists.lua +++ b/lua/streamradio_core/classes/ui/radio/list_playlists.lua @@ -62,3 +62,6 @@ function CLASS:PostDupe(data) self:CallHook("OnInvalidDupeFilepath") end end + +return true + diff --git a/lua/streamradio_core/classes/ui/radio/list_playlistview.lua b/lua/streamradio_core/classes/ui/radio/list_playlistview.lua index a322d36..ce20c42 100644 --- a/lua/streamradio_core/classes/ui/radio/list_playlistview.lua +++ b/lua/streamradio_core/classes/ui/radio/list_playlistview.lua @@ -266,3 +266,6 @@ function CLASS:PostDupe(dupedata) self:ApplyLegacyDataFromDupe(dupedata) end) end + +return true + diff --git a/lua/streamradio_core/classes/ui/round_panel.lua b/lua/streamradio_core/classes/ui/round_panel.lua index 5f9cd73..b1809d5 100644 --- a/lua/streamradio_core/classes/ui/round_panel.lua +++ b/lua/streamradio_core/classes/ui/round_panel.lua @@ -40,3 +40,6 @@ function CLASS:OnModelSetup(setup) self:SetCornerSize(setup.cornersize) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/scrollbar.lua b/lua/streamradio_core/classes/ui/scrollbar.lua index 01741e1..e57c941 100644 --- a/lua/streamradio_core/classes/ui/scrollbar.lua +++ b/lua/streamradio_core/classes/ui/scrollbar.lua @@ -508,3 +508,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/shadow_panel.lua b/lua/streamradio_core/classes/ui/shadow_panel.lua index 789517f..cf9b8ad 100644 --- a/lua/streamradio_core/classes/ui/shadow_panel.lua +++ b/lua/streamradio_core/classes/ui/shadow_panel.lua @@ -314,3 +314,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/text.lua b/lua/streamradio_core/classes/ui/text.lua index c126adf..3c86213 100644 --- a/lua/streamradio_core/classes/ui/text.lua +++ b/lua/streamradio_core/classes/ui/text.lua @@ -390,3 +390,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/textview.lua b/lua/streamradio_core/classes/ui/textview.lua index 9e3fc32..157821d 100644 --- a/lua/streamradio_core/classes/ui/textview.lua +++ b/lua/streamradio_core/classes/ui/textview.lua @@ -150,3 +150,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/classes/ui/tooltip.lua b/lua/streamradio_core/classes/ui/tooltip.lua index 22ec9cd..b17c7af 100644 --- a/lua/streamradio_core/classes/ui/tooltip.lua +++ b/lua/streamradio_core/classes/ui/tooltip.lua @@ -178,3 +178,6 @@ function CLASS:OnModelSetup(setup) self:SetFont(setup.font) end end + +return true + diff --git a/lua/streamradio_core/client/cl_presets.lua b/lua/streamradio_core/client/cl_presets.lua index e14876a..e05a12d 100644 --- a/lua/streamradio_core/client/cl_presets.lua +++ b/lua/streamradio_core/client/cl_presets.lua @@ -794,7 +794,7 @@ do local settings = StreamRadioLib.GetPresetsTable(g_radioColorToolName) - for _, f in pairs( files or {} ) do + for _, f in ipairs( files or {} ) do local presetsString = file.Read( "settings/presets/streamradio_gui_color_global/" .. f, "GAME" ) or "" if presetsString == "" then continue diff --git a/lua/streamradio_core/filesystem.lua b/lua/streamradio_core/filesystem.lua index d7dae98..aecb83a 100644 --- a/lua/streamradio_core/filesystem.lua +++ b/lua/streamradio_core/filesystem.lua @@ -137,8 +137,6 @@ local function loadFilesystem(script) local scriptpath = g_luaFilesystemDirectory .. "/" local scriptfile = scriptpath .. script - if not StreamRadioLib.LuaExists(scriptfile) then return nil end - RADIOFS = nil RADIOFS = {} @@ -277,7 +275,7 @@ function LIB.Load() local filesystems = {}; - for _, f in pairs(files or {}) do + for _, f in ipairs(files or {}) do local fs = loadFilesystem(f) if not fs then continue diff --git a/lua/streamradio_core/filesystem/_folder.lua b/lua/streamradio_core/filesystem/_folder.lua index 0ad3295..16eaa26 100644 --- a/lua/streamradio_core/filesystem/_folder.lua +++ b/lua/streamradio_core/filesystem/_folder.lua @@ -62,3 +62,6 @@ function RADIOFS:Delete(globalpath, vpath, callback) end RADIOFS.Read = nil + +return true + diff --git a/lua/streamradio_core/filesystem/_generic.lua b/lua/streamradio_core/filesystem/_generic.lua index d303ef1..63fca10 100644 --- a/lua/streamradio_core/filesystem/_generic.lua +++ b/lua/streamradio_core/filesystem/_generic.lua @@ -22,3 +22,6 @@ end function RADIOFS:Exists(globalpath, vpath) return false end + +return true + diff --git a/lua/streamradio_core/filesystem/addon-mx-radio.lua b/lua/streamradio_core/filesystem/addon-mx-radio.lua index 0d4dd37..ab35fa4 100644 --- a/lua/streamradio_core/filesystem/addon-mx-radio.lua +++ b/lua/streamradio_core/filesystem/addon-mx-radio.lua @@ -196,4 +196,7 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true -end \ No newline at end of file +end + +return true + diff --git a/lua/streamradio_core/filesystem/addon-web-radio.lua b/lua/streamradio_core/filesystem/addon-web-radio.lua index 7532796..1e875df 100644 --- a/lua/streamradio_core/filesystem/addon-web-radio.lua +++ b/lua/streamradio_core/filesystem/addon-web-radio.lua @@ -190,4 +190,7 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true -end \ No newline at end of file +end + +return true + diff --git a/lua/streamradio_core/filesystem/files-sound-folder.lua b/lua/streamradio_core/filesystem/files-sound-folder.lua index ead358a..0ad9f20 100644 --- a/lua/streamradio_core/filesystem/files-sound-folder.lua +++ b/lua/streamradio_core/filesystem/files-sound-folder.lua @@ -179,3 +179,6 @@ function RADIOFS:Read(globalpath, vpath, callback) callback(true, playlist) return true end + +return true + diff --git a/lua/streamradio_core/filesystem/json.lua b/lua/streamradio_core/filesystem/json.lua index 0fc635e..c8d4adf 100644 --- a/lua/streamradio_core/filesystem/json.lua +++ b/lua/streamradio_core/filesystem/json.lua @@ -55,3 +55,6 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true end + +return true + diff --git a/lua/streamradio_core/filesystem/m3u.lua b/lua/streamradio_core/filesystem/m3u.lua index 1374449..4bdf68d 100644 --- a/lua/streamradio_core/filesystem/m3u.lua +++ b/lua/streamradio_core/filesystem/m3u.lua @@ -125,3 +125,6 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true end + +return true + diff --git a/lua/streamradio_core/filesystem/pls.lua b/lua/streamradio_core/filesystem/pls.lua index a36d943..b185994 100644 --- a/lua/streamradio_core/filesystem/pls.lua +++ b/lua/streamradio_core/filesystem/pls.lua @@ -128,3 +128,6 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true end + +return true + diff --git a/lua/streamradio_core/filesystem/shoutcast.lua b/lua/streamradio_core/filesystem/shoutcast.lua index 72e7434..58703bf 100644 --- a/lua/streamradio_core/filesystem/shoutcast.lua +++ b/lua/streamradio_core/filesystem/shoutcast.lua @@ -198,3 +198,6 @@ LIBWhitelist.AddCheckFunction("shoutcast", function(url) return true end) + +return true + diff --git a/lua/streamradio_core/filesystem/vdf.lua b/lua/streamradio_core/filesystem/vdf.lua index e4dccbe..67047e9 100644 --- a/lua/streamradio_core/filesystem/vdf.lua +++ b/lua/streamradio_core/filesystem/vdf.lua @@ -55,3 +55,6 @@ function RADIOFS:Write(globalpath, vpath, data, callback) callback(true) return true end + +return true + diff --git a/lua/streamradio_core/interface.lua b/lua/streamradio_core/interface.lua index a39728f..d21dfb4 100644 --- a/lua/streamradio_core/interface.lua +++ b/lua/streamradio_core/interface.lua @@ -22,8 +22,6 @@ local function AddInterface(script) local scriptpath = LuaInterfaceDirectory .. "/" local scriptfile = scriptpath .. script - if not StreamRadioLib.LuaExists(scriptfile) then return false end - RADIOIFACE = nil RADIOIFACE = {} @@ -32,7 +30,12 @@ local function AddInterface(script) RADIOIFACE.subinterfaces = {} - StreamRadioLib.LoadSH(scriptfile, true) + local loaded = StreamRadioLib.LoadSH(scriptfile, true) + + if not loaded then + RADIOIFACE = nil + return false + end local name = string.Trim(RADIOIFACE.name or "") RADIOIFACE.priority = tonumber(RADIOIFACE.priority or 0) or 0 @@ -74,7 +77,7 @@ function LIB.Load() g_intefaces = {} g_intefacesByName = {} - for _, f in pairs(files or {}) do + for _, f in ipairs(files or {}) do AddInterface(f) end diff --git a/lua/streamradio_core/interfaces/cache.lua b/lua/streamradio_core/interfaces/cache.lua index 6a2b5f7..c4ef78b 100644 --- a/lua/streamradio_core/interfaces/cache.lua +++ b/lua/streamradio_core/interfaces/cache.lua @@ -52,3 +52,6 @@ function RADIOIFACE:Convert(url, callback) callback(self, true, path) end + +return true + diff --git a/lua/streamradio_core/interfaces/dropbox.lua b/lua/streamradio_core/interfaces/dropbox.lua index 4885f59..1d56875 100644 --- a/lua/streamradio_core/interfaces/dropbox.lua +++ b/lua/streamradio_core/interfaces/dropbox.lua @@ -90,3 +90,6 @@ function RADIOIFACE:Convert(url, callback) callback(self, true, streamUrl) end + +return true + diff --git a/lua/streamradio_core/interfaces/file.lua b/lua/streamradio_core/interfaces/file.lua index dcbe7a5..7306720 100644 --- a/lua/streamradio_core/interfaces/file.lua +++ b/lua/streamradio_core/interfaces/file.lua @@ -45,3 +45,6 @@ function RADIOIFACE:Convert(url, callback) callback(self, true, path) end + +return true + diff --git a/lua/streamradio_core/interfaces/online.lua b/lua/streamradio_core/interfaces/online.lua index eea35e5..7475a0d 100644 --- a/lua/streamradio_core/interfaces/online.lua +++ b/lua/streamradio_core/interfaces/online.lua @@ -27,3 +27,6 @@ function RADIOIFACE:Convert(url, callback) callback(self, true, url) return end + +return true + diff --git a/lua/streamradio_core/interfaces/shoutcast.lua b/lua/streamradio_core/interfaces/shoutcast.lua index 12a71e7..81fd58b 100644 --- a/lua/streamradio_core/interfaces/shoutcast.lua +++ b/lua/streamradio_core/interfaces/shoutcast.lua @@ -78,3 +78,6 @@ function RADIOIFACE:Convert(url, callback) return end + +return true + diff --git a/lua/streamradio_core/interfaces/youtube.lua b/lua/streamradio_core/interfaces/youtube.lua index dd10d76..117955b 100644 --- a/lua/streamradio_core/interfaces/youtube.lua +++ b/lua/streamradio_core/interfaces/youtube.lua @@ -59,3 +59,6 @@ function RADIOIFACE:Convert(url, callback) callback(self, false, nil, ERROR_UNSUPPORTED) return end + +return true + diff --git a/lua/streamradio_core/models.lua b/lua/streamradio_core/models.lua index 054523f..b76166a 100644 --- a/lua/streamradio_core/models.lua +++ b/lua/streamradio_core/models.lua @@ -72,14 +72,14 @@ local function AddModel(script) if script[1] == "_" then return false end local scriptfile = LuaModelDirectory .. "/" .. script - if not StreamRadioLib.LuaExists(scriptfile) then return false end RADIOMDL = nil RADIOMDL = {} AddCommonFunctions() - StreamRadioLib.LoadSH(scriptfile, true) + local loaded = StreamRadioLib.LoadSH(scriptfile, true) + local modelname = string.lower(string.Trim(RADIOMDL.model or "")) if modelname == "" then @@ -90,7 +90,7 @@ local function AddModel(script) Models[modelname] = RADIOMDL RADIOMDL = nil - return true + return loaded end local function AddMultiModels(script, modellist) @@ -104,15 +104,13 @@ local function AddMultiModels(script, modellist) local scriptfile = LuaModelDirectory .. "/" .. script - if ( not StreamRadioLib.LuaExists( scriptfile ) ) then return false end - StreamRadioLib.SaveCSLuaFile(scriptfile, true) RADIOMDL = nil - for _, modelname in pairs( modellist ) do + for _, modelname in ipairs( modellist ) do modelname = string.lower( string.Trim( modelname or "" ) ) - if ( modelname == "" ) then + if modelname == "" then RADIOMDL = nil continue end @@ -121,10 +119,15 @@ local function AddMultiModels(script, modellist) RADIOMDL = {} RADIOMDL.modelname = modelname - StreamRadioLib.LoadSH(scriptfile, true) + local loaded = StreamRadioLib.LoadSH(scriptfile, true) + + if not loaded then + RADIOMDL = nil + continue + end modelname = string.lower( string.Trim( RADIOMDL.modelname or "" ) ) - if ( modelname == "" ) then + if modelname == "" then RADIOMDL = nil continue end @@ -140,14 +143,14 @@ function LIB.LoadModelSettings() local files = file.Find( LuaModelDirectory .. "/*", "LUA" ) Models = {} - for _, f in pairs( files or {} ) do + for _, f in ipairs( files or {} ) do AddModel(f) end local nm_modelpath = "models/nickmaps/speakers" local nm_speakers = file.Find( nm_modelpath .. "/*.mdl", "GAME" ) - for index, modelname in pairs( nm_speakers ) do + for index, modelname in ipairs( nm_speakers ) do nm_speakers[index] = nm_modelpath .. "/" .. modelname end diff --git a/lua/streamradio_core/models/111as_h500_radio.lua b/lua/streamradio_core/models/111as_h500_radio.lua index cc94577..0f31168 100644 --- a/lua/streamradio_core/models/111as_h500_radio.lua +++ b/lua/streamradio_core/models/111as_h500_radio.lua @@ -105,3 +105,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/_nm_speakers.lua b/lua/streamradio_core/models/_nm_speakers.lua index a2dca50..cc4e343 100644 --- a/lua/streamradio_core/models/_nm_speakers.lua +++ b/lua/streamradio_core/models/_nm_speakers.lua @@ -44,3 +44,6 @@ function RADIOMDL:Speaker(ent, speakerlevel) ent:ManipulateBonePosition( Speaker, Vector( 0, speakerlevel * (SpeakerSize / 36), 0 ) ) end + +return true + diff --git a/lua/streamradio_core/models/cs_office_radio.lua b/lua/streamradio_core/models/cs_office_radio.lua index bcd897d..50b9d31 100644 --- a/lua/streamradio_core/models/cs_office_radio.lua +++ b/lua/streamradio_core/models/cs_office_radio.lua @@ -104,3 +104,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/cs_office_tv.lua b/lua/streamradio_core/models/cs_office_tv.lua index 45184c0..3a964d3 100644 --- a/lua/streamradio_core/models/cs_office_tv.lua +++ b/lua/streamradio_core/models/cs_office_tv.lua @@ -105,3 +105,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/csgo_italy_radio.lua b/lua/streamradio_core/models/csgo_italy_radio.lua index 2e5d772..38c9036 100644 --- a/lua/streamradio_core/models/csgo_italy_radio.lua +++ b/lua/streamradio_core/models/csgo_italy_radio.lua @@ -108,3 +108,5 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end) end +return true + diff --git a/lua/streamradio_core/models/default.lua b/lua/streamradio_core/models/default.lua index 1f01f00..a810cfd 100644 --- a/lua/streamradio_core/models/default.lua +++ b/lua/streamradio_core/models/default.lua @@ -12,3 +12,5 @@ RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = false RADIOMDL.HiddenInTool = true +return true + diff --git a/lua/streamradio_core/models/fallout3_jukebox.lua b/lua/streamradio_core/models/fallout3_jukebox.lua index f962972..37699be 100644 --- a/lua/streamradio_core/models/fallout3_jukebox.lua +++ b/lua/streamradio_core/models/fallout3_jukebox.lua @@ -109,3 +109,6 @@ end RADIOMDL.Sounds = { Noise = "", } + +return true + diff --git a/lua/streamradio_core/models/hl2_crtscreen_big.lua b/lua/streamradio_core/models/hl2_crtscreen_big.lua index 058289b..868b8a1 100644 --- a/lua/streamradio_core/models/hl2_crtscreen_big.lua +++ b/lua/streamradio_core/models/hl2_crtscreen_big.lua @@ -105,3 +105,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/hl2_crtscreen_small.lua b/lua/streamradio_core/models/hl2_crtscreen_small.lua index 81fd2ae..009027c 100644 --- a/lua/streamradio_core/models/hl2_crtscreen_small.lua +++ b/lua/streamradio_core/models/hl2_crtscreen_small.lua @@ -106,3 +106,5 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end) end +return true + diff --git a/lua/streamradio_core/models/hl2_radio.lua b/lua/streamradio_core/models/hl2_radio.lua index c116741..e4396f5 100644 --- a/lua/streamradio_core/models/hl2_radio.lua +++ b/lua/streamradio_core/models/hl2_radio.lua @@ -111,3 +111,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/hl2_speaker.lua b/lua/streamradio_core/models/hl2_speaker.lua index cefe4bb..5640e27 100644 --- a/lua/streamradio_core/models/hl2_speaker.lua +++ b/lua/streamradio_core/models/hl2_speaker.lua @@ -12,3 +12,5 @@ RADIOMDL.SpawnAng = Angle( -90, 0, 0 ) RADIOMDL.SpawnFlatOnWall = false RADIOMDL.SpawnAtOrigin = false +return true + diff --git a/lua/streamradio_core/models/kankan_radio.lua b/lua/streamradio_core/models/kankan_radio.lua index 9984425..32b04d5 100644 --- a/lua/streamradio_core/models/kankan_radio.lua +++ b/lua/streamradio_core/models/kankan_radio.lua @@ -110,3 +110,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/kresopolski_radio.lua b/lua/streamradio_core/models/kresopolski_radio.lua index 32bb75f..bdb6aba 100644 --- a/lua/streamradio_core/models/kresopolski_radio.lua +++ b/lua/streamradio_core/models/kresopolski_radio.lua @@ -111,3 +111,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/minecraft_jukebox.lua b/lua/streamradio_core/models/minecraft_jukebox.lua index 84aa271..bb65e8f 100644 --- a/lua/streamradio_core/models/minecraft_jukebox.lua +++ b/lua/streamradio_core/models/minecraft_jukebox.lua @@ -111,3 +111,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/minecraft_noteblock.lua b/lua/streamradio_core/models/minecraft_noteblock.lua index 77b3f12..d6fea19 100644 --- a/lua/streamradio_core/models/minecraft_noteblock.lua +++ b/lua/streamradio_core/models/minecraft_noteblock.lua @@ -14,3 +14,5 @@ RADIOMDL.SpawnFlatOnWall = false RADIOMDL.SoundPosOffset = Vector( 0, 0, 18 ) RADIOMDL.SoundAngOffset = Angle( 0, 0, 0 ) +return true + diff --git a/lua/streamradio_core/models/nm_screen.lua b/lua/streamradio_core/models/nm_screen.lua index bde6ff9..5526876 100644 --- a/lua/streamradio_core/models/nm_screen.lua +++ b/lua/streamradio_core/models/nm_screen.lua @@ -106,3 +106,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/plasma_tv.lua b/lua/streamradio_core/models/plasma_tv.lua index fd8064c..cb9b6c5 100644 --- a/lua/streamradio_core/models/plasma_tv.lua +++ b/lua/streamradio_core/models/plasma_tv.lua @@ -105,3 +105,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/portal_ball.lua b/lua/streamradio_core/models/portal_ball.lua index d556940..d0ee04e 100644 --- a/lua/streamradio_core/models/portal_ball.lua +++ b/lua/streamradio_core/models/portal_ball.lua @@ -32,3 +32,6 @@ function RADIOMDL:SoundLevel(ent, soundlevel) local skinid = math.Round(soundlevel * 9) ent:SetSkin( skinid ) end + +return true + diff --git a/lua/streamradio_core/models/portal_gladosball.lua b/lua/streamradio_core/models/portal_gladosball.lua index b3a573a..bdb703f 100644 --- a/lua/streamradio_core/models/portal_gladosball.lua +++ b/lua/streamradio_core/models/portal_gladosball.lua @@ -35,3 +35,5 @@ function RADIOMDL:SoundLevel(ent, soundlevel) ent:SetSkin( skinid ) end +return true + diff --git a/lua/streamradio_core/models/portal_radio.lua b/lua/streamradio_core/models/portal_radio.lua index 4983701..cf12ba7 100644 --- a/lua/streamradio_core/models/portal_radio.lua +++ b/lua/streamradio_core/models/portal_radio.lua @@ -104,3 +104,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/portal_speaker_big.lua b/lua/streamradio_core/models/portal_speaker_big.lua index 535668f..ea06da2 100644 --- a/lua/streamradio_core/models/portal_speaker_big.lua +++ b/lua/streamradio_core/models/portal_speaker_big.lua @@ -14,3 +14,5 @@ RADIOMDL.SpawnAtOrigin = true RADIOMDL.SoundPosOffset = Vector( 35.5, 1.40, 5.2 ) RADIOMDL.SoundAngOffset = Angle( 22.5, 0, 0 ) +return true + diff --git a/lua/streamradio_core/models/portal_speaker_small.lua b/lua/streamradio_core/models/portal_speaker_small.lua index e7f8855..c7b9301 100644 --- a/lua/streamradio_core/models/portal_speaker_small.lua +++ b/lua/streamradio_core/models/portal_speaker_small.lua @@ -14,3 +14,5 @@ RADIOMDL.SpawnAtOrigin = true RADIOMDL.SoundPosOffset = Vector( 10.5, 0, -1.9 ) RADIOMDL.SoundAngOffset = Angle( 22.5, 0, 0 ) +return true + diff --git a/lua/streamradio_core/models/portal_turret.lua b/lua/streamradio_core/models/portal_turret.lua index 7c8533d..bd0713d 100644 --- a/lua/streamradio_core/models/portal_turret.lua +++ b/lua/streamradio_core/models/portal_turret.lua @@ -374,3 +374,6 @@ function RADIOMDL:SoundLevel(ent, soundlevel) self.EyeColorDyn.g = 0 self.EyeColorDyn.r = math.floor(31 + 224 * soundlevel) end + +return true + diff --git a/lua/streamradio_core/models/sw_ghettoblaster.lua b/lua/streamradio_core/models/sw_ghettoblaster.lua index 8728a46..e467069 100644 --- a/lua/streamradio_core/models/sw_ghettoblaster.lua +++ b/lua/streamradio_core/models/sw_ghettoblaster.lua @@ -157,3 +157,6 @@ function RADIOMDL:Speaker(ent, speakerlevel) ent:SetPoseParameter("speakers", speakerlevel) ent:InvalidateBoneCache() end + +return true + diff --git a/lua/streamradio_core/models/sw_gramophone.lua b/lua/streamradio_core/models/sw_gramophone.lua index 0008f70..03cfd46 100644 --- a/lua/streamradio_core/models/sw_gramophone.lua +++ b/lua/streamradio_core/models/sw_gramophone.lua @@ -164,3 +164,6 @@ function RADIOMDL:Think(ent) ent:SetPoseParameter( "move_needle", armpos ) ent:InvalidateBoneCache() end + +return true + diff --git a/lua/streamradio_core/models/sw_jukebox.lua b/lua/streamradio_core/models/sw_jukebox.lua index 4f574fd..d675bde 100644 --- a/lua/streamradio_core/models/sw_jukebox.lua +++ b/lua/streamradio_core/models/sw_jukebox.lua @@ -160,3 +160,6 @@ function RADIOMDL:WhileLoading(ent) local sequence = ent:LookupSequence( "idle" ) ent:SetAnim( sequence, 0, 1 ) end + +return true + diff --git a/lua/streamradio_core/models/sw_radio.lua b/lua/streamradio_core/models/sw_radio.lua index 18f7ce2..98f4d5a 100644 --- a/lua/streamradio_core/models/sw_radio.lua +++ b/lua/streamradio_core/models/sw_radio.lua @@ -157,3 +157,6 @@ function RADIOMDL:Speaker(ent, speakerlevel) ent:SetPoseParameter("speakers", speakerlevel) ent:InvalidateBoneCache() end + +return true + diff --git a/lua/streamradio_core/models/wire_monitor_big.lua b/lua/streamradio_core/models/wire_monitor_big.lua index cb9d843..bccde8c 100644 --- a/lua/streamradio_core/models/wire_monitor_big.lua +++ b/lua/streamradio_core/models/wire_monitor_big.lua @@ -106,3 +106,6 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end end) end + +return true + diff --git a/lua/streamradio_core/models/wire_monitor_small.lua b/lua/streamradio_core/models/wire_monitor_small.lua index 61b1a85..c882784 100644 --- a/lua/streamradio_core/models/wire_monitor_small.lua +++ b/lua/streamradio_core/models/wire_monitor_small.lua @@ -108,3 +108,5 @@ function RADIOMDL:SetupGUI(ent, gui_controller, mainpanel) end) end +return true + diff --git a/lua/streamradio_core/models/wire_speaker1.lua b/lua/streamradio_core/models/wire_speaker1.lua index cb3773a..25a7bdf 100644 --- a/lua/streamradio_core/models/wire_speaker1.lua +++ b/lua/streamradio_core/models/wire_speaker1.lua @@ -12,3 +12,5 @@ RADIOMDL.NoDisplay = true RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = false +return true + diff --git a/lua/streamradio_core/models/wire_speaker2.lua b/lua/streamradio_core/models/wire_speaker2.lua index 306bc6c..1d8a1d0 100644 --- a/lua/streamradio_core/models/wire_speaker2.lua +++ b/lua/streamradio_core/models/wire_speaker2.lua @@ -12,3 +12,5 @@ RADIOMDL.NoDisplay = true RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = false +return true + diff --git a/lua/streamradio_core/models/wire_speaker3.lua b/lua/streamradio_core/models/wire_speaker3.lua index 8df8dbb..679e28c 100644 --- a/lua/streamradio_core/models/wire_speaker3.lua +++ b/lua/streamradio_core/models/wire_speaker3.lua @@ -12,3 +12,5 @@ RADIOMDL.NoDisplay = true RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = false +return true + diff --git a/lua/streamradio_core/models/wire_subwoofer_big.lua b/lua/streamradio_core/models/wire_subwoofer_big.lua index 0347715..e93c925 100644 --- a/lua/streamradio_core/models/wire_subwoofer_big.lua +++ b/lua/streamradio_core/models/wire_subwoofer_big.lua @@ -12,3 +12,5 @@ RADIOMDL.NoDisplay = true RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = true +return true + diff --git a/lua/streamradio_core/models/wire_subwoofer_small.lua b/lua/streamradio_core/models/wire_subwoofer_small.lua index eb2c95e..b69f9f1 100644 --- a/lua/streamradio_core/models/wire_subwoofer_small.lua +++ b/lua/streamradio_core/models/wire_subwoofer_small.lua @@ -12,3 +12,5 @@ RADIOMDL.NoDisplay = true RADIOMDL.SpawnAng = Angle( 0, 0, 0 ) RADIOMDL.SpawnFlatOnWall = true +return true + diff --git a/lua/streamradio_core/server/sv_res.lua b/lua/streamradio_core/server/sv_res.lua index 597f7d5..9a9d46d 100644 --- a/lua/streamradio_core/server/sv_res.lua +++ b/lua/streamradio_core/server/sv_res.lua @@ -7,7 +7,7 @@ local function CopyFiles( dir ) file.CreateDir( dir ) local files, directories = file.Find(WorkshopDataDirectory .. "/" .. dir .. "/*", "GAME") - for _, f in pairs(files or {}) do + for _, f in ipairs(files or {}) do local filename = dir .. "/" .. f local fullpath = WorkshopDataDirectory .. "/" .. filename @@ -20,7 +20,7 @@ local function CopyFiles( dir ) file.Write(newfilename, file.Read(fullpath, "GAME") or "") end - for _, d in pairs(directories or {}) do + for _, d in ipairs(directories or {}) do CopyFiles(dir .. "/" .. d) end end diff --git a/lua/streamradio_core/util.lua b/lua/streamradio_core/util.lua index da15a08..486a4bf 100644 --- a/lua/streamradio_core/util.lua +++ b/lua/streamradio_core/util.lua @@ -236,11 +236,11 @@ function LIB.DeleteFolder(path) local files, folders = file.Find(path .. "/*", "DATA") - for k, v in pairs(files or {}) do + for k, v in ipairs(files or {}) do file.Delete(path .. "/" .. v) end - for k, v in pairs(folders or {}) do + for k, v in ipairs(folders or {}) do LIB.DeleteFolder(path .. "/" .. v) end diff --git a/materials/3dstreamradio/_data/version.vmt b/materials/3dstreamradio/_data/version.vmt index f9b223a..dd788ea 100644 --- a/materials/3dstreamradio/_data/version.vmt +++ b/materials/3dstreamradio/_data/version.vmt @@ -1,2 +1,2 @@ -440 -1704058026 +441 +1704408199