Make give_initial mod a bit cleaner and simpler
This commit is contained in:
parent
bbab85293e
commit
6db576b787
@ -29,9 +29,10 @@ default_privs = fast, interact, player_skin, shout, spawn, zoom
|
|||||||
|
|
||||||
welcome_enable = true
|
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
|
# If players with interact can use the /fixlight chat command
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Give initial stuff mod
|
Give initial stuff mod
|
||||||
======================
|
======================
|
||||||
By Kaadmy
|
By Kaadmy, for Pixture
|
||||||
|
|
||||||
Source license: LGPLv2.1
|
Source license: LGPLv2.1
|
@ -1 +1,2 @@
|
|||||||
default
|
default
|
||||||
|
util
|
21
mods/give_initial/init.lua
Normal file
21
mods/give_initial/init.lua
Normal 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")
|
@ -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")
|
|
@ -9,12 +9,15 @@ welcome_enable (Welcome) bool true
|
|||||||
|
|
||||||
## Player stuff
|
## Player stuff
|
||||||
|
|
||||||
give_initial_stuff (Give initial items) bool false
|
|
||||||
|
|
||||||
drop_items_on_die (Drop items on death) bool true
|
drop_items_on_die (Drop items on death) bool true
|
||||||
|
|
||||||
enable_pvp (PvP) 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
|
||||||
|
|
||||||
tnt_enable (Enable TNT) bool true
|
tnt_enable (Enable TNT) bool true
|
||||||
|
Loading…
Reference in New Issue
Block a user