diff --git a/mods/default/README.txt b/mods/default/README.txt index a5346976..f40ac540 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -244,6 +244,9 @@ Topywo (CC BY-SA 3.0) default_coral_green.png default_coral_pink.png +Extex101 (CC BY-SA 3.0) + default_large_cactus_seedling.png + Sounds ------ diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index b8651c0c..b49dc487 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -779,6 +779,15 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "default:large_cactus_seedling", + recipe = { + {"", "default:cactus", ""}, + {"default:cactus", "default:cactus", "default:cactus"}, + {"", "default:cactus", ""}, + } +}) + -- -- Crafting (tool repair) @@ -1095,6 +1104,12 @@ minetest.register_craft({ burntime = 15, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:large_cactus_seedling", + burntime = 5, +}) + minetest.register_craft({ type = "fuel", recipe = "default:papyrus", diff --git a/mods/default/license.txt b/mods/default/license.txt index a5ea24b5..fecb1eb8 100644 --- a/mods/default/license.txt +++ b/mods/default/license.txt @@ -50,6 +50,7 @@ Copyright (C) 2010-2018: TumeniNodes Mossmanikin random-geek + Extex101 You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index b92e12ef..9c63d1ed 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -1893,7 +1893,7 @@ function default.register_decorations() y_max = 31000, y_min = 4, schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", - flags = "place_center_x", + flags = "place_center_x, place_center_z", rotation = "random", }) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 5ce0ce19..a2f1a3e5 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -132,6 +132,8 @@ Plantlife --------- default:cactus +default:large_cactus_seedling + default:papyrus default:dry_shrub default:junglegrass @@ -1276,6 +1278,77 @@ minetest.register_node("default:cactus", { on_place = minetest.rotate_node, }) +minetest.register_node("default:large_cactus_seedling", { + description = "Large Cactus Seedling", + drawtype = "plantlike", + tiles = {"default_large_cactus_seedling.png"}, + inventory_image = "default_large_cactus_seedling.png", + wield_image = "default_large_cactus_seedling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { + -5 / 16, -0.5, -5 / 16, + 5 / 16, 0.5, 5 / 16 + } + }, + groups = {choppy = 3, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:large_cactus_seedling", + {x = -2, y = -1, z = -2}, + {x = 2, y = 5, z = 2}, + 4) + + return itemstack + end, + + on_construct = function(pos) + -- Normal cactus farming adds 1 cactus node by ABM, + -- interval 12s, chance 83. + -- Consider starting with 5 cactus nodes. We make sure that growing a + -- large cactus is not a faster way to produce new cactus nodes. + -- Confirmed by experiment, when farming 5 cacti, on average 1 new + -- cactus node is added on average every + -- 83 / 5 = 16.6 intervals = 16.6 * 12 = 199.2s. + -- Large cactus contains on average 14 cactus nodes. + -- 14 * 199.2 = 2788.8s. + -- Set random range to average to 2789s. + minetest.get_node_timer(pos):start(math.random(1859, 3719)) + end, + + on_timer = function(pos) + local node_under = minetest.get_node_or_nil( + {x = pos.x, y = pos.y - 1, z = pos.z}) + if not node_under then + -- Node under not yet loaded, try later + minetest.get_node_timer(pos):start(300) + return + end + + if minetest.get_item_group(node_under.name, "sand") == 0 then + -- Seedling dies + minetest.remove_node(pos) + return + end + + local light_level = minetest.get_node_light(pos) + if not light_level or light_level < 13 then + -- Too dark for growth, try later in case it's night + minetest.get_node_timer(pos):start(300) + return + end + + minetest.log("action", "A large cactus seedling grows into a large" .. + "cactus at ".. minetest.pos_to_string(pos)) + default.grow_large_cactus(pos) + end, +}) + minetest.register_node("default:papyrus", { description = "Papyrus", drawtype = "plantlike", diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts index b71077b3..e453573f 100644 Binary files a/mods/default/schematics/large_cactus.mts and b/mods/default/schematics/large_cactus.mts differ diff --git a/mods/default/textures/default_large_cactus_seedling.png b/mods/default/textures/default_large_cactus_seedling.png new file mode 100644 index 00000000..378351ad Binary files /dev/null and b/mods/default/textures/default_large_cactus_seedling.png differ diff --git a/mods/default/trees.lua b/mods/default/trees.lua index c9eabaa8..564b7141 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -510,6 +510,16 @@ function default.grow_pine_bush(pos) end +-- Large cactus + +function default.grow_large_cactus(pos) + local path = minetest.get_modpath("default") .. + "/schematics/large_cactus.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + -- -- Sapling 'on place' function to check protection of node and resulting tree volume -- @@ -550,7 +560,9 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, interval) then minetest.record_protection_violation(pos, player_name) -- Print extra information to explain - minetest.chat_send_player(player_name, "Tree will intersect protection") + minetest.chat_send_player(player_name, + itemstack:get_definition().description .. " will intersect protection " .. + "on growth") return itemstack end diff --git a/schematic_tables.txt b/schematic_tables.txt index bd101e71..26f31d2a 100644 --- a/schematic_tables.txt +++ b/schematic_tables.txt @@ -2050,15 +2050,50 @@ local R = {name = "default:cactus", prob = 255, param2 = 20, force_place = true} local E = {name = "default:cactus", prob = 127, param2 = 20} mts_save("large_cactus", { - size = {x = 5, y = 7, z = 1}, + size = {x = 5, y = 7, z = 5}, data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, R, _, _, _, _, R, _, _, - _, _, C, _, _, _, _, C, _, _, C, C, C, C, C, C, _, C, _, C, E, _, C, _, E, _, _, C, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, }, })