Removes all unneccessary files

This commit is contained in:
AliasAlreadyTaken 2024-07-13 22:16:09 +02:00
parent 4aaa9b3f65
commit d13d6f60b0
9 changed files with 1 additions and 189 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_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

View File

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

View File

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

View File

@ -1,2 +0,0 @@
dofile(yl_canned_food_mtg.modpath .. "chatcommand_admin.lua")
dofile(yl_canned_food_mtg.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_mtg.config.interval then
return
end
timer = 0
-- do stuff
end
minetest.register_globalstep(gs)

View File

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

View File

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

View File

@ -1 +0,0 @@
dofile(yl_canned_food_mtg.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_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()