2014-11-01 17:21:26 +01:00
|
|
|
--[[
|
|
|
|
Beginners_chest mod
|
|
|
|
Put some useful stuff in a chest for the new players
|
|
|
|
|
|
|
|
Mod ßý Mg, based on an idea of MinetestForFun/Darcidride
|
|
|
|
]]--
|
|
|
|
|
|
|
|
chest_position = {x = 5, y = 40, z = -1}
|
|
|
|
local interval_timer = 0
|
2014-11-02 21:46:08 +01:00
|
|
|
local interval_max = 7200
|
2014-11-01 17:21:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
|
|
interval_timer = interval_timer+dtime
|
2014-11-02 21:47:19 +01:00
|
|
|
--print(interval_timer)
|
2014-11-02 21:46:08 +01:00
|
|
|
if interval_timer < interval_max then return end -- We have to wait
|
|
|
|
interval_timer = 0
|
2014-11-01 17:21:26 +01:00
|
|
|
local chest = minetest.get_node(chest_position)
|
|
|
|
if chest.name ~= "default:chest" then
|
|
|
|
if chest.name == "ignore" then
|
2014-11-02 21:46:08 +01:00
|
|
|
minetest.log("action","[b_chest] Unable to reload chest : area not loaded") -- c'est cool mais ça fait une boucle et un debug.txt de 40Mo
|
2014-11-01 17:21:26 +01:00
|
|
|
return
|
|
|
|
elseif chest.name ~= "air" then
|
2014-11-02 21:46:08 +01:00
|
|
|
minetest.log("action","[b_chest] Unable to place chest : position still used") -- c'est cool mais ça fait une boucle et un debug.txt de 40Mo
|
2014-11-01 17:21:26 +01:00
|
|
|
return
|
|
|
|
elseif chest.name == "air" then
|
|
|
|
minetest.add_node(chest_position,{name = "default:chest"})
|
2014-11-02 21:46:08 +01:00
|
|
|
minetest.log("action","[b_chest] Chest placed")
|
2014-11-01 17:21:26 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local meta = minetest.get_meta(chest_position)
|
|
|
|
local inv = meta:get_inventory()
|
2014-11-02 20:26:31 +01:00
|
|
|
inv:set_list("main",{[1] = "3d_armor:boots_steel", [2] = "default:pick_stone", [3] = "default:sword_stone", [32] = ""})
|
2014-11-02 21:46:08 +01:00
|
|
|
|
2014-11-01 17:21:26 +01:00
|
|
|
end)
|