Make give_initial mod a bit cleaner and simpler

This commit is contained in:
KaadmY 2017-05-15 15:45:40 -07:00
parent bbab85293e
commit 6db576b787
6 changed files with 31 additions and 24 deletions

View File

@ -29,9 +29,10 @@ default_privs = fast, interact, player_skin, shout, spawn, zoom
welcome_enable = true
# If you're given the inital stuff; a stone pick and 10 torches
# If you're given the inital stuff
give_initial_stuff = false
give_initial_enable = false
give_initial_items = default:pick_stone,default:torch_weak 10
# If players with interact can use the /fixlight chat command

View File

@ -1,5 +1,5 @@
Give initial stuff mod
======================
By Kaadmy
By Kaadmy, for Pixture
Source license: LGPLv2.1

View File

@ -0,0 +1,21 @@
--
-- Gives initial stuff
-- By Kaadmy, for Pixture
--
local give_initial_enable = minetest.setting_getbool("give_initial_enable")
local give_initial_items = util.split(minetest.setting_get("give_initial_items"), ",")
local function on_newplayer(player)
if give_initial_stuff_enable then
local inv = player:get_inventory()
for _, itemstring in ipairs(give_initial_items) do
inv:add_item("main", itemstring)
end
end
end
minetest.register_on_newplayer(on_newplayer)
default.log("mod:give_initial", "loaded")

View File

@ -1,19 +0,0 @@
--
-- Gives initial stuff
-- By Kaadmy, for Pixture
--
local giveme = minetest.setting_getbool("give_initial_stuff")
local function give_initial_stuff(player)
if giveme then
local inv=player:get_inventory()
inv:add_item("main", "default:pick_stone")
inv:add_item("main", "default:torch_weak 10")
end
end
minetest.register_on_newplayer(give_initial_stuff)
default.log("mod:give_initial_stuff", "loaded")

View File

@ -9,12 +9,15 @@ welcome_enable (Welcome) bool true
## Player stuff
give_initial_stuff (Give initial items) bool false
drop_items_on_die (Drop items on death) bool true
enable_pvp (PvP) bool true
## Initial items
give_initial_enable (Enable initial items) bool false
give_initial_items (Initial items) string default:pick_stone,default:torch_weak 10
## TNT
tnt_enable (Enable TNT) bool true