diff --git a/minetestforfun_game/mods/default/README.txt b/minetestforfun_game/mods/default/README.txt index 9a7e1930..5e726eeb 100755 --- a/minetestforfun_game/mods/default/README.txt +++ b/minetestforfun_game/mods/default/README.txt @@ -62,7 +62,6 @@ VanessaE (WTFPL): default_desert_stone.png default_desert_stone_brick.png default_sand.png - default_sandstone_brick.png Calinou (CC BY-SA): default_brick.png @@ -109,6 +108,11 @@ paramat (CC BY-SA 3.0): default_pinetree.png default_pinetree_top.png default_pinewood.png + default_sandstone_brick.png + default_obsidian_brick.png + default_river_water.png + default_river_water_source_animated.png + default_river_water_flowing_animated.png brunob.santos (CC BY-SA 4.0): default_desert_cobble.png diff --git a/minetestforfun_game/mods/default/craftitems.lua b/minetestforfun_game/mods/default/craftitems.lua index 29de90a5..06505393 100755 --- a/minetestforfun_game/mods/default/craftitems.lua +++ b/minetestforfun_game/mods/default/craftitems.lua @@ -14,16 +14,87 @@ minetest.register_craftitem("default:paper", { inventory_image = "default_paper.png", }) +local function book_on_use(itemstack, user, pointed_thing) + local player_name = user:get_player_name() + local data = minetest.deserialize(itemstack:get_metadata()) + local title, text, owner = "", "", player_name + if data then + title, text, owner = data.title, data.text, data.owner + end + local formspec + if owner == player_name then + formspec = "size[8,8]"..default.gui_bg.. + "field[0.5,1;7.5,0;title;Title:;".. + minetest.formspec_escape(title).."]".. + "textarea[0.5,1.5;7.5,7;text;Contents:;".. + minetest.formspec_escape(text).."]".. + "button_exit[2.5,7.5;3,1;save;Save]" + else + formspec = "size[8,8]"..default.gui_bg.. + "label[0.5,0.5;by "..owner.."]".. + "label[0.5,0;"..minetest.formspec_escape(title).."]".. + "textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]" + end + minetest.show_formspec(user:get_player_name(), "default:book", formspec) +end + +minetest.register_on_player_receive_fields(function(player, form_name, fields) + if form_name ~= "default:book" or not fields.save or + fields.title == "" or fields.text == "" then + return + end + local inv = player:get_inventory() + local stack = player:get_wielded_item() + local new_stack, data + if stack:get_name() ~= "default:book_written" then + local count = stack:get_count() + if count == 1 then + stack:set_name("default:book_written") + else + stack:set_count(count - 1) + new_stack = ItemStack("default:book_written") + end + else + data = minetest.deserialize(stack:get_metadata()) + end + if not data then data = {} end + data.title = fields.title + data.text = fields.text + data.owner = player:get_player_name() + local data_str = minetest.serialize(data) + if new_stack then + new_stack:set_metadata(data_str) + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(player:getpos(), new_stack) + end + else + stack:set_metadata(data_str) + end + player:set_wielded_item(stack) +end) + minetest.register_craftitem("default:book", { description = "Book", inventory_image = "default_book.png", groups = {book=1}, + on_use = book_on_use, +}) + +minetest.register_craftitem("default:book_written", { + description = "Book With Text", + inventory_image = "default_book.png", + groups = {book=1, not_in_creative_inventory=1}, + stack_max = 1, + on_use = book_on_use, }) minetest.register_craftitem("default:coal_lump", { description = "Coal Lump", wield_scale = {x = 1, y = 1, z = 2}, inventory_image = "default_coal_lump.png", + groups = {coal = 1} }) minetest.register_craftitem("default:iron_lump", { diff --git a/minetestforfun_game/mods/default/functions.lua b/minetestforfun_game/mods/default/functions.lua index 51ca6bfd..d14ef471 100755 --- a/minetestforfun_game/mods/default/functions.lua +++ b/minetestforfun_game/mods/default/functions.lua @@ -129,33 +129,9 @@ function default.node_sound_glass_defaults(table) return table end --- --- Global callbacks --- - --- Global environment step function -function on_step(dtime) - -- print("on_step, " .. p .. ", " .. node) -end -minetest.register_globalstep(on_step) - -function on_placenode(p, node) - -- print("on_placenode, " .. p .. ", " .. node) -end -minetest.register_on_placenode(on_placenode) - -function on_dignode(p, node) - -- print("on_dignode, " .. p .. ", " .. node) -end -minetest.register_on_dignode(on_dignode) - -function on_punchnode(p, node) - -- print("on_punchnode, " .. p .. ", " .. node) -end -minetest.register_on_punchnode(on_punchnode) -- --- Lava cooling +-- Lavacooling -- local function cool_wf_vm(pos, node1, node2) @@ -245,51 +221,50 @@ minetest.register_abm({ -- Papyrus and cactus growing -- +-- wrapping the functions in abm action is necessary to make overriding them possible + function default.grow_cactus(pos, node) if node.param2 ~= 0 then return end - pos.y = pos.y-1 + pos.y = pos.y - 1 if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then return end - pos.y = pos.y+1 + pos.y = pos.y + 1 local height = 0 - while node.name == "default:cactus" and height < 4 and node.param2 == 0 do - height = height+1 - pos.y = pos.y+1 + while node.name == "default:cactus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 node = minetest.get_node(pos) end - if height == 4 - or node.name ~= "air" then + if height == 4 or node.name ~= "air" then return end - minetest.set_node(pos, {name="default:cactus"}) + minetest.set_node(pos, {name = "default:cactus"}) return true end function default.grow_papyrus(pos, node) - pos.y = pos.y-1 + pos.y = pos.y - 1 local name = minetest.get_node(pos).name - if name ~= "default:dirt_with_grass" - and name ~= "default:dirt" then + if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then return end if not minetest.find_node_near(pos, 3, {"group:water"}) then return end - pos.y = pos.y+1 + pos.y = pos.y + 1 local height = 0 while node.name == "default:papyrus" and height < 4 do - height = height+1 - pos.y = pos.y+1 + height = height + 1 + pos.y = pos.y + 1 node = minetest.get_node(pos) end - if height == 4 - or node.name ~= "air" then + if height == 4 or node.name ~= "air" then return end - minetest.set_node(pos, {name="default:papyrus"}) + minetest.set_node(pos, {name = "default:papyrus"}) return true end @@ -300,7 +275,7 @@ minetest.register_abm({ chance = 25, action = function(...) default.grow_cactus(...) - end, + end }) minetest.register_abm({ @@ -310,9 +285,14 @@ minetest.register_abm({ chance = 25, action = function(...) default.grow_papyrus(...) - end, + end }) + +-- +-- dig upwards +-- + function default.dig_up(pos, node, digger) if digger == nil then return end local np = {x = pos.x, y = pos.y + 1, z = pos.z} @@ -327,19 +307,6 @@ end -- Leafdecay -- --- To enable leaf decay for a node, add it to the "leafdecay" group. --- --- The rating of the group determines how far from a node in the group "tree" --- the node can be without decaying. --- --- If param2 of the node is ~= 0, the node will always be preserved. Thus, if --- the player places a node of that kind, you will want to set param2= 1 or so. --- --- If the node is in the leafdecay_drop group then the it will always be dropped --- as an item - -if minetest.setting_getbool("leaf_decay") ~= false then -- “If not defined or set to true then” - default.leafdecay_trunk_cache = {} default.leafdecay_enable_cache = true -- Spread the load of finding trunks @@ -360,20 +327,21 @@ end minetest.register_abm({ nodenames = {"group:leafdecay"}, neighbors = {"air", "group:liquid"}, - interval = 1, -- A low interval and a high inverse chance spreads the load. + -- A low interval and a high inverse chance spreads the load + interval = 1, chance = 2, action = function(p0, node, _, _) - -- print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") + --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") local do_preserve = false local d = minetest.registered_nodes[node.name].groups.leafdecay if not d or d == 0 then - -- print("not groups.leafdecay") + --print("not groups.leafdecay") return end local n0 = minetest.get_node(p0) if n0.param2 ~= 0 then - -- print("param2 ~= 0") + --print("param2 ~= 0") return end local p0_hash = nil @@ -383,13 +351,15 @@ minetest.register_abm({ if trunkp then local n = minetest.get_node(trunkp) local reg = minetest.registered_nodes[n.name] - -- Assume ignore is a trunk, to make the thing work at the border of the active area: - if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then - -- print("Cached trunk still exists.") + -- Assume ignore is a trunk, to make the thing + -- work at the border of the active area + if n.name == "ignore" or (reg and reg.groups.tree and + reg.groups.tree ~= 0) then + --print("cached trunk still exists") return end - -- print("Cached trunk is invalid.") - -- Cache is invalid: + --print("cached trunk is invalid") + -- Cache is invalid table.remove(default.leafdecay_trunk_cache, p0_hash) end end @@ -398,33 +368,38 @@ minetest.register_abm({ end default.leafdecay_trunk_find_allow_accumulator = default.leafdecay_trunk_find_allow_accumulator - 1 - -- Assume ignore is a trunk, to make the thing work at the border of the active area: + -- Assume ignore is a trunk, to make the thing + -- work at the border of the active area local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"}) if p1 then do_preserve = true if default.leafdecay_enable_cache then - -- print("Caching trunk.") - -- Cache the trunk: + --print("caching trunk") + -- Cache the trunk default.leafdecay_trunk_cache[p0_hash] = p1 end end if not do_preserve then - -- Drop stuff other than the node itself: + -- Drop stuff other than the node itself local itemstacks = minetest.get_node_drops(n0.name) for _, itemname in ipairs(itemstacks) do - if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 - or itemname ~= n0.name then - minetest.add_item(p0, itemname) + if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or + itemname ~= n0.name then + local p_drop = { + x = p0.x - 0.5 + math.random(), + y = p0.y - 0.5 + math.random(), + z = p0.z - 0.5 + math.random(), + } + minetest.add_item(p_drop, itemname) end end + -- Remove node minetest.remove_node(p0) - -- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".") nodeupdate(p0) end end }) -end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then @@ -435,6 +410,9 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack minetest.add_item(pos, "default:torch") end) +-- +-- Grass growing +-- minetest.register_abm({ nodenames = {"default:dirt"}, @@ -444,10 +422,10 @@ minetest.register_abm({ local above = {x = pos.x, y = pos.y + 1, z = pos.z} local name = minetest.get_node(above).name local nodedef = minetest.registered_nodes[name] - if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") - and nodedef.liquidtype == "none" - and pos.y >= 0 - and (minetest.get_node_light(above) or 0) >= 12 then + if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and + nodedef.liquidtype == "none" and + pos.y >= 0 and + (minetest.get_node_light(above) or 0) >= 12 then if name == "default:snow" or name == "default:snowblock" then minetest.set_node(pos, {name = "default:dirt_with_snow"}) else @@ -457,7 +435,6 @@ minetest.register_abm({ end }) - minetest.register_abm({ nodenames = {"default:dirt_with_grass"}, interval = 30, @@ -466,10 +443,11 @@ minetest.register_abm({ local above = {x = pos.x, y = pos.y + 1, z = pos.z} local name = minetest.get_node(above).name local nodedef = minetest.registered_nodes[name] - if name ~= "ignore" and nodedef - and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") - and nodedef.liquidtype == "none") then + if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or + nodedef.paramtype == "light") and + nodedef.liquidtype == "none") then minetest.set_node(pos, {name = "default:dirt"}) end end -}) \ No newline at end of file +}) + diff --git a/minetestforfun_game/mods/default/furnace.lua b/minetestforfun_game/mods/default/furnace.lua index 37459b81..6a5105e8 100755 --- a/minetestforfun_game/mods/default/furnace.lua +++ b/minetestforfun_game/mods/default/furnace.lua @@ -6,6 +6,8 @@ local function active_formspec(fuel_percent, item_percent) local formspec = "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. default.gui_slots.. "list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]".. @@ -22,6 +24,8 @@ end local inactive_formspec = "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. default.gui_slots.. "list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]".. diff --git a/minetestforfun_game/mods/default/init.lua b/minetestforfun_game/mods/default/init.lua index 40076e4a..69e74061 100755 --- a/minetestforfun_game/mods/default/init.lua +++ b/minetestforfun_game/mods/default/init.lua @@ -24,8 +24,11 @@ function default.get_hotbar_bg(x,y) end default.gui_survival_form = "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. default.gui_slots.. - "list[current_player;main;0,4.25;8,4;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. "list[current_player;craft;1.75,0.5;3,3;]".. "list[current_player;craftpreview;5.75,1.5;1,1;]".. default.get_hotbar_bg(0,4.25).. diff --git a/minetestforfun_game/mods/default/mapgen.lua b/minetestforfun_game/mods/default/mapgen.lua index 3554678e..723d2727 100755 --- a/minetestforfun_game/mods/default/mapgen.lua +++ b/minetestforfun_game/mods/default/mapgen.lua @@ -13,6 +13,12 @@ minetest.register_alias("mapgen_lava_source", "default:lava_source") minetest.register_alias("mapgen_gravel", "default:gravel") minetest.register_alias("mapgen_desert_stone", "default:desert_stone") minetest.register_alias("mapgen_desert_sand", "default:desert_sand") +minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow") +minetest.register_alias("mapgen_snowblock", "default:snowblock") +minetest.register_alias("mapgen_snow", "default:snow") +minetest.register_alias("mapgen_ice", "default:ice") +minetest.register_alias("mapgen_sandstone", "default:sandstone") + minetest.register_alias("mapgen_tree", "default:tree") minetest.register_alias("mapgen_leaves", "default:leaves") minetest.register_alias("mapgen_apple", "default:apple") @@ -21,6 +27,7 @@ minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves") minetest.register_alias("mapgen_junglegrass", "default:junglegrass") minetest.register_alias("mapgen_pinetree", "default:pinetree") minetest.register_alias("mapgen_pine_needles", "default:pine_needles") + minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron") minetest.register_alias("mapgen_mese", "default:mese") minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal") @@ -28,967 +35,37 @@ minetest.register_alias("mapgen_clay", "default:clay") minetest.register_alias("mapgen_cobble", "default:cobble") minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") minetest.register_alias("mapgen_mossycobble", "default:mossycobble") +minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") +minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick") -- --- Ore generation +-- Register ores -- + +-- Blob ore first to avoid other ores inside blobs + function default.register_ores() minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_coal", - wherein = "default:stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 8, - clust_size = 3, - height_min = -30000, - height_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:desert_stone_with_coal", - wherein = "default:desert_stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 10, - clust_size = 3, - height_min = 0, - height_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_coal", - wherein = "default:stone", - clust_scarcity = 24 * 24 * 24, - clust_num_ores = 27, - clust_size = 6, - height_min = -30000, - height_max = 0, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 11 * 11 * 11, - clust_num_ores = 3, - clust_size = 2, - height_min = -15, - height_max = 2, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 10 * 10 * 10, - clust_num_ores = 5, - clust_size = 3, - height_min = -63, - height_max = -16, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 5, - clust_size = 3, - height_min = -30000, - height_max = -64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 25 * 25 * 25, - clust_num_ores = 27, - clust_size = 6, - height_min = -30000, - height_max = -64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_mese", - wherein = "default:stone", - clust_scarcity = 18 * 18 * 18, - clust_num_ores = 3, - clust_size = 2, - height_min = -255, - height_max = -128, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_mese", - wherein = "default:stone", - clust_scarcity = 14 * 14 * 14, - clust_num_ores = 5, - clust_size = 3, - height_min = -1024, - height_max = -256, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:mese", - wherein = "default:stone", - clust_scarcity = 20 * 20 * 20, - clust_num_ores = 3, - clust_size = 2, - height_min = -30000, - height_max = -1024, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:mese", - wherein = "default:stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 3, - clust_size = 2, - height_min = -1024, - height_max = 64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:meze", - wherein = "default:stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 3, - clust_size = 2, - height_min = 0, - height_max = 64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:mese", - wherein = "default:desert_stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 3, - clust_size = 2, - height_min = -1024, - height_max = 64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:meze", - wherein = "default:desert_stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 3, - clust_size = 2, - height_min = 0, - height_max = 64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "maptools:superapple", - wherein = "default:apple", - clust_scarcity = 6 * 6 * 6, - clust_num_ores = 5, - clust_size = 2, - height_min = 0, - height_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "maptools:superapple", - wherein = "default:jungleleaves", - clust_scarcity = 16 * 16 * 16, - clust_num_ores = 5, - clust_size = 2, - height_min = 0, - height_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_coin", - wherein = "default:stone", - clust_scarcity = 26 * 26 * 26, - clust_num_ores = 1, - clust_size = 1, - height_min = -30000, - height_max = 0, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_gold", - wherein = "default:stone", - clust_scarcity = 15 * 15 * 15, - clust_num_ores = 3, - clust_size = 2, - height_min = -255, - height_max = -64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_gold", - wherein = "default:stone", - clust_scarcity = 13 * 13 * 13, - clust_num_ores = 5, - clust_size = 3, - height_min = -30000, - height_max = -256, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_diamond", - wherein = "default:stone", - clust_scarcity = 17 * 17 * 17, - clust_num_ores = 4, - clust_size = 3, - height_min = -512, - height_max = -256, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_diamond", - wherein = "default:stone", - clust_scarcity = 15 * 15 * 15, - clust_num_ores = 4, - clust_size = 3, - height_min = -30000, - height_max = -512, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_copper", - wherein = "default:stone", - clust_scarcity = 12 * 12 * 12, - clust_num_ores = 4, - clust_size = 3, - height_min = -63, - height_max = -16, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:desert_stone_with_copper", - wherein = "default:desert_stone", - clust_scarcity = 11 * 11 * 11, - clust_num_ores = 6, - clust_size = 3, - height_min = 0, - height_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_copper", - wherein = "default:stone", - clust_scarcity = 10 * 10 * 10, - clust_num_ores = 5, - clust_size = 3, - height_min = -30000, - height_max = -64, - flags = "absheight", - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_coal", - wherein = "default:stone", - clust_scarcity = 32 * 32 * 32, - clust_num_ores = 40, - clust_size = 4, - height_max = 64, - height_min = -30000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 48 * 48 * 48, - clust_num_ores = 40, - clust_size = 4, - height_max = 64, - height_min = -30000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_diamond", - wherein = "default:stone", - clust_scarcity = 30 * 30 * 30, - clust_num_ores = 64, - clust_size = 5, - height_max = -1024, - height_min = -30000, - }) - - if minetest.setting_get("mg_name") == "indev" then - -- Floatlands and high mountains springs: - minetest.register_ore({ - ore_type = "scatter", - ore = "default:water_source", - ore_param2 = 128, - wherein = "default:stone", - clust_scarcity = 40 *40 *40, - clust_num_ores = 8, - clust_size = 3, - height_min = 100, - height_max = 30000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:lava_source", - ore_param2 = 128, - wherein = "default:stone", - clust_scarcity = 50 * 50 * 50, - clust_num_ores = 5, - clust_size = 2, - height_min = 10000, - height_max = 30000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:sand", - wherein = "default:stone", - clust_scarcity = 20 * 20 * 20, - clust_num_ores = 5 * 5 * 3, - clust_size = 5, - height_min = 500, - height_max = 30000, - }) - end - - -- Underground springs: - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:water_source", - ore_param2 = 128, - wherein = "default:stone", - clust_scarcity = 20 * 20 * 20, - clust_num_ores = 10, - clust_size = 4, - height_min = -10000, - height_max = -10, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:lava_source", - ore_param2 = 128, - wherein = "default:stone", - clust_scarcity = 32 * 32 * 32, - clust_num_ores = 5, - clust_size = 2, - height_min = -30000, - height_max = -100, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:dirt", - wherein = "default:stone", - clust_scarcity = 16 * 16 * 16, - clust_num_ores = 64, - clust_size = 5, - height_max = 64, - height_min = -4096, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:gravel", - wherein = "default:stone", - clust_scarcity = 16 * 16 * 16, - clust_num_ores = 64, - clust_size = 5, - height_max = 64, - height_min = -30000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:sand", - wherein = "default:stone", - clust_scarcity = 24 * 24 * 24, - clust_num_ores = 32, - clust_size = 4, - height_max = 64, - height_min = -1024, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:clay", - wherein = "default:stone", - clust_scarcity = 32 * 32 * 32, - clust_num_ores = 32, - clust_size = 4, - height_max = 64, - height_min = -1024, - }) - - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:cobble", - wherein = "default:stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 512, - clust_size = 9, - height_max = 64, - height_min = -4096, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:desert_cobble", - wherein = "default:desert_stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 512, - clust_size = 9, - height_max = 64, - height_min = 0, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:clay", - wherein = "default:sand", - clust_scarcity = 14 * 14 * 14, - clust_num_ores = 64, - clust_size = 5, - height_max = 4, - height_min = -8, - }) - - -- Air rooms in dirt: - - minetest.register_ore({ - ore_type = "scatter", - ore = "air", - wherein = "default:dirt", - clust_scarcity = 24 * 24 * 24, - clust_num_ores = 200, - clust_size = 7, - height_min = -30000, - height_max = 64, - }) - - -- Acid lakes in gravel: - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:acid_source", - wherein = "default:gravel", - clust_scarcity = 20 * 20 * 20, - clust_num_ores = 64, - clust_size = 5, - height_min = -30000, - height_max = 64, - }) - -end - -function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) - minetest.log("action", "WARNING: default.generate_ore is deprecated") - - if maxp.y < height_min or minp.y > height_max then - return - end - local y_min = math.max(minp.y, height_min) - local y_max = math.min(maxp.y, height_max) - if chunk_size >= y_max - y_min + 1 then - return - end - local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) - local pr = PseudoRandom(seed) - local num_chunks = math.floor(chunks_per_volume * volume) - local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) - --print("generate_ore num_chunks: "..dump(num_chunks)) - for i= 1, num_chunks do - local y0 = pr:next(y_min, y_max-chunk_size+1) - if y0 >= height_min and y0 <= height_max then - local x0 = pr:next(minp.x, maxp.x-chunk_size+1) - local z0 = pr:next(minp.z, maxp.z-chunk_size+1) - local p0 = {x=x0, y =y0, z=z0} - for x1= 0,chunk_size - 1 do - for y1= 0,chunk_size - 1 do - for z1= 0,chunk_size - 1 do - if pr:next(1,inverse_chance) == 1 then - local x2 = x0+x1 - local y2 = y0+y1 - local z2 = z0+z1 - local p2 = {x=x2, y =y2, z=z2} - if minetest.get_node(p2).name == wherein then - minetest.set_node(p2, {name = name}) - end - end - end - end - end - end - end - --print("generate_ore done") -end - -function default.make_papyrus(pos, size) - for y = 0, size - 1 do - local p = {x= pos.x, y = pos.y + y, z= pos.z} - local nn = minetest.get_node(p).name - if minetest.registered_nodes[nn] and - minetest.registered_nodes[nn].buildable_to then - minetest.set_node(p, {name = "default:papyrus"}) - else - return - end - end -end - -function default.make_cactus(pos, size) - for y = 0, size-1 do - local p = {x= pos.x, y = pos.y + y, z= pos.z} - local nn = minetest.get_node(p).name - if minetest.registered_nodes[nn] and - minetest.registered_nodes[nn].buildable_to then - minetest.set_node(p, {name = "default:cactus"}) - else - return - end - end -end - --- facedir: 0/1/2/3 (head node facedir value) --- length: length of rainbow tail -function default.make_nyancat(pos, facedir, length) - local tailvec = {x= 0, y = 0, z= 0} - if facedir == 0 then - tailvec.z = 1 - elseif facedir == 1 then - tailvec.x = 1 - elseif facedir == 2 then - tailvec.z = -1 - elseif facedir == 3 then - tailvec.x = -1 - else - --print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) - facedir = 0 - tailvec.z = 1 - end - local p = {x= pos.x, y = pos.y, z= pos.z} - minetest.set_node(p, {name = "default:nyancat", param2 = facedir}) - -- minetest.log("action", "Generated a nyan cat at " .. minetest.pos_to_string(p) .. ".") - for i= 1,length do - p.x = p.x + tailvec.x - p.z = p.z + tailvec.z - minetest.set_node(p, {name = "default:nyancat_rainbow", param2 = facedir}) - end -end - -function generate_nyancats(seed, minp, maxp) - local height_min = -30000 - local height_max = 30000 - if maxp.y < height_min or minp.y > height_max then - return - end - local y_min = math.max(minp.y, height_min) - local y_max = math.min(maxp.y, height_max) - local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) - local pr = PseudoRandom(seed + 9324342) - local max_num_nyancats = math.floor(volume / (15 * 15 * 15)) - for i= 1,max_num_nyancats do - if pr:next(0, 1000) == 0 then - local x0 = pr:next(minp.x, maxp.x) - local y0 = pr:next(minp.y, maxp.y) - local z0 = pr:next(minp.z, maxp.z) - local p0 = {x=x0, y =y0, z=z0} - default.make_nyancat(p0, pr:next(0,3), 10) - end - end -end - -minetest.register_on_generated(function(minp, maxp, seed) - if maxp.y >= 2 and minp.y <= 0 then - -- Generate papyrus - local perlin1 = minetest.get_perlin(354, 3, 0.7, 100) - -- Assume X and Z lengths are equal - local divlen = 8 - local divs = (maxp.x-minp.x)/divlen+1; - for divx= 0, divs-1 do - for divz= 0, divs-1 do - local x0 = minp.x + math.floor((divx+0)*divlen) - local z0 = minp.z + math.floor((divz+0)*divlen) - local x1 = minp.x + math.floor((divx+1)*divlen) - local z1 = minp.z + math.floor((divz+1)*divlen) - -- Determine papyrus amount from perlin noise - local papyrus_amount = math.floor(perlin1:get2d({x=x0, y =z0}) * 45 - 20) - -- Find random positions for papyrus based on this random - local pr = PseudoRandom(seed+1) - for i= 0,papyrus_amount do - local x = pr:next(x0, x1) - local z = pr:next(z0, z1) - if minetest.get_node({x=x,y = 1,z=z}).name == "default:dirt_with_grass" and - minetest.find_node_near({x=x,y = 1,z=z}, 1, "default:water_source") then - default.make_papyrus({x=x,y = 2,z=z}, 4) - end - end - end - end - -- Generate cactuses - local perlin1 = minetest.get_perlin(230, 3, 0.6, 100) - -- Assume X and Z lengths are equal - local divlen = 16 - local divs = (maxp.x-minp.x)/divlen+1; - for divx= 0, divs-1 do - for divz= 0, divs-1 do - local x0 = minp.x + math.floor((divx+0)*divlen) - local z0 = minp.z + math.floor((divz+0)*divlen) - local x1 = minp.x + math.floor((divx+1)*divlen) - local z1 = minp.z + math.floor((divz+1)*divlen) - -- Determine cactus amount from perlin noise - local cactus_amount = math.floor(perlin1:get2d({x=x0, y =z0}) * 6 - 3) - -- Find random positions for cactus based on this random - local pr = PseudoRandom(seed+1) - for i= 0,cactus_amount do - local x = pr:next(x0, x1) - local z = pr:next(z0, z1) - -- Find ground level (0...15) - local ground_y = nil - for y = 30,0,-1 do - if minetest.get_node({x=x,y =y,z=z}).name ~= "air" then - ground_y = y - break - end - end - -- If desert sand, make cactus - if ground_y and minetest.get_node({x = x, y = ground_y, z = z}).name == "default:desert_sand" then - default.make_cactus({x=x,y =ground_y+1,z=z}, 4) - end - end - end - end - -- Generate grass - local perlin1 = minetest.get_perlin(329, 3, 0.6, 100) - -- Assume X and Z lengths are equal - local divlen = 16 - local divs = (maxp.x-minp.x)/divlen+1; - for divx= 0, divs-1 do - for divz= 0, divs-1 do - local x0 = minp.x + math.floor((divx+0)*divlen) - local z0 = minp.z + math.floor((divz+0)*divlen) - local x1 = minp.x + math.floor((divx+1)*divlen) - local z1 = minp.z + math.floor((divz+1)*divlen) - -- Determine grass amount from perlin noise - local grass_amount = math.floor(perlin1:get2d({x=x0, y =z0}) ^ 3 * 9) - -- Find random positions for grass based on this random - local pr = PseudoRandom(seed+1) - for i= 0,grass_amount do - local x = pr:next(x0, x1) - local z = pr:next(z0, z1) - -- Find ground level (0...15) - local ground_y = nil - for y = 30,0,-1 do - if minetest.get_node({x=x,y =y,z=z}).name ~= "air" then - ground_y = y - break - end - end - - if ground_y then - local p = {x=x,y =ground_y+1,z=z} - local nn = minetest.get_node(p).name - -- Check if the node can be replaced - if minetest.registered_nodes[nn] and - minetest.registered_nodes[nn].buildable_to then - nn = minetest.get_node({x=x,y =ground_y,z=z}).name - -- If desert sand, add dry shrub - if nn == "default:desert_sand" then - minetest.set_node(p,{name = "default:dry_shrub"}) - - -- If dirt with grass, add grass - elseif nn == "default:dirt_with_grass" then - minetest.set_node(p,{name = "default:grass_" .. pr:next(1, 5)}) - end - end - end - - end - end - end - end - - -- Generate nyan cats - generate_nyancats(seed, minp, maxp) -end) - --- --- Register biomes --- - -function default.register_biomes() - minetest.clear_registered_biomes() - - minetest.register_biome({ - name = "grassland", - node_top = "default:dirt_with_grass", - node_shore_top = "default:sand", - depth_top = 1, - node_filler = "default:dirt", - node_shore_filler = "default:sand", - depth_filler = 2, - height_shore = 3, - node_underwater = "default:sand", - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_dust = "", - y_min = -31000, - y_max = 31000, - heat_point = 50, - humidity_point = 50, - }) - - -- - -- Register decorations - -- - - -- Flowers - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 436, - octaves = 3, - persist = 0.6 + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 24*24*24, + clust_size = 7, + y_min = -15, + y_max = 0, + noise_threshhold = 0, + noise_params = { + offset=0.35, + scale=0.2, + spread={x=5, y=5, z=5}, + seed=-316, + octaves=1, + persist=0.5 }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:rose", }) - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 19822, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:tulip", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 1220999, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:dandelion_yellow", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 36662, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:geranium", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 1133, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:viola", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.03, - spread = {x=100, y=100, z=100}, - seed = 73133, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "flowers:dandelion_white", - }) - - -- Grasses - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = 0.04, - scale = 0.08, - spread = {x=100, y=100, z=100}, - seed = 66440, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "default:grass_1", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = 0.02, - scale = 0.08, - spread = {x=100, y=100, z=100}, - seed = 66440, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "default:grass_2", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = 0.08, - spread = {x=100, y=100, z=100}, - seed = 66440, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "default:grass_3", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.02, - scale = 0.08, - spread = {x=100, y=100, z=100}, - seed = 66440, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "default:grass_4", - }) - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = -0.04, - scale = 0.08, - spread = {x=100, y=100, z=100}, - seed = 66440, - octaves = 3, - persist = 0.6 - }, - biomes = {"grassland"}, - y_min = -31000, - y_max = 31000, - decoration = "default:grass_5", - }) -end - --- --- Register blob ore --- - -function default.register_blobs() minetest.register_ore({ ore_type = "blob", ore = "default:sand", @@ -1045,23 +122,898 @@ function default.register_blobs() persist=0.5 }, }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 9*9*9, + clust_num_ores = 8, + clust_size = 3, + y_min = -30000, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:desert_stone_with_coal", + wherein = "default:desert_stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 10, + clust_size = 3, + y_min = 0, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 24*24*24, + clust_num_ores = 27, + clust_size = 6, + y_min = -30000, + y_max = 0, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 11*11*11, + clust_num_ores = 3, + clust_size = 2, + y_min = -15, + y_max = 2, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 10*10*10, + clust_num_ores = 5, + clust_size = 3, + y_min = -63, + y_max = -16, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 9*9*9, + clust_num_ores = 5, + clust_size = 3, + y_min = -30000, + y_max = -64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 25*25*25, + clust_num_ores = 27, + clust_size = 6, + y_min = -30000, + y_max = -64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 18*18*18, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -128, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14*14*14, + clust_num_ores = 5, + clust_size = 3, + y_min = -1024, + y_max = -256, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 20*20*20, + clust_num_ores = 3, + clust_size = 2, + y_min = -30000, + y_max = -1024, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 3, + clust_size = 2, + y_min = -1024, + y_max = 64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:meze", + wherein = "default:stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 3, + clust_size = 2, + y_min = 0, + y_max = 64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:desert_stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 3, + clust_size = 2, + y_min = -1024, + y_max = 64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:meze", + wherein = "default:desert_stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 3, + clust_size = 2, + y_min = 0, + y_max = 64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "maptools:superapple", + wherein = "default:apple", + clust_scarcity = 6 * 6 * 6, + clust_num_ores = 5, + clust_size = 2, + y_min = 0, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "maptools:superapple", + wherein = "default:jungleleaves", + clust_scarcity = 16 * 16 * 16, + clust_num_ores = 5, + clust_size = 2, + y_min = 0, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coin", + wherein = "default:stone", + clust_scarcity = 26 * 26 * 26, + clust_num_ores = 1, + clust_size = 1, + y_min = -30000, + y_max = 0, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 15*15*15, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13*13*13, + clust_num_ores = 5, + clust_size = 3, + y_min = -30000, + y_max = -256, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 17*17*17, + clust_num_ores = 4, + clust_size = 3, + y_min = -512, + y_max = -256, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15*15*15, + clust_num_ores = 4, + clust_size = 3, + y_min = -30000, + y_max = -512, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 12*12*12, + clust_num_ores = 4, + clust_size = 3, + y_min = -63, + y_max = -16, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:desert_stone_with_copper", + wherein = "default:desert_stone", + clust_scarcity = 11 * 11 * 11, + clust_num_ores = 6, + clust_size = 3, + y_min = 0, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 10*10*10, + clust_num_ores = 5, + clust_size = 3, + y_min = -30000, + y_max = -64, + flags = "absheight", + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 32 * 32 * 32, + clust_num_ores = 40, + clust_size = 4, + y_max = 64, + y_min = -30000, + }) + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 48 * 48 * 48, + clust_num_ores = 40, + clust_size = 4, + y_max = 64, + y_min = -30000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 30 * 30 * 30, + clust_num_ores = 64, + clust_size = 5, + y_max = -1024, + y_min = -30000, + }) + + if minetest.setting_get("mg_name") == "indev" then + -- Floatlands and high mountains springs: + minetest.register_ore({ + ore_type = "scatter", + ore = "default:water_source", + ore_param2 = 128, + wherein = "default:stone", + clust_scarcity = 40 *40 *40, + clust_num_ores = 8, + clust_size = 3, + y_min = 100, + y_max = 30000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:lava_source", + ore_param2 = 128, + wherein = "default:stone", + clust_scarcity = 50 * 50 * 50, + clust_num_ores = 5, + clust_size = 2, + y_min = 10000, + y_max = 30000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:sand", + wherein = "default:stone", + clust_scarcity = 20 * 20 * 20, + clust_num_ores = 5 * 5 * 3, + clust_size = 5, + y_min = 500, + y_max = 30000, + }) + end + + -- Underground springs: + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:water_source", + ore_param2 = 128, + wherein = "default:stone", + clust_scarcity = 20 * 20 * 20, + clust_num_ores = 10, + clust_size = 4, + y_min = -10000, + y_max = -10, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:lava_source", + ore_param2 = 128, + wherein = "default:stone", + clust_scarcity = 32 * 32 * 32, + clust_num_ores = 5, + clust_size = 2, + y_min = -30000, + y_max = -100, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:dirt", + wherein = "default:stone", + clust_scarcity = 16 * 16 * 16, + clust_num_ores = 64, + clust_size = 5, + y_max = 64, + y_min = -4096, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:gravel", + wherein = "default:stone", + clust_scarcity = 16 * 16 * 16, + clust_num_ores = 64, + clust_size = 5, + y_max = 64, + y_min = -30000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:sand", + wherein = "default:stone", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 32, + clust_size = 4, + y_max = 64, + y_min = -1024, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:clay", + wherein = "default:stone", + clust_scarcity = 32 * 32 * 32, + clust_num_ores = 32, + clust_size = 4, + y_max = 64, + y_min = -1024, + }) + + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:cobble", + wherein = "default:stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 512, + clust_size = 9, + y_max = 64, + y_min = -4096, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:desert_cobble", + wherein = "default:desert_stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 512, + clust_size = 9, + y_max = 64, + y_min = 0, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:clay", + wherein = "default:sand", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 64, + clust_size = 5, + y_max = 4, + y_min = -8, + }) + + -- Air rooms in dirt: + + minetest.register_ore({ + ore_type = "scatter", + ore = "air", + wherein = "default:dirt", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 200, + clust_size = 7, + y_min = -30000, + y_max = 64, + }) + + -- Acid lakes in gravel: + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:acid_source", + wherein = "default:gravel", + clust_scarcity = 20 * 20 * 20, + clust_num_ores = 64, + clust_size = 5, + y_min = -30000, + y_max = 64, + }) end + -- --- Detect mapgen and select suitable biome code +-- Register biomes -- + +function default.register_biomes() + minetest.clear_registered_biomes() + + minetest.register_biome({ + name = "default:grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + y_min = -31000, + y_max = 31000, + heat_point = 50, + humidity_point = 50, + node_underwater = "default:sand", + height_shore = 3, + node_shore_filler = "default:sand", + node_shore_top = "default:sand", + }) +end + + +-- +-- Register mgv6 decorations +-- + + +function default.register_mgv6_decorations() + + -- Papyrus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 8, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x=100, y=100, z=100}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + y_min = 1, + y_max = 1, + decoration = "default:papyrus", + height = 2, + height_max = 4, + spawn_by = "default:water_source", + num_spawn_by = 1, + }) + + -- Cacti + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.012, + scale = 0.024, + spread = {x=100, y=100, z=100}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:cactus", + height = 3, + height_max = 4, + }) + + -- Grasses + + for length = 1, 5 do + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.007, + spread = {x=100, y=100, z=100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:grass_"..length, + }) + end + + -- Dry shrubs + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.035, + spread = {x=100, y=100, z=100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:dry_shrub", + }) +end + + +-- +-- Register decorations +-- + + +function default.register_decorations() + + -- Flowers + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 436, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:rose", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 19822, + octaves = 3, + persist = 0.6 + }, + biomes = {"grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:tulip", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 1220999, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:dandelion_yellow", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 36662, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:geranium", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 1133, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:viola", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x=100, y=100, z=100}, + seed = 73133, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:dandelion_white", + }) + + -- Grasses + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.04, + scale = 0.08, + spread = {x=100, y=100, z=100}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_1", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.02, + scale = 0.08, + spread = {x=100, y=100, z=100}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_2", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.08, + spread = {x=100, y=100, z=100}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_3", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.08, + spread = {x=100, y=100, z=100}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_4", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.04, + scale = 0.08, + spread = {x=100, y=100, z=100}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_5", + }) +end + + +-- +-- Detect mapgen to select functions +-- + + +-- Mods using singlenode mapgen can call these functions to enable +-- the use of minetest.generate_ores or minetest.generate_decorations + local mg_params = minetest.get_mapgen_params() if mg_params.mgname == "v5" then default.register_biomes() - default.register_blobs() default.register_ores() elseif mg_params.mgname == "v6" then - minetest.register_on_generated(default.mgv6_ongen) + default.register_mgv6_decorations() default.register_ores() elseif mg_params.mgname == "v7" then default.register_biomes() - default.register_blobs() default.register_ores() end + +-- +-- Generate nyan cats in all mapgens +-- + + +-- facedir: 0/1/2/3 (head node facedir value) +-- length: length of rainbow tail +function default.make_nyancat(pos, facedir, length) + local tailvec = {x=0, y=0, z=0} + if facedir == 0 then + tailvec.z = 1 + elseif facedir == 1 then + tailvec.x = 1 + elseif facedir == 2 then + tailvec.z = -1 + elseif facedir == 3 then + tailvec.x = -1 + else + --print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) + facedir = 0 + tailvec.z = 1 + end + local p = {x=pos.x, y=pos.y, z=pos.z} + minetest.set_node(p, {name="default:nyancat", param2=facedir}) + for i=1,length do + p.x = p.x + tailvec.x + p.z = p.z + tailvec.z + minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir}) + end +end + + +function default.generate_nyancats(minp, maxp, seed) + local height_min = -30000 + local height_max = 30000 + if maxp.y < height_min or minp.y > height_max then + return + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) + local pr = PseudoRandom(seed + 9324342) + local max_num_nyancats = math.floor(volume / (15*15*15)) + for i=1,max_num_nyancats do + if pr:next(0, 1000) == 0 then + local x0 = pr:next(minp.x, maxp.x) + local y0 = pr:next(minp.y, maxp.y) + local z0 = pr:next(minp.z, maxp.z) + local p0 = {x=x0, y=y0, z=z0} + default.make_nyancat(p0, pr:next(0,3), 10) + end + end +end + + +minetest.register_on_generated(default.generate_nyancats) diff --git a/minetestforfun_game/mods/default/nodes.lua b/minetestforfun_game/mods/default/nodes.lua index 31262983..96cae354 100755 --- a/minetestforfun_game/mods/default/nodes.lua +++ b/minetestforfun_game/mods/default/nodes.lua @@ -1300,11 +1300,11 @@ minetest.register_node("default:water_flowing", { minetest.register_node("default:river_water_source", { description = "River Water Source", - inventory_image = minetest.inventorycube("default_water.png"), + inventory_image = minetest.inventorycube("default_river_water.png"), drawtype = "liquid", tiles = { { - name = "default_water_source_animated.png", + name = "default_river_water_source_animated.png", animation = { type = "vertical_frames", aspect_w = 16, @@ -1315,7 +1315,7 @@ minetest.register_node("default:river_water_source", { }, special_tiles = { { - name = "default_water_source_animated.png", + name = "default_river_water_source_animated.png", animation = { type = "vertical_frames", aspect_w = 16, @@ -1346,12 +1346,12 @@ minetest.register_node("default:river_water_source", { minetest.register_node("default:river_water_flowing", { description = "Flowing River Water", - inventory_image = minetest.inventorycube("default_water.png"), + inventory_image = minetest.inventorycube("default_river_water.png"), drawtype = "flowingliquid", - tiles = {"default_water.png"}, + tiles = {"default_river_water.png"}, special_tiles = { { - name = "default_water_flowing_animated.png", + name = "default_river_water_flowing_animated.png", backface_culling = false, animation = { type = "vertical_frames", @@ -1361,7 +1361,7 @@ minetest.register_node("default:river_water_flowing", { }, }, { - name = "default_water_flowing_animated.png", + name = "default_river_water_flowing_animated.png", backface_culling = true, animation = { type = "vertical_frames", diff --git a/minetestforfun_game/mods/default/tools.lua b/minetestforfun_game/mods/default/tools.lua index 0660d0ec..ab1245ed 100755 --- a/minetestforfun_game/mods/default/tools.lua +++ b/minetestforfun_game/mods/default/tools.lua @@ -4,6 +4,7 @@ minetest.register_item(":", { type = "none", wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, range = 5, tool_capabilities = { full_punch_interval = 0.8, @@ -26,11 +27,11 @@ minetest.register_tool("default:pick_wood", { inventory_image = "default_tool_woodpick.png", tool_capabilities = { full_punch_interval = 1.2, - max_drop_level = 0, - groupcaps = { + max_drop_level=0, + groupcaps={ cracky = {times = {[3] = 1.20}, uses = 15, maxlevel = 1}, }, - damage_groups = {fleshy = 2}, + damage_groups = {fleshy=2}, }, }) minetest.register_tool("default:pick_stone", { @@ -38,8 +39,8 @@ minetest.register_tool("default:pick_stone", { inventory_image = "default_tool_stonepick.png", tool_capabilities = { full_punch_interval = 1.2, - max_drop_level = 0, - groupcaps = { + max_drop_level=0, + groupcaps={ cracky = {times = {[2] = 1.60, [3] = 1.00}, uses = 20, maxlevel = 1}, crumbly = {times = {[1] = 2.6, [2] = 1.4, [3] = 0.44}, uses = 20, maxlevel = 1}, }, @@ -124,6 +125,7 @@ minetest.register_tool("default:pick_diamond", { damage_groups = {fleshy = 4}, }, }) + -- -- Shovels -- diff --git a/minetestforfun_game/mods/default/trees.lua b/minetestforfun_game/mods/default/trees.lua index 05094043..282e9aa8 100755 --- a/minetestforfun_game/mods/default/trees.lua +++ b/minetestforfun_game/mods/default/trees.lua @@ -29,7 +29,7 @@ minetest.register_abm({ end minetest.log("action", "A sapling grows into a tree at ".. - minetest.pos_to_string(pos)) + minetest.pos_to_string(pos)) default.grow_tree(pos, random(1, 4) == 1) end }) @@ -54,12 +54,12 @@ minetest.register_abm({ interval = 12, chance = 50, action = function(pos, node) - if not can_grow(pos) then - return - end + if not can_grow(pos) then + return + end - minetest.log("action", "A pine sapling grows into a tree at ".. - minetest.pos_to_string(pos)) + minetest.log("action", "A pine sapling grows into a tree at ".. + minetest.pos_to_string(pos)) default.grow_pine_tree(pos) end }) @@ -78,7 +78,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, local vi = a:index(x, y + y_dist, z) local node_id = data[vi] if y_dist == 0 or node_id == c_air or node_id == c_ignore - or node_id == leaves_cid then + or node_id == leaves_cid then data[vi] = tree_cid end end