From d13d6f60b0ddf197dadb9226c39be0457e3f17d7 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Sat, 13 Jul 2024 22:16:09 +0200 Subject: [PATCH] Removes all unneccessary files --- api.lua | 34 ------------------- chatcommand_admin.lua | 19 ----------- chatcommand_player.lua | 19 ----------- chatcommands.lua | 2 -- globalsteps.lua | 13 -------- init.lua | 7 +--- priv_example.lua | 76 ------------------------------------------ privs.lua | 1 - setup.lua | 19 ----------- 9 files changed, 1 insertion(+), 189 deletions(-) delete mode 100644 api.lua delete mode 100644 chatcommand_admin.lua delete mode 100644 chatcommand_player.lua delete mode 100644 chatcommands.lua delete mode 100644 globalsteps.lua delete mode 100644 priv_example.lua delete mode 100644 privs.lua delete mode 100644 setup.lua diff --git a/api.lua b/api.lua deleted file mode 100644 index 1394a27..0000000 --- a/api.lua +++ /dev/null @@ -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_mtg.some_api_call(target, message, color) - - if (type(target) ~= "string") then - return false, yl_canned_food_mtg.t("error_not_a_string", "target") - end - if (minetest.get_player_by_name(target) == nil) then - return false, yl_canned_food_mtg.t("error_player_not_online", target) - end - - if (type(message) ~= "string") then - return false, yl_canned_food_mtg.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_mtg.t("error_not_a_colorspec", "color") - end - - if (minetest.colorize == nil) then - return false, yl_canned_food_mtg.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_mtg.t("api_sent_x_to_y", message_with_color, target) -end diff --git a/chatcommand_admin.lua b/chatcommand_admin.lua deleted file mode 100644 index dfd1da1..0000000 --- a/chatcommand_admin.lua +++ /dev/null @@ -1,19 +0,0 @@ -local chatcommand_cmd = "admin_example" -local chatcommand_definition = { - params = yl_canned_food_mtg.t("chatcommand_admin_parameters"), -- Short parameter description - description = yl_canned_food_mtg.t("chatcommand_admin_description"), -- Full description - privs = {[yl_canned_food_mtg.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_mtg.t("chatcommand_admin_success_message") - else - return false, yl_canned_food_mtg.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) diff --git a/chatcommand_player.lua b/chatcommand_player.lua deleted file mode 100644 index eaaa744..0000000 --- a/chatcommand_player.lua +++ /dev/null @@ -1,19 +0,0 @@ -local chatcommand_cmd = "player_example" -local chatcommand_definition = { - params = yl_canned_food_mtg.t("chatcommand_player_parameters"), -- Short parameter description - description = yl_canned_food_mtg.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_mtg.t("chatcommand_player_parameters") - else - return false, yl_canned_food_mtg.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) diff --git a/chatcommands.lua b/chatcommands.lua deleted file mode 100644 index d6a0b63..0000000 --- a/chatcommands.lua +++ /dev/null @@ -1,2 +0,0 @@ -dofile(yl_canned_food_mtg.modpath .. "chatcommand_admin.lua") -dofile(yl_canned_food_mtg.modpath .. "chatcommand_player.lua") \ No newline at end of file diff --git a/globalsteps.lua b/globalsteps.lua deleted file mode 100644 index 5a51478..0000000 --- a/globalsteps.lua +++ /dev/null @@ -1,13 +0,0 @@ -local timer = 0 - -local gs = function(dtime) - timer = timer + dtime - if timer <= yl_canned_food_mtg.config.interval then - return - end - timer = 0 - - -- do stuff -end - -minetest.register_globalstep(gs) diff --git a/init.lua b/init.lua index 788b743..44bf3b3 100644 --- a/init.lua +++ b/init.lua @@ -17,15 +17,10 @@ yl_canned_food_mtg.modpath = minetest.get_modpath("yl_canned_food_mtg") .. DIR_D dofile(yl_canned_food_mtg.modpath .. "texts.lua") dofile(yl_canned_food_mtg.modpath .. "information.lua") dofile(yl_canned_food_mtg.modpath .. "config.lua") --- dofile(yl_canned_food_mtg.modpath .. "setup.lua") --- dofile(yl_canned_food_mtg.modpath .. "privs.lua") dofile(yl_canned_food_mtg.modpath .. "internal.lua") --- dofile(yl_canned_food_mtg.modpath .. "api.lua") dofile(yl_canned_food_mtg.modpath .. "initialize.lua") dofile(yl_canned_food_mtg.modpath .. "features.lua") --- dofile(yl_canned_food_mtg.modpath .. "overwrite_feature.lua") --- dofile(yl_canned_food_mtg.modpath .. "globalsteps.lua") --- dofile(yl_canned_food_mtg.modpath .. "chatcommands.lua") + local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000 minetest.log("action", "[MOD] yl_canned_food_mtg loaded in [" .. mod_end_time .. "s]") diff --git a/priv_example.lua b/priv_example.lua deleted file mode 100644 index da1add7..0000000 --- a/priv_example.lua +++ /dev/null @@ -1,76 +0,0 @@ -local priv_name = "example" -local priv_definition = { - description = yl_canned_food_mtg.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_mtg.t("error_name_not_found", - dump(granter_name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - if not name then - local errormessage = yl_canned_food_mtg.t("error_name_not_found", - dump(name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - if not priv_name then - local errormessage = yl_canned_food_mtg.t("error_priv_not_found", - dump(priv_name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - local text = yl_canned_food_mtg.t("privs_example_grant_logmessage", - dump(granter_name), dump(priv_name), - dump(name)) - yl_canned_food_mtg.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_mtg.t("error_name_not_found", - dump(revoker_name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - if not name then - local errormessage = yl_canned_food_mtg.t("error_name_not_found", - dump(name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - if not priv_name then - local errormessage = yl_canned_food_mtg.t("error_priv_not_found", - dump(priv_name)) - yl_canned_food_mtg.log(errormessage) - return false, errormessage - end - local text = yl_canned_food_mtg.t("privs_example_revoke_logmessage", - dump(revoker_name), dump(priv_name), - dump(name)) - yl_canned_food_mtg.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) diff --git a/privs.lua b/privs.lua deleted file mode 100644 index 99742a9..0000000 --- a/privs.lua +++ /dev/null @@ -1 +0,0 @@ -dofile(yl_canned_food_mtg.modpath .. "priv_example.lua") \ No newline at end of file diff --git a/setup.lua b/setup.lua deleted file mode 100644 index 9c74871..0000000 --- a/setup.lua +++ /dev/null @@ -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_mtg.settings.save_path - -local function run_once() - local path = yl_canned_food_mtg.worldpath .. DIR_DELIM .. save_path - local file = io.open(path, "r") - if not file then - mkdir(path) - else - file:close() - end - -end - -run_once()