From e419dba60f98f3fe967e05082fc5023acc089d96 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Wed, 12 Jun 2024 17:59:01 +0200 Subject: [PATCH] Removes all unneccessary files --- .luacheckrc | 7 ++-- chatcommand_admin.lua | 19 ----------- chatcommand_player.lua | 19 ----------- chatcommands.lua | 2 -- globalsteps.lua | 13 -------- init.lua | 2 -- initialize.lua | 9 ----- priv_example.lua | 76 ------------------------------------------ privs.lua | 1 - setup.lua | 19 ----------- 10 files changed, 5 insertions(+), 162 deletions(-) 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 initialize.lua delete mode 100644 priv_example.lua delete mode 100644 privs.lua delete mode 100644 setup.lua diff --git a/.luacheckrc b/.luacheckrc index 83b7697..fc9aeec 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -2,14 +2,17 @@ unused_args = false allow_defined_top = true globals = { - "minetest", - "core" + "yl_api_food" } read_globals = { string = {fields = {"split"}}, table = {fields = {"copy", "getn"}}, + -- Core + "minetest", + "core", + -- Builtin "vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", diff --git a/chatcommand_admin.lua b/chatcommand_admin.lua deleted file mode 100644 index 3d2240a..0000000 --- a/chatcommand_admin.lua +++ /dev/null @@ -1,19 +0,0 @@ -local chatcommand_cmd = "admin_example" -local chatcommand_definition = { - params = yl_api_food.t("chatcommand_admin_parameters"), -- Short parameter description - description = yl_api_food.t("chatcommand_admin_description"), -- Full description - privs = {[yl_api_food.settings.admin_priv] = true}, -- Require the "privs" privilege to run - func = function(name, param) - local success = true - if success then - return true, yl_api_food.t("chatcommand_admin_success_message") - else - return false, yl_api_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) diff --git a/chatcommand_player.lua b/chatcommand_player.lua deleted file mode 100644 index a8dadcc..0000000 --- a/chatcommand_player.lua +++ /dev/null @@ -1,19 +0,0 @@ -local chatcommand_cmd = "player_example" -local chatcommand_definition = { - params = yl_api_food.t("chatcommand_player_parameters"), -- Short parameter description - description = yl_api_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_api_food.t("chatcommand_player_parameters") - else - return false, yl_api_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) diff --git a/chatcommands.lua b/chatcommands.lua deleted file mode 100644 index 0778961..0000000 --- a/chatcommands.lua +++ /dev/null @@ -1,2 +0,0 @@ -dofile(yl_api_food.modpath .. "chatcommand_admin.lua") -dofile(yl_api_food.modpath .. "chatcommand_player.lua") \ No newline at end of file diff --git a/globalsteps.lua b/globalsteps.lua deleted file mode 100644 index f505b6d..0000000 --- a/globalsteps.lua +++ /dev/null @@ -1,13 +0,0 @@ -local timer = 0 - -local gs = function(dtime) - timer = timer + dtime - if timer <= yl_api_food.config.interval then - return - end - timer = 0 - - -- do stuff -end - -minetest.register_globalstep(gs) diff --git a/init.lua b/init.lua index 86f9c58..70495ba 100644 --- a/init.lua +++ b/init.lua @@ -17,10 +17,8 @@ yl_api_food.worldpath = minetest.get_worldpath() .. DIR_DELIM dofile(yl_api_food.modpath .. "texts.lua") dofile(yl_api_food.modpath .. "information.lua") dofile(yl_api_food.modpath .. "config.lua") - dofile(yl_api_food.modpath .. "internal.lua") dofile(yl_api_food.modpath .. "api.lua") -dofile(yl_api_food.modpath .. "initialize.lua") local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000 minetest.log("action", "[MOD] yl_api_food loaded in [" .. mod_end_time .. "s]") diff --git a/initialize.lua b/initialize.lua deleted file mode 100644 index 3e7559d..0000000 --- a/initialize.lua +++ /dev/null @@ -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_api_food.data = {} - --minetest.on_mods_loaded(0.0, yl_api_food.on_mods_loaded) - --minetest.after(0.0, yl_api_food.after) -end - -run_each_serverstart() diff --git a/priv_example.lua b/priv_example.lua deleted file mode 100644 index ee6e8d8..0000000 --- a/priv_example.lua +++ /dev/null @@ -1,76 +0,0 @@ -local priv_name = "example" -local priv_definition = { - description = yl_api_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_api_food.t("error_name_not_found", - dump(granter_name)) - yl_api_food.log(errormessage) - return false, errormessage - end - if not name then - local errormessage = yl_api_food.t("error_name_not_found", - dump(name)) - yl_api_food.log(errormessage) - return false, errormessage - end - if not priv_name then - local errormessage = yl_api_food.t("error_priv_not_found", - dump(priv_name)) - yl_api_food.log(errormessage) - return false, errormessage - end - local text = yl_api_food.t("privs_example_grant_logmessage", - dump(granter_name), dump(priv_name), - dump(name)) - yl_api_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_api_food.t("error_name_not_found", - dump(revoker_name)) - yl_api_food.log(errormessage) - return false, errormessage - end - if not name then - local errormessage = yl_api_food.t("error_name_not_found", - dump(name)) - yl_api_food.log(errormessage) - return false, errormessage - end - if not priv_name then - local errormessage = yl_api_food.t("error_priv_not_found", - dump(priv_name)) - yl_api_food.log(errormessage) - return false, errormessage - end - local text = yl_api_food.t("privs_example_revoke_logmessage", - dump(revoker_name), dump(priv_name), - dump(name)) - yl_api_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) diff --git a/privs.lua b/privs.lua deleted file mode 100644 index 1bb9b35..0000000 --- a/privs.lua +++ /dev/null @@ -1 +0,0 @@ -dofile(yl_api_food.modpath .. "priv_example.lua") \ No newline at end of file diff --git a/setup.lua b/setup.lua deleted file mode 100644 index 54b2554..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_api_food.settings.save_path - -local function run_once() - local path = yl_api_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()