Use new doc_items interface
[minetest_bedrock2.git] / init.lua
blob6c68f183aa6572bfa4df60662a49173b58c174ef
1 local S
2 if (minetest.get_modpath("intllib")) then
3 dofile(minetest.get_modpath("intllib").."/intllib.lua")
4 S = intllib.Getter(minetest.get_current_modname())
5 else
6 S = function ( s ) return s end
7 end
9 local bedrock = {}
11 bedrock.layer = -30912 -- determined as appropriate by experiment
12 bedrock.node = {name = "bedrock2:bedrock"}
14 local depth = tonumber(minetest.setting_get("bedrock2_y"))
15 if depth ~= nil then
16 bedrock.layer = depth
17 end
19 minetest.register_on_generated(function(minp, maxp)
20 if maxp.y >= bedrock.layer and minp.y <= bedrock.layer then
21 local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
22 local data = vm:get_data()
23 local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
24 local c_bedrock = minetest.get_content_id("bedrock2:bedrock")
26 for x = minp.x, maxp.x do
27 for z = minp.z, maxp.z do
28 local p_pos = area:index(x, bedrock.layer, z)
29 data[p_pos] = c_bedrock
30 end
31 end
33 vm:set_data(data)
34 vm:calc_lighting()
35 vm:update_liquids()
36 vm:write_to_map()
37 end
38 end)
40 minetest.register_node("bedrock2:bedrock", {
41 description = S("Bedrock"),
42 x_doc_items_longdesc = S("Bedrock is a very hard block. It cannot be mined, altered, destroyed or moved by any means. It appears at the bottom of the world in a flat layer."),
43 tiles = {"bedrock2_bedrock.png"},
44 groups = {immortal=1, not_in_creative_inventory=1, in_doc = 1 },
45 sounds = { footstep = { name = "bedrock2_step", gain = 1 } },
46 is_ground_content = false,
47 on_blast = function() end,
48 on_destruct = function () end,
49 can_dig = function() return false end,
50 diggable = false,
51 drop = "",
54 if minetest.get_modpath("mesecons_mvps") ~= nil then
55 mesecon:register_mvps_stopper("bedrock2:bedrock")
56 end