Replaced yl_template with yl_announcements

This commit is contained in:
AliasAlreadyTaken 2023-09-17 23:23:46 +02:00
parent 0fad4f816d
commit 28be2e844c
12 changed files with 46 additions and 46 deletions

View File

@ -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

View File

@ -2,7 +2,7 @@ local chatcommand_cmd = "admin_example"
local chatcommand_definition = {
params = "<name> <privilege>", -- 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

View File

@ -1,2 +1,2 @@
dofile(yl_template.modpath .. "chatcommand_admin.lua")
dofile(yl_template.modpath .. "chatcommand_player.lua")
dofile(yl_announcements.modpath .. "chatcommand_admin.lua")
dofile(yl_announcements.modpath .. "chatcommand_player.lua")

View File

@ -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"
yl_announcements.settings.admin_priv = "admin_priv" or minetest.settings:get("yl_announcements.admin_priv") or "server"

View File

@ -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

View File

@ -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]")

View File

@ -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

View File

@ -1,4 +1,4 @@
name = yl_template
name = yl_announcements
description = A template with best practices
depends = default
optional_depends = moreblocks

View File

@ -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'.

View File

@ -1 +1 @@
dofile(yl_template.modpath .. "priv_example.lua")
dofile(yl_announcements.modpath .. "priv_example.lua")

View File

@ -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"

View File

@ -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