diff --git a/mods/bedrock/COPYING b/mods/bedrock/COPYING new file mode 100644 index 00000000..5a8e3325 --- /dev/null +++ b/mods/bedrock/COPYING @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/mods/bedrock/LICENSE.txt b/mods/bedrock/LICENSE.txt deleted file mode 100755 index 726257de..00000000 --- a/mods/bedrock/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -+---- zlib/libpng license ----+ - -Copyright (c) 2013-2014 Calinou and contributors - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. diff --git a/mods/bedrock/README.txt b/mods/bedrock/README.txt new file mode 100644 index 00000000..6b108627 --- /dev/null +++ b/mods/bedrock/README.txt @@ -0,0 +1,10 @@ +Bedrock mod. + +Version 0.2.0 + +This mod adds an indestructible bedrock layer at the bottom of the world. + + +This mod recognizes the following minetest.conf setting: + +* `bedrock2_y`: Sets the Y coordinate on which the bedrock layer will be created (default: -30912). diff --git a/mods/bedrock/depends.txt b/mods/bedrock/depends.txt index 4ad96d51..59619ab3 100755 --- a/mods/bedrock/depends.txt +++ b/mods/bedrock/depends.txt @@ -1 +1 @@ -default +mesecons_mvps? diff --git a/mods/bedrock/description.txt b/mods/bedrock/description.txt new file mode 100644 index 00000000..0de789f6 --- /dev/null +++ b/mods/bedrock/description.txt @@ -0,0 +1 @@ +Adds an indestructable bedrock layer at the bottom of the world. diff --git a/mods/bedrock/init.lua b/mods/bedrock/init.lua index e4a5a189..3d098465 100755 --- a/mods/bedrock/init.lua +++ b/mods/bedrock/init.lua @@ -1,41 +1,47 @@ -minetest.register_ore({ - ore_type = "scatter", - ore = "bedrock:bedrock", - wherein = "default:stone", - clust_scarcity = 1 * 1 * 1, - clust_num_ores = 5, - clust_size = 2, - height_min = -30912, -- Engine changes can modify this value. - height_max = -30656, -- This ensures the bottom of the world is not even loaded. -}) +local bedrock = {} -minetest.register_ore({ - ore_type = "scatter", - ore = "bedrock:deepstone", - wherein = "default:stone", - clust_scarcity = 1 * 1 * 1, - clust_num_ores = 5, - clust_size = 2, - height_min = -30656, - height_max = -30000, -}) +bedrock.layer = -30912 -- determined as appropriate by experiment +bedrock.node = {name = "bedrock:bedrock"} + +local depth = tonumber(minetest.setting_get("bedrock_y")) +if depth ~= nil then + bedrock.layer = depth +end + +minetest.register_on_generated(function(minp, maxp) + if maxp.y >= bedrock.layer and minp.y <= bedrock.layer then + local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") + local data = vm:get_data() + local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax}) + local c_bedrock = minetest.get_content_id("bedrock:bedrock") + + for x = minp.x, maxp.x do + for z = minp.z, maxp.z do + local p_pos = area:index(x, bedrock.layer, z) + data[p_pos] = c_bedrock + end + end + + vm:set_data(data) + vm:calc_lighting() + vm:update_liquids() + vm:write_to_map() + end +end) minetest.register_node("bedrock:bedrock", { description = "Bedrock", - tile_images = {"bedrock_bedrock.png"}, + tiles = {"bedrock_bedrock.png"}, + groups = {immortal=1, not_in_creative_inventory=1, unbreakable = 1}, + sounds = { footstep = { name = "bedrock_step", gain = 1 } }, + is_ground_content = false, + on_blast = function() end, + on_destruct = function () end, + can_dig = function() return false end, + diggable = false, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = 1}, -- For Map Tools' admin pickaxe. - sounds = default.node_sound_stone_defaults(), }) -minetest.register_node("bedrock:deepstone", { - description = "Deepstone", - tile_images = {"bedrock_deepstone.png"}, - drop = "default:stone", -- Intended. - groups = {cracky = 1}, - sounds = default.node_sound_stone_defaults(), -}) - -if minetest.setting_getbool("log_mods") then - minetest.log("action", "Carbone: [bedrock] loaded.") +if minetest.get_modpath("mesecons_mvps") ~= nil then + mesecon:register_mvps_stopper("bedrock2:bedrock") end diff --git a/mods/bedrock/sounds/bedrock_step.1.ogg b/mods/bedrock/sounds/bedrock_step.1.ogg new file mode 100644 index 00000000..63f364df Binary files /dev/null and b/mods/bedrock/sounds/bedrock_step.1.ogg differ diff --git a/mods/bedrock/sounds/bedrock_step.2.ogg b/mods/bedrock/sounds/bedrock_step.2.ogg new file mode 100644 index 00000000..cb3b91c7 Binary files /dev/null and b/mods/bedrock/sounds/bedrock_step.2.ogg differ diff --git a/mods/bedrock/sounds/bedrock_step.3.ogg b/mods/bedrock/sounds/bedrock_step.3.ogg new file mode 100644 index 00000000..2f97002f Binary files /dev/null and b/mods/bedrock/sounds/bedrock_step.3.ogg differ diff --git a/mods/bedrock/textures/bedrock_deepstone.png b/mods/bedrock/textures/bedrock_deepstone.png deleted file mode 100755 index f2e1e3b2..00000000 Binary files a/mods/bedrock/textures/bedrock_deepstone.png and /dev/null differ