From 28be2e844c8e3e5a9fb1f15b2089b9038b5ca602 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Sun, 17 Sep 2023 23:23:46 +0200 Subject: [PATCH] Replaced yl_template with yl_announcements --- README.md | 4 ++-- chatcommand_admin.lua | 2 +- chatcommands.lua | 4 ++-- config.lua | 8 ++++---- globalsteps.lua | 2 +- init.lua | 46 +++++++++++++++++++++---------------------- internal.lua | 10 +++++----- mod.conf | 2 +- priv_example.lua | 4 ++-- privs.lua | 2 +- settingtypes.txt | 2 +- setup.lua | 6 +++--- 12 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 282e624..50ff07e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# yl_template +# yl_announcements ## Purpose @@ -7,7 +7,7 @@ This mod is not meant to bring functionality by itself, but to serve as a templa ## Download -Get it from https://gitea.your-land.de/your-land/yl_template +Get it from https://gitea.your-land.de/your-land/yl_announcements ## Installation diff --git a/chatcommand_admin.lua b/chatcommand_admin.lua index b274f80..fd2c047 100644 --- a/chatcommand_admin.lua +++ b/chatcommand_admin.lua @@ -2,7 +2,7 @@ local chatcommand_cmd = "admin_example" local chatcommand_definition = { params = " ", -- Short parameter description description = "Example description", -- Full description - privs = {[yl_template.settings.admin_priv] = true}, -- Require the "privs" privilege to run + privs = {[yl_announcements.settings.admin_priv] = true}, -- Require the "privs" privilege to run func = function(name, param) local success = true if success then diff --git a/chatcommands.lua b/chatcommands.lua index 89cd404..7054f0f 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -1,2 +1,2 @@ -dofile(yl_template.modpath .. "chatcommand_admin.lua") -dofile(yl_template.modpath .. "chatcommand_player.lua") \ No newline at end of file +dofile(yl_announcements.modpath .. "chatcommand_admin.lua") +dofile(yl_announcements.modpath .. "chatcommand_player.lua") \ No newline at end of file diff --git a/config.lua b/config.lua index b42cdf3..7b5bda2 100644 --- a/config.lua +++ b/config.lua @@ -1,10 +1,10 @@ -- Setting a configuration, switch the order in which the settings shall take precedence. First valid one taken. -yl_template.settings = {} +yl_announcements.settings = {} -yl_template.settings.external_value = "mod_default" or minetest.settings:get("yl_template.external_value") or "default" +yl_announcements.settings.external_value = "mod_default" or minetest.settings:get("yl_announcements.external_value") or "default" -yl_template.settings.save_path = "yl_template" or minetest.settings:get("yl_template.save_path") or "default" +yl_announcements.settings.save_path = "yl_announcements" or minetest.settings:get("yl_announcements.save_path") or "default" -yl_template.settings.admin_priv = "admin_priv" or minetest.settings:get("yl_template.admin_priv") or "server" \ No newline at end of file +yl_announcements.settings.admin_priv = "admin_priv" or minetest.settings:get("yl_announcements.admin_priv") or "server" \ No newline at end of file diff --git a/globalsteps.lua b/globalsteps.lua index 8d22fe3..1059f00 100644 --- a/globalsteps.lua +++ b/globalsteps.lua @@ -2,7 +2,7 @@ local timer = 0 local gs = function(dtime) timer = timer + dtime - if timer <= yl_template.config.interval then + if timer <= yl_announcements.config.interval then return end timer = 0 diff --git a/init.lua b/init.lua index 7c30bbd..bbfaaf2 100644 --- a/init.lua +++ b/init.lua @@ -5,31 +5,31 @@ -- Changelog local mod_start_time = core.get_us_time() -core.log("action", "[MOD] yl_template loading") +core.log("action", "[MOD] yl_announcements loading") -yl_template = {} -yl_template.error = {} -yl_template.modstorage = core.get_mod_storage() -yl_template.modpath = core.get_modpath("yl_template") .. DIR_DELIM -yl_template.worldpath = core.get_worldpath() .. DIR_DELIM +yl_announcements = {} +yl_announcements.error = {} +yl_announcements.modstorage = core.get_mod_storage() +yl_announcements.modpath = core.get_modpath("yl_announcements") .. DIR_DELIM +yl_announcements.worldpath = core.get_worldpath() .. DIR_DELIM -yl_template.information = {} -yl_template.information.version = "0.0.1" -yl_template.information.author = "AliasAlreadyTaken" -yl_template.information.license = "MIT" -yl_template.information.name = "yl_template" -yl_template.information.source = "https://gitea.your-land.de/your-land/yl_template" -yl_template.information.additional = "Additional information" +yl_announcements.information = {} +yl_announcements.information.version = "0.0.1" +yl_announcements.information.author = "AliasAlreadyTaken" +yl_announcements.information.license = "MIT" +yl_announcements.information.name = "yl_announcements" +yl_announcements.information.source = "https://gitea.your-land.de/your-land/yl_announcements" +yl_announcements.information.additional = "Additional information" -dofile(yl_template.modpath .. "config.lua") -dofile(yl_template.modpath .. "setup.lua") -dofile(yl_template.modpath .. "privs.lua") -dofile(yl_template.modpath .. "internal.lua") -dofile(yl_template.modpath .. "api.lua") -dofile(yl_template.modpath .. "distinct_feature.lua") -dofile(yl_template.modpath .. "overwrite_feature.lua") -dofile(yl_template.modpath .. "globalsteps.lua") -dofile(yl_template.modpath .. "chatcommands.lua") +dofile(yl_announcements.modpath .. "config.lua") +dofile(yl_announcements.modpath .. "setup.lua") +dofile(yl_announcements.modpath .. "privs.lua") +dofile(yl_announcements.modpath .. "internal.lua") +dofile(yl_announcements.modpath .. "api.lua") +dofile(yl_announcements.modpath .. "distinct_feature.lua") +dofile(yl_announcements.modpath .. "overwrite_feature.lua") +dofile(yl_announcements.modpath .. "globalsteps.lua") +dofile(yl_announcements.modpath .. "chatcommands.lua") local mod_end_time = (core.get_us_time() - mod_start_time) / 1000000 -core.log("action", "[MOD] yl_template loaded in [" .. mod_end_time .. "s]") +core.log("action", "[MOD] yl_announcements loaded in [" .. mod_end_time .. "s]") diff --git a/internal.lua b/internal.lua index 54856da..569db3d 100644 --- a/internal.lua +++ b/internal.lua @@ -4,13 +4,13 @@ local debug = true local function say(text) - if yl_template.debug then - core.log("action", "[MOD] yl_template : " .. text) + if yl_announcements.debug then + core.log("action", "[MOD] yl_announcements : " .. text) end end local function save_path(file) - return yl_template.worldpath .. file .. ".json" + return yl_announcements.worldpath .. file .. ".json" end local function save_json(filename, content) @@ -44,10 +44,10 @@ end -- Public functions wrap the private ones, so they can be exchanged easily -function yl_template.load(filename, ...) +function yl_announcements.load(filename, ...) return load_json(filename, ...) end -function yl_template.save(filename, content, ...) +function yl_announcements.save(filename, content, ...) return save_json(filename, content, ...) end \ No newline at end of file diff --git a/mod.conf b/mod.conf index 58188ed..ed18b13 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ -name = yl_template +name = yl_announcements description = A template with best practices depends = default optional_depends = moreblocks diff --git a/priv_example.lua b/priv_example.lua index 75392cc..706bff3 100644 --- a/priv_example.lua +++ b/priv_example.lua @@ -23,7 +23,7 @@ local priv_definition = { end core.log( "action", - "[MOD] yl_template: User " .. granter_name .. " granted user " .. name .. " priv " .. priv_name + "[MOD] yl_announcements: User " .. granter_name .. " granted user " .. name .. " priv " .. priv_name ) end, -- Called when given to player 'name' by 'granter_name'. @@ -42,7 +42,7 @@ local priv_definition = { end core.log( "action", - "[MOD] yl_template: User " .. revoker_name .. " revoked user " .. name .. " priv " .. priv_name + "[MOD] yl_announcements: User " .. revoker_name .. " revoked user " .. name .. " priv " .. priv_name ) end -- Called when taken from player 'name' by 'revoker_name'. diff --git a/privs.lua b/privs.lua index 8d26d4e..2864f98 100644 --- a/privs.lua +++ b/privs.lua @@ -1 +1 @@ -dofile(yl_template.modpath .. "priv_example.lua") \ No newline at end of file +dofile(yl_announcements.modpath .. "priv_example.lua") \ No newline at end of file diff --git a/settingtypes.txt b/settingtypes.txt index 61368ba..8f3ae53 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -3,4 +3,4 @@ # First line: Name the settings # Second line: Say what it does, how to use it, what it changes # Third line: Is it optional? What's the default value? Does it expect a certain set of values? -yl_template.external_value (Description of the setting) string "default_value" +yl_announcements.external_value (Description of the setting) string "default_value" diff --git a/setup.lua b/setup.lua index ac4c614..c4016f9 100644 --- a/setup.lua +++ b/setup.lua @@ -1,15 +1,15 @@ local function run_once() - local dl = minetest.get_dir_list(yl_template.worldpath, true) + local dl = minetest.get_dir_list(yl_announcements.worldpath, true) local create = true for _, v in ipairs(dl) do - if v == yl_template.settings.save_path then + if v == yl_announcements.settings.save_path then create = false end end if create then - minetest.mkdir(yl_template.worldpath .. DIR_DELIM .. yl_template.settings.save_path) + minetest.mkdir(yl_announcements.worldpath .. DIR_DELIM .. yl_announcements.settings.save_path) end end