From 45b4b4a458871c206455d183300fe23da67a0713 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sun, 15 Jan 2023 21:21:26 -0500 Subject: [PATCH] renamed to mcl_starting_inventory as that is what it is. --- mods/PLAYER/mcl_starting_chest/init.lua | 49 ------------------- .../README.txt | 2 +- mods/PLAYER/mcl_starting_inventory/init.lua | 49 +++++++++++++++++++ .../license.txt | 0 .../mod.conf | 2 +- 5 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 mods/PLAYER/mcl_starting_chest/init.lua rename mods/PLAYER/{mcl_starting_chest => mcl_starting_inventory}/README.txt (82%) create mode 100644 mods/PLAYER/mcl_starting_inventory/init.lua rename mods/PLAYER/{mcl_starting_chest => mcl_starting_inventory}/license.txt (100%) rename mods/PLAYER/{mcl_starting_chest => mcl_starting_inventory}/mod.conf (78%) diff --git a/mods/PLAYER/mcl_starting_chest/init.lua b/mods/PLAYER/mcl_starting_chest/init.lua deleted file mode 100644 index 5ee21e22b..000000000 --- a/mods/PLAYER/mcl_starting_chest/init.lua +++ /dev/null @@ -1,49 +0,0 @@ ---- Copyright 2023, Michieal. (Modifications for the mod to be usable in Mineclone 2.) ---- Based on mtg mod, give_initial_stuff. "Written by C55 and various minetest developers." ---- ---- Copyright notice created for the license to be valid. (MIT 3) - -local stuff_string = minetest.settings:get("starter_chest_contents") or - "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron," .. - "mcl_torches:torch 32,mcl_core:cobble 64" - -mcl_starting_chest = { - items = {} -} - -function mcl_starting_chest.give(player) - minetest.log("action", - "Giving initial stuff to player " .. player:get_player_name()) - local inv = player:get_inventory() - for _, stack in ipairs(mcl_starting_chest.items) do - inv:add_item("main", stack) - end -end - -function mcl_starting_chest.add(stack) - mcl_starting_chest.items[#mcl_starting_chest.items + 1] = ItemStack(stack) -end - -function mcl_starting_chest.clear() - mcl_starting_chest.items = {} -end - -function mcl_starting_chest.add_from_csv(str) - local items = str:split(",") - for _, itemname in ipairs(items) do - mcl_starting_chest.add(itemname) - end -end - -function mcl_starting_chest.set_list(list) - mcl_starting_chest.items = list -end - -function mcl_starting_chest.get_list() - return mcl_starting_chest.items -end - -mcl_starting_chest.add_from_csv(stuff_string) -if minetest.settings:get_bool("mcl_starting_chest") then - minetest.register_on_newplayer(mcl_starting_chest.give) -end diff --git a/mods/PLAYER/mcl_starting_chest/README.txt b/mods/PLAYER/mcl_starting_inventory/README.txt similarity index 82% rename from mods/PLAYER/mcl_starting_chest/README.txt rename to mods/PLAYER/mcl_starting_inventory/README.txt index da63a662b..126504b04 100644 --- a/mods/PLAYER/mcl_starting_chest/README.txt +++ b/mods/PLAYER/mcl_starting_inventory/README.txt @@ -1,4 +1,4 @@ -Adapted for Mineclone 2 by Michieal. +Mcl_starting_inventory, adapted for Mineclone 2 by Michieal. Based on: Minetest Game mod: give_initial_stuff diff --git a/mods/PLAYER/mcl_starting_inventory/init.lua b/mods/PLAYER/mcl_starting_inventory/init.lua new file mode 100644 index 000000000..836cb17a6 --- /dev/null +++ b/mods/PLAYER/mcl_starting_inventory/init.lua @@ -0,0 +1,49 @@ +--- Copyright 2023, Michieal. (Modifications for the mod to be usable in Mineclone 2.) +--- Based on mtg mod, give_initial_stuff. "Written by C55 and various minetest developers." +--- +--- Copyright notice created for the license to be valid. (MIT 3) + +local stuff_string = minetest.settings:get("starter_chest_contents") or + "mcl_tools:pick_iron,mcl_tools:axe_iron,mcl_tools:shovel_iron," .. + "mcl_torches:torch 32,mcl_core:cobble 64" + +mcl_starting_inventory = { + items = {} +} + +function mcl_starting_inventory.give(player) + minetest.log("action", + "Giving initial stuff to player " .. player:get_player_name()) + local inv = player:get_inventory() + for _, stack in ipairs(mcl_starting_inventory.items) do + inv:add_item("main", stack) + end +end + +function mcl_starting_inventory.add(stack) + mcl_starting_inventory.items[#mcl_starting_inventory.items + 1] = ItemStack(stack) +end + +function mcl_starting_inventory.clear() + mcl_starting_inventory.items = {} +end + +function mcl_starting_inventory.add_from_csv(str) + local items = str:split(",") + for _, itemname in ipairs(items) do + mcl_starting_inventory.add(itemname) + end +end + +function mcl_starting_inventory.set_list(list) + mcl_starting_inventory.items = list +end + +function mcl_starting_inventory.get_list() + return mcl_starting_inventory.items +end + +mcl_starting_inventory.add_from_csv(stuff_string) +if minetest.settings:get_bool("mcl_starting_inventory") then + minetest.register_on_newplayer(mcl_starting_inventory.give) +end diff --git a/mods/PLAYER/mcl_starting_chest/license.txt b/mods/PLAYER/mcl_starting_inventory/license.txt similarity index 100% rename from mods/PLAYER/mcl_starting_chest/license.txt rename to mods/PLAYER/mcl_starting_inventory/license.txt diff --git a/mods/PLAYER/mcl_starting_chest/mod.conf b/mods/PLAYER/mcl_starting_inventory/mod.conf similarity index 78% rename from mods/PLAYER/mcl_starting_chest/mod.conf rename to mods/PLAYER/mcl_starting_inventory/mod.conf index 2232e117b..d79c6e0af 100644 --- a/mods/PLAYER/mcl_starting_chest/mod.conf +++ b/mods/PLAYER/mcl_starting_inventory/mod.conf @@ -1,3 +1,3 @@ -name = mcl_starting_chest +name = mcl_starting_inventory description = Mineclone 2 mod, Starting Chest. (Gives starter chest to players.) depends = mcl_core, mcl_chests