Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
tweak: Print console message for loaded/disabled plugins at end of pr…
Browse files Browse the repository at this point in the history
…inting

tweak: Make ts3 Integration a full config
feat: Add export for getPluginConfig
tweak: Load the pluginConfig for ts3
  • Loading branch information
Jordan2139 committed Oct 29, 2024
1 parent 909dae3 commit 6222cb0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions sonorancad/configuration/ts3integration_config.dist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

local config = {
enabled = false,
ignoreLoader = true
pluginName = "ts3integration", -- name your plugin here
pluginAuthor = "SonoranCAD", -- author
requiresPlugins = {}, -- required plugins for this plugin to work, separated by commas
}

Config.RegisterPluginConfig("ts3integration", config)
if config.enabled then
Config.RegisterPluginConfig(config.pluginName, config)
end
4 changes: 4 additions & 0 deletions sonorancad/core/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ local function CopyFile(old_path, new_path)
return true
end

exports('GetPluginConfig', function(pluginName)
return Config.GetPluginConfig(pluginName)
end)

Config.GetPluginConfig = function(pluginName)
local correctConfig = nil
if Config.plugins[pluginName] ~= nil then
Expand Down
1 change: 1 addition & 0 deletions sonorancad/core/plugin_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
]]

CreateThread(function()
Wait(5000)
while Config.apiVersion == -1 do Wait(10) end
if Config.critError then logError("ERROR_ABORT") end
for k, v in pairs(Config.plugins) do
Expand Down
4 changes: 3 additions & 1 deletion sonorancad/submodules/ts3integration/sv_ts3integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ along with this program in the file "LICENSE". If not, see <http://www.gnu.org/
const { TeamSpeak, QueryProtocol } = require("ts3-nodejs-library");
const configFilePath = path.join(GetResourcePath(GetCurrentResourceName()), "/configuration/ts3integration_config.json");
const distFilePath = path.join(GetResourcePath(GetCurrentResourceName()), "/configuration/ts3integration_config.dist.json");
const luaConfigPath = path.join(GetResourcePath(GetCurrentResourceName()), "/configuration/ts3integration_config.lua");
const distLuaConfigPath = path.join(GetResourcePath(GetCurrentResourceName()), "/configuration/ts3integration_config.dist.lua");
var clientsToAdd = [];
var clientsToRemove = [];

Expand Down Expand Up @@ -46,7 +48,7 @@ function loadConfig() {

// Load the configuration
const ts3config = loadConfig();

const unusedConfig = exports.sonorancad.GetPluginConfig("ts3integration");

// Check if the config values are set, or if we should use the server convars
const ts3UserConvar = GetConvar("sonorants3_server_user", 'false');
Expand Down

0 comments on commit 6222cb0

Please sign in to comment.