Removes unneccessary files

This commit is contained in:
AliasAlreadyTaken 2024-06-12 19:47:09 +02:00
parent 49f8f30832
commit 4c1822fc4d
10 changed files with 0 additions and 246 deletions

34
api.lua
View File

@ -1,34 +0,0 @@
-- Use this file for functions that can be called from other mods
-- Make sure the functions are well defended against wrong input and
-- document them on the readme, what they do, what types and values
-- they expect as parameters and what types and values they return.
-- If you ever change those, consider adding backwards compatibility,
-- since other mods may rely on them.
function yl_canned_food.some_api_call(target, message, color)
if (type(target) ~= "string") then
return false, yl_canned_food.t("error_not_a_string", "target")
end
if (minetest.get_player_by_name(target) == nil) then
return false, yl_canned_food.t("error_player_not_online", target)
end
if (type(message) ~= "string") then
return false, yl_canned_food.t("error_not_a_string", "message")
end
-- is_color(color) does not exist, you need to implement it if you want to use it
if (is_color(color) == false) then
return false, yl_canned_food.t("error_not_a_colorspec", "color")
end
if (minetest.colorize == nil) then
return false, yl_canned_food.t("error_function_not_available",
"minetest.colorize")
end
local message_with_color = minetest.colorize(color, message)
minetest.chat_send_player(target, message_with_color)
return true, yl_canned_food.t("api_sent_x_to_y", message_with_color, target)
end

View File

@ -1,19 +0,0 @@
local chatcommand_cmd = "admin_example"
local chatcommand_definition = {
params = yl_canned_food.t("chatcommand_admin_parameters"), -- Short parameter description
description = yl_canned_food.t("chatcommand_admin_description"), -- Full description
privs = {[yl_canned_food.settings.admin_priv] = true}, -- Require the "privs" privilege to run
func = function(name, param)
local success = true
if success then
return true, yl_canned_food.t("chatcommand_admin_success_message")
else
return false, yl_canned_food.t("chatcommand_admin_fail_message")
end
end
-- Called when command is run. Returns boolean success and text output.
-- Special case: The help message is shown to the player if `func`
-- returns false without a text output.
}
minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)

View File

@ -1,19 +0,0 @@
local chatcommand_cmd = "player_example"
local chatcommand_definition = {
params = yl_canned_food.t("chatcommand_player_parameters"), -- Short parameter description
description = yl_canned_food.t("chatcommand_player_parameters"), -- Full description
privs = {privs = true}, -- Require the "privs" privilege to run
func = function(name, param)
local success = true
if success then
return true, yl_canned_food.t("chatcommand_player_parameters")
else
return false, yl_canned_food.t("chatcommand_player_parameters")
end
end
-- Called when command is run. Returns boolean success and text output.
-- Special case: The help message is shown to the player if `func`
-- returns false without a text output.
}
minetest.register_chatcommand(chatcommand_cmd, chatcommand_definition)

View File

@ -1,2 +0,0 @@
dofile(yl_canned_food.modpath .. "chatcommand_admin.lua")
dofile(yl_canned_food.modpath .. "chatcommand_player.lua")

View File

@ -1,13 +0,0 @@
local timer = 0
local gs = function(dtime)
timer = timer + dtime
if timer <= yl_canned_food.config.interval then
return
end
timer = 0
-- do stuff
end
minetest.register_globalstep(gs)

View File

@ -1,9 +0,0 @@
-- Use this file to initialize variables once after server start and check everything is in place
local function run_each_serverstart()
yl_canned_food.data = {}
--minetest.on_mods_loaded(0.0, yl_canned_food.on_mods_loaded)
--minetest.after(0.0, yl_canned_food.after)
end
run_each_serverstart()

View File

@ -1,54 +0,0 @@
-- The functions and variables in this file are only for use in the mod itself.
-- Those that do real work should be local and wrapped in public functions
local function log(text)
local logmessage = yl_canned_food.t("log_prefix", yl_canned_food.modname, text)
if yl_canned_food.settings.debug then minetest.log("action", logmessage) end
return logmessage
end
function yl_canned_food.log(text) return log(text) end
local function get_savepath()
local savepath = yl_canned_food.worldpath .. yl_canned_food.settings.save_path
log(yl_canned_food.t("log_prefix", dump(savepath)))
return savepath
end
local function get_filepath(filename)
local path_to_file = get_savepath() .. DIR_DELIM .. filename .. ".json"
log(yl_canned_food.t("get_filepath", dump(filename), dump(path_to_file)))
return path_to_file
end
local function save_json(filename, content)
if type(filename) ~= "string" or type(content) ~= "table" then
return false
end
local savepath = get_filepath(filename)
local savecontent = minetest.write_json(content)
return minetest.safe_file_write(savepath, savecontent)
end
local function load_json(path)
local file = io.open(path, "r")
if not file then
return false, yl_canned_food.t("error_cannot_open_file", dump(path))
end
local content = file:read("*all")
file:close()
if not content then
return false, yl_canned_food.t("error_cannot_read_file", dump(path))
end
return true, minetest.parse_json(content)
end
-- Public functions wrap the private ones, so they can be exchanged easily
function yl_canned_food.load(filename, ...) return load_json(filename, ...) end
function yl_canned_food.save(filename, content, ...)
return save_json(filename, content, ...)
end

View File

@ -1,76 +0,0 @@
local priv_name = "example"
local priv_definition = {
description = yl_canned_food.t("privs_example_description"),
-- Privilege description
give_to_singleplayer = false,
-- Whether to grant the privilege to singleplayer.
give_to_admin = true,
-- Whether to grant the privilege to the server admin.
-- Uses value of 'give_to_singleplayer' by default.
on_grant = function(name, granter_name)
-- logging
if (type(granter_name) ~= "string") then
local errormessage = yl_canned_food.t("error_name_not_found",
dump(granter_name))
yl_canned_food.log(errormessage)
return false, errormessage
end
if not name then
local errormessage = yl_canned_food.t("error_name_not_found",
dump(name))
yl_canned_food.log(errormessage)
return false, errormessage
end
if not priv_name then
local errormessage = yl_canned_food.t("error_priv_not_found",
dump(priv_name))
yl_canned_food.log(errormessage)
return false, errormessage
end
local text = yl_canned_food.t("privs_example_grant_logmessage",
dump(granter_name), dump(priv_name),
dump(name))
yl_canned_food.log(text)
end,
-- Called when given to player 'name' by 'granter_name'.
-- 'granter_name' will be nil if the priv was granted by a mod.
on_revoke = function(name, revoker_name)
-- logging
if (type(revoker_name) ~= "string") then
local errormessage = yl_canned_food.t("error_name_not_found",
dump(revoker_name))
yl_canned_food.log(errormessage)
return false, errormessage
end
if not name then
local errormessage = yl_canned_food.t("error_name_not_found",
dump(name))
yl_canned_food.log(errormessage)
return false, errormessage
end
if not priv_name then
local errormessage = yl_canned_food.t("error_priv_not_found",
dump(priv_name))
yl_canned_food.log(errormessage)
return false, errormessage
end
local text = yl_canned_food.t("privs_example_revoke_logmessage",
dump(revoker_name), dump(priv_name),
dump(name))
yl_canned_food.log(text)
end
-- Called when taken from player 'name' by 'revoker_name'.
-- 'revoker_name' will be nil if the priv was revoked by a mod.
-- Note that the above two callbacks will be called twice if a player is
-- responsible, once with the player name, and then with a nil player
-- name.
-- Return true in the above callbacks to stop register_on_priv_grant or
-- revoke being called.
}
minetest.register_privilege(priv_name, priv_definition)

View File

@ -1 +0,0 @@
dofile(yl_canned_food.modpath .. "priv_example.lua")

View File

@ -1,19 +0,0 @@
-- Use this file to set up folder and variables once after installation of the mod
-- Afterwards you could disable this part of the code or set a variable that tells
-- this code not to run again
local mkdir = minetest.mkdir
local save_path = yl_canned_food.settings.save_path
local function run_once()
local path = yl_canned_food.worldpath .. DIR_DELIM .. save_path
local file = io.open(path, "r")
if not file then
mkdir(path)
else
file:close()
end
end
run_once()