From ee86fb1c41e7d8d2a1d94764dd64808bc8ff5999 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Mon, 13 Dec 2021 20:12:36 -0600 Subject: [PATCH] * document, configure and improve the give_initial_stuff * This mod provides some stuff per player at initial play when first join only * set initial_stuff = default:wood 2,farming:bread 2,default:furnace 1,default:torch 5 * the initial_stuff is only configured per config files not at menu * cherry-picked from https://codeberg.org/minenux/minetest-game-minetest/commit/18aed0219b7b1190c15d16b059d509cd65922412 --- minetest.conf.example | 8 +++++--- mods/give_initial_stuff/README.md | 26 ++++++++++++++++++++++++++ mods/give_initial_stuff/README.txt | 26 ++++++++++++++++++++++---- mods/give_initial_stuff/init.lua | 11 +++++++---- mods/give_initial_stuff/mod.conf | 4 ++-- settingtypes.txt | 2 +- 6 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 mods/give_initial_stuff/README.md diff --git a/minetest.conf.example b/minetest.conf.example index 86eba66..66497c2 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -38,9 +38,11 @@ #enable_lavacooling = true # Whether the stuff in initial_stuff should be given to new players. -#give_initial_stuff = false -#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel, -default:torch 99,default:cobble 99 +# its depends of the configured at the initital_stuff_mod +#give_initial_stuff = true + +# What initial stuff will be given to player if initial stuff are set to true +#initial_stuff = default:wood,farming:bread,default:furnace,default:torch # Whether the TNT mod should be enabled. #enable_tnt = diff --git a/mods/give_initial_stuff/README.md b/mods/give_initial_stuff/README.md new file mode 100644 index 0000000..652a259 --- /dev/null +++ b/mods/give_initial_stuff/README.md @@ -0,0 +1,26 @@ +Minetest mod: give_initial_stuff +================================ + +This mod provides some stuff per player at initial play when first join only + +Usage and information +--------------------- + +To activate initial stuff per players do per config file: + +`give_initial_stuff = true` + +To specify the stuff per config file use by example: + +`initial_stuff = default:wood 2,farming:bread 2,default:furnace 1,default:torch 5` + + +LICENSE +------- + +See license.txt for license information. + +#### Authors of source code + +Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) diff --git a/mods/give_initial_stuff/README.txt b/mods/give_initial_stuff/README.txt index cbd240f..652a259 100644 --- a/mods/give_initial_stuff/README.txt +++ b/mods/give_initial_stuff/README.txt @@ -1,8 +1,26 @@ -Minetest Game mod: give_initial_stuff -===================================== +Minetest mod: give_initial_stuff +================================ + +This mod provides some stuff per player at initial play when first join only + +Usage and information +--------------------- + +To activate initial stuff per players do per config file: + +`give_initial_stuff = true` + +To specify the stuff per config file use by example: + +`initial_stuff = default:wood 2,farming:bread 2,default:furnace 1,default:torch 5` + + +LICENSE +------- + See license.txt for license information. -Authors of source code ----------------------- +#### Authors of source code + Perttu Ahola (celeron55) (MIT) Various Minetest developers and contributors (MIT) diff --git a/mods/give_initial_stuff/init.lua b/mods/give_initial_stuff/init.lua index 74421dc..134815b 100644 --- a/mods/give_initial_stuff/init.lua +++ b/mods/give_initial_stuff/init.lua @@ -1,16 +1,18 @@ -- gave_initial_stuff/init.lua local stuff_string = minetest.settings:get("initial_stuff") or - "default:pick_steel,default:axe_steel,default:shovel_steel," .. - "default:torch 99,default:cobble 99" + "default:wood 2,farming:bread 2,default:furnace 1," .. + "default:torch 5" + +local modname = "give_initial_stuff" +local modlogn = "["..modname.."]" give_initial_stuff = { items = {} } function give_initial_stuff.give(player) - minetest.log("action", - "Giving initial stuff to player " .. player:get_player_name()) + minetest.log("action",modlogn.." Giving initial stuff to player " .. player:get_player_name()) local inv = player:get_inventory() for _, stack in ipairs(give_initial_stuff.items) do inv:add_item("main", stack) @@ -44,3 +46,4 @@ give_initial_stuff.add_from_csv(stuff_string) if minetest.settings:get_bool("give_initial_stuff") then minetest.register_on_newplayer(give_initial_stuff.give) end + diff --git a/mods/give_initial_stuff/mod.conf b/mods/give_initial_stuff/mod.conf index 51d31ae..a4c1007 100644 --- a/mods/give_initial_stuff/mod.conf +++ b/mods/give_initial_stuff/mod.conf @@ -1,3 +1,3 @@ name = give_initial_stuff -description = Minetest Game mod: give_initial_stuff -depends = default +description = provide initial stuff at first player join +depends = default,farming diff --git a/settingtypes.txt b/settingtypes.txt index 695f871..e727ccc 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -21,7 +21,7 @@ enable_lavacooling (Lavacooling) bool true # If enabled, steel tools, torches and cobblestone will be given to new # players. -give_initial_stuff (Give initial items) bool false +give_initial_stuff (Give initial items) bool true # If enabled, players respawn at the bed they last lay on instead of normal # spawn.