From dfe1415390b330df1c992f4f7315b2dd459c2903 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Wed, 22 Mar 2017 23:41:34 -0600 Subject: [PATCH] future-proofing leaf decay --- biomes/level3.lua | 5 +++-- locale/template.pot | 48 +++++++++++++++++++++++++------------------ trees/black_cap.lua | 10 ++++++++- trees/blood_thorn.lua | 31 ++++++++++++++++++++-------- trees/fungiwood.lua | 11 ++++++++-- trees/goblin_cap.lua | 9 ++++++++ trees/nether_cap.lua | 11 +++++++++- trees/spore_tree.lua | 42 +++++++++++++++---------------------- trees/tower_cap.lua | 11 +++++++++- 9 files changed, 117 insertions(+), 61 deletions(-) diff --git a/biomes/level3.lua b/biomes/level3.lua index 61254e1..9a701d4 100644 --- a/biomes/level3.lua +++ b/biomes/level3.lua @@ -145,12 +145,13 @@ local level_3_nether_cap_floor = function(area, data, ai, vi, bi, param2_data) local drip_rand = subterrane:vertically_consistent_random(vi, area) - if math.random() < 0.01 then + if math.random() < 0.01 and data[bi] ~= c_ice then dfcaverns.place_shrub(data, vi, param2_data) elseif drip_rand < 0.1 then --subterrane:stalagmite(bi, area, data, 6, 15, c_stone, c_stone, c_stone) local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4 - local height = math.floor(drip_rand/0.1 * 5) + local height = math.floor(drip_rand/0.1 * 5) + data[vi] = c_air subterrane:stalagmite(vi, area, data, param2_data, param2, height, false) elseif math.random() < 0.005 then dfcaverns.spawn_nether_cap_vm(vi, area, data) diff --git a/locale/template.pot b/locale/template.pot index e29796b..212cf6a 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-03-21 01:52-0600\n" +"POT-Creation-Date: 2017-03-22 23:29-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -113,32 +113,36 @@ msgstr "" msgid "Black Cap Gills" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\black_cap.lua:63 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\black_cap.lua:71 msgid "Black Cap Planks" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\black_cap.lua:100 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\black_cap.lua:108 msgid "Black Cap Spawn" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:14 -msgid "Blood Thorn Trunk" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:31 +msgid "Blood Thorn Stem" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:26 -msgid "Dead Blood Thorn Trunk" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:44 +msgid "Dead Blood Thorn Stem" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:36 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:55 msgid "Blood Thorn Spike" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:64 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:83 msgid "Dead Blood Thorn Spike" msgstr "" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\blood_thorn.lua:118 +msgid "Blood Thorn Planks" +msgstr "" + #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\fungiwood.lua:13 -msgid "Fungiwood Trunk" +msgid "Fungiwood Stem" msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\fungiwood.lua:32 @@ -149,7 +153,7 @@ msgstr "" msgid "Fungiwood Shelf" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\fungiwood.lua:93 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\fungiwood.lua:100 msgid "Fungiwood Spawn" msgstr "" @@ -165,11 +169,15 @@ msgstr "" msgid "Goblin Cap Gills" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\goblin_cap.lua:62 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\goblin_cap.lua:71 msgid "Goblin Cap Planks" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\goblin_cap.lua:100 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\goblin_cap.lua:81 +msgid "Goblin Cap Stem Planks" +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\goblin_cap.lua:123 msgid "Goblin Cap Spawn" msgstr "" @@ -185,16 +193,16 @@ msgstr "" msgid "Nether Cap Gills" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\nether_cap.lua:62 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\nether_cap.lua:71 msgid "Nether Cap Planks" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\nether_cap.lua:74 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\nether_cap.lua:83 msgid "Nether Cap Spawn" msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:14 -msgid "Spore Tree" +msgid "Spore Tree Stem" msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:33 @@ -202,14 +210,14 @@ msgid "Spore Tree Planks" msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:70 -msgid "Spore Tree Frond" +msgid "Spore Tree Hyphae" msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:94 msgid "Spore Tree Fruiting Body" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:133 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\spore_tree.lua:140 msgid "Spore Tree Spawn" msgstr "" @@ -225,11 +233,11 @@ msgstr "" msgid "Tower Cap Gills" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\tower_cap.lua:62 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\tower_cap.lua:71 msgid "Tower Cap Planks" msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\tower_cap.lua:100 +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\dfcaverns\trees\tower_cap.lua:109 msgid "Tower Cap Spawn" msgstr "" diff --git a/trees/black_cap.lua b/trees/black_cap.lua index 4cef78c..f66faf8 100644 --- a/trees/black_cap.lua +++ b/trees/black_cap.lua @@ -34,15 +34,23 @@ minetest.register_node("dfcaverns:black_cap_gills", { items = { { items = {'dfcaverns:black_cap_sapling'}, - rarity = 10, + rarity = 5, }, { items = {'dfcaverns:black_cap_gills'}, } } }, + after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:black_cap"}, -- don't need stem nodes here + leaves = {"dfcaverns:black_cap_gills"}, + radius = 1, + }) +end -- Wood minetest.register_craft({ diff --git a/trees/blood_thorn.lua b/trees/blood_thorn.lua index 62e5e7c..d94ca09 100644 --- a/trees/blood_thorn.lua +++ b/trees/blood_thorn.lua @@ -10,8 +10,26 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") +local spike_directions = { + {dir={x=0,y=0,z=1}, facedir=2}, + {dir={x=0,y=0,z=-1}, facedir=0}, + {dir={x=1,y=0,z=0}, facedir=3}, + {dir={x=-1,y=0,z=0}, facedir=1} +} +local spikes = {["dfcaverns:blood_thorn_spike"] = true, ["dfcaverns:blood_thorn_spike_dead"] = true} + +local blood_thorn_after_dig = function(pos, oldnode, oldmetadata, digger) + for _, spike_dir in pairs(spike_directions) do + local loc = vector.add(pos,spike_dir.dir) + local node = minetest.get_node(loc) + if spikes[node.name] and spike_dir.facedir == node.param2 then + minetest.node_dig(loc, node, digger) + end + end +end + minetest.register_node("dfcaverns:blood_thorn", { - description = S("Blood Thorn Trunk"), + description = S("Blood Thorn Stem"), tiles = {"dfcaverns_blood_thorn_top.png", "dfcaverns_blood_thorn_top.png", "dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png"}, paramtype2 = "facedir", @@ -20,16 +38,18 @@ minetest.register_node("dfcaverns:blood_thorn", { _dfcaverns_dead_node = "dfcaverns:blood_thorn_dead", sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node, + after_dig_node = blood_thorn_after_dig, }) minetest.register_node("dfcaverns:blood_thorn_dead", { - description = S("Dead Blood Thorn Trunk"), + description = S("Dead Blood Thorn Stem"), tiles = {"dfcaverns_blood_thorn_top.png^[multiply:#804000", "dfcaverns_blood_thorn_top.png^[multiply:#804000", "dfcaverns_blood_thorn_side.png^[multiply:#804000"}, paramtype2 = "facedir", groups = {choppy = 3, flammable = 2}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node, + after_dig_node = blood_thorn_after_dig, }) minetest.register_node("dfcaverns:blood_thorn_spike", { @@ -132,13 +152,6 @@ minetest.register_craft({ burntime = 5, }) -local spike_directions = { - {dir={x=0,y=0,z=1}, facedir=2}, - {dir={x=0,y=0,z=-1}, facedir=0}, - {dir={x=1,y=0,z=0}, facedir=3}, - {dir={x=-1,y=0,z=0}, facedir=1} -} - -- This ensures consistent random maximum to bloodthorn growth local max_bloodthorn_height = function(pos) local next_seed = math.random(1, 1000000000) diff --git a/trees/fungiwood.lua b/trees/fungiwood.lua index ea2da65..eb1fcc6 100644 --- a/trees/fungiwood.lua +++ b/trees/fungiwood.lua @@ -10,7 +10,7 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") minetest.register_node("dfcaverns:fungiwood", { - description = S("Fungiwood Trunk"), + description = S("Fungiwood Stem"), tiles = {"dfcaverns_fungiwood.png"}, paramtype2 = "facedir", is_ground_content = false, @@ -79,7 +79,7 @@ minetest.register_node("dfcaverns:fungiwood_shelf",{ drop = { max_items = 1, items = { - {items = {"dfcaverns:fungiwood_sapling"}, rarity = 20}, + {items = {"dfcaverns:fungiwood_sapling"}, rarity = 10}, {items = {"dfcaverns:fungiwood_shelf"}} } }, @@ -88,6 +88,13 @@ minetest.register_node("dfcaverns:fungiwood_shelf",{ after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:fungiwood"}, + leaves = {"dfcaverns:fungiwood_shelf"}, + radius = 5, + }) +end minetest.register_node("dfcaverns:fungiwood_sapling", { description = S("Fungiwood Spawn"), diff --git a/trees/goblin_cap.lua b/trees/goblin_cap.lua index 7d95f4f..8eab83d 100644 --- a/trees/goblin_cap.lua +++ b/trees/goblin_cap.lua @@ -41,8 +41,17 @@ minetest.register_node("dfcaverns:goblin_cap_gills", { } } }, + after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:goblin_cap"}, -- don't need stem nodes here + leaves = {"dfcaverns:goblin_cap_gills"}, + radius = 1, + }) +end + --Wood minetest.register_craft({ output = 'dfcaverns:goblin_cap_wood 4', diff --git a/trees/nether_cap.lua b/trees/nether_cap.lua index a343e0b..92b0f56 100644 --- a/trees/nether_cap.lua +++ b/trees/nether_cap.lua @@ -34,15 +34,24 @@ minetest.register_node("dfcaverns:nether_cap_gills", { items = { { items = {'dfcaverns:nether_cap_sapling'}, - rarity = 10, + rarity = 5, }, { items = {'dfcaverns:nether_cap_gills'}, } } }, + after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:nether_cap"}, -- don't need stem nodes here + leaves = {"dfcaverns:nether_cap_gills"}, + radius = 1, + }) +end + --Wood minetest.register_craft({ output = 'dfcaverns:nether_cap_wood 4', diff --git a/trees/spore_tree.lua b/trees/spore_tree.lua index 98a2304..0ddc30a 100644 --- a/trees/spore_tree.lua +++ b/trees/spore_tree.lua @@ -11,7 +11,7 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") minetest.register_node("dfcaverns:spore_tree", { - description = S("Spore Tree"), + description = S("Spore Tree Stem"), tiles = {"dfcaverns_spore_tree_top.png", "dfcaverns_spore_tree_top.png", "dfcaverns_spore_tree.png"}, paramtype2 = "facedir", is_ground_content = false, @@ -52,12 +52,12 @@ minetest.register_craft({ }) minetest.register_craft({ type = "fuel", - recipe = "dfcaverns:spore_tree_frond", + recipe = "dfcaverns:spore_tree_hyphae", burntime = 1, }) minetest.register_craft({ type = "fuel", - recipe = "dfcaverns:spore_tree_pod", + recipe = "dfcaverns:spore_tree_fruiting_body", burntime = 1, }) minetest.register_craft({ @@ -66,8 +66,8 @@ minetest.register_craft({ burntime = 1, }) -minetest.register_node("dfcaverns:spore_tree_frond", { - description = S("Spore Tree Frond"), +minetest.register_node("dfcaverns:spore_tree_hyphae", { + description = S("Spore Tree Hyphae"), waving = 1, tiles = {"dfcaverns_spore_tree.png"}, is_ground_content = false, @@ -90,7 +90,7 @@ minetest.register_node("dfcaverns:spore_tree_frond", { after_place_node = default.after_place_leaves, }) -minetest.register_node("dfcaverns:spore_tree_pod", { +minetest.register_node("dfcaverns:spore_tree_fruiting_body", { description = S("Spore Tree Fruiting Body"), waving = 1, tiles = {"dfcaverns_spore_tree.png"}, @@ -119,7 +119,7 @@ minetest.register_node("dfcaverns:spore_tree_pod", { rarity = 10, }, { - items = {'dfcaverns:spore_tree_frond'}, + items = {'dfcaverns:spore_tree_hyphae'}, } } }, @@ -128,6 +128,13 @@ minetest.register_node("dfcaverns:spore_tree_pod", { after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:spore_tree"}, + leaves = {"dfcaverns:spore_tree_hyphae", "dfcaverns:spore_tree_fruiting_body"}, + radius = 3, + }) +end minetest.register_node("dfcaverns:spore_tree_sapling", { description = S("Spore Tree Spawn"), @@ -159,26 +166,11 @@ minetest.register_node("dfcaverns:spore_tree_sapling", { end, }) ---fcaverns.spore_tree_def={ --- axiom="TTdddA", --- rules_a="[&&&Tdd&&FF][&&&++++Tdd&&FF][&&&----Tdd&&FF]", --- rules_d="T", --- trunk="dfcaverns:spore_tree", --- leaves="dfcaverns:spore_tree_frond", --- leaves2="dfcaverns:spore_tree_pod", --- leaves2_chance=30, --- angle=30, --- iterations=2, --- random_level=0, --- trunk_type="single", --- thin_branches=true, ---} - local c_air = minetest.get_content_id("air") local c_ignore = minetest.get_content_id("ignore") -local c_spore_pod = minetest.get_content_id("dfcaverns:spore_tree_pod") +local c_spore_pod = minetest.get_content_id("dfcaverns:spore_tree_fruiting_body") local c_tree = minetest.get_content_id("dfcaverns:spore_tree") -local c_spore_frond = minetest.get_content_id("dfcaverns:spore_tree_frond") +local c_spore_frond = minetest.get_content_id("dfcaverns:spore_tree_hyphae") dfcaverns.spawn_spore_tree_vm = function(vi, area, data, height, size, iters, has_fruiting_bodies) if height == nil then height = math.random(3,6) end @@ -262,7 +254,7 @@ end minetest.register_abm{ label = "spore tree raining spores", - nodenames = {"dfcaverns:spore_tree_pod"}, + nodenames = {"dfcaverns:spore_tree_fruiting_body"}, interval = 1, chance = 30, catch_up = false, diff --git a/trees/tower_cap.lua b/trees/tower_cap.lua index 9a34fcc..6bd905f 100644 --- a/trees/tower_cap.lua +++ b/trees/tower_cap.lua @@ -34,15 +34,24 @@ minetest.register_node("dfcaverns:tower_cap_gills", { items = { { items = {'dfcaverns:tower_cap_sapling'}, - rarity = 20, + rarity = 5, }, { items = {'dfcaverns:tower_cap_gills'}, } } }, + after_place_node = default.after_place_leaves, }) +if default.register_leafdecay then -- default.register_leafdecay is very new, remove this check some time after 0.4.16 is released + default.register_leafdecay({ + trunks = {"dfcaverns:tower_cap"}, -- don't need stem nodes here + leaves = {"dfcaverns:tower_cap_gills"}, + radius = 1, + }) +end + --Wood minetest.register_craft({ output = 'dfcaverns:tower_cap_wood 4',