mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-25 10:20:37 +01:00
Revise rules for regenerating latex
To ensure that only rubber tree trunk nodes that are part of trees regenerate, rather than those that are used as building blocks, check that they are sufficiently close to rubber tree leaves. This replaces the older rule that naturally-grown trunks regenerate (regardless of leaves) and manually-placed trunks don't (even though manually building a tree otherwise works). The detection of manually-placed trunks was in any case broken for users of moretrees, because that mod fails to set the flag signalling manual placement. Incidentally also fix a bug that caused rubber tree branches (horizontal trunk nodes) to turn vertical when regenerating latex. Rather than set the complete node structure, only switch the type name, as does the tree tap when emptying the node.
This commit is contained in:
parent
b001a67979
commit
3b16a2858f
@ -65,11 +65,10 @@ minetest.register_abm({
|
||||
interval = 60,
|
||||
chance = 15,
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("placed") ~= 0 then
|
||||
return
|
||||
if minetest.find_node_near(pos, (moretrees and moretrees.leafdecay_radius) or 5, {"moretrees:rubber_tree_leaves"}) then
|
||||
node.name = "moretrees:rubber_tree_trunk"
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
minetest.set_node(pos, {name="moretrees:rubber_tree_trunk"})
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -27,10 +27,6 @@ minetest.register_node(":moretrees:rubber_tree_trunk", {
|
||||
groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1,
|
||||
flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("placed", 1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(":moretrees:rubber_tree_trunk_empty", {
|
||||
@ -40,10 +36,6 @@ minetest.register_node(":moretrees:rubber_tree_trunk_empty", {
|
||||
groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1,
|
||||
flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("placed", 1)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(":moretrees:rubber_tree_leaves", {
|
||||
|
Loading…
Reference in New Issue
Block a user