Jeija's timber mod caused following: If you dig one of the nodes listed there then the nodes above them also become dug (if they have the same name).
It's deprecated now because its function is added to default for papyrus and cactus.
l haven't tested the other ones, deivan's mod obviously additionally removes whole trees (with leaves) in comparison to Jeija's mod.
deivan's mod is obviously three years old.
My mod doesn't add the straight digging up function to papyrus etc.,
the leaves of trees next to the chopped one are kept,
treecapitating only works if it's a tree with leaves and the tree is not rotated to avoid destroying trunk house corners,
if sneak is pressed, the tree doesn't become capitated,
a sound is played, etc..
But my version doesn't support growing_trees, which is, if l remember correctly, an old, more or less remarkable mod.
Nemin32's version is almost the same as deivan's, the only difference is that the axe is needed to chop the whole tree, l assume.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
diff --git a/init.lua b/init.lua
index b403450..cd1f5fb 100644
--- a/init.lua
+++ b/init.lua
@@ -7,9 +7,7 @@
local nt={}
--nt.limit=2 --Range from the last cut node to search nodes do cut, 1 is good, 2 is optimal to servers with growing trees.
-local nt_nodenames={}
-
-local nt_nodenames_list={
+local nt_nodenames={
"default:jungletree",
"default:papyrus",
"default:cactus",
@@ -48,20 +46,36 @@ local nt_nodenames_list={
}
minetest.register_on_dignode(function(pos, node, digger)
- local i=1
- nm = node.name
-
- if(nt_nodenames["default:tree"]==nil) then
- while nt_nodenames_list[i]~=nil do
- nt_nodenames[nt_nodenames_list[i]]=nt_nodenames_list[i]
- i = i + 1
- end
- end
-
- if(nt_nodenames[nm]~=nil) then
- nt_primary(pos,node,digger,0)
- return false
+ local idx = digger:get_wield_index()
+ local inv = digger:get_inventory()
+ local stack = inv:get_stack("main", idx):get_name()
+ print(stack)
+ list_of_axes = {
+ "default:axe_stone",
+ "default:axe_bronze",
+ "default:axe_steel",
+ "default:axe_mese",
+ "default:axe_stone"
+ }
+ for _,v in pairs(list_of_axes) do
+ if v == stack then
+ -- do something
+ --if stack == "default:axe_stone" then
+ local i=1
+ while nt_nodenames[i]~=nil do
+ nm = node.name
+
+ if nm==nt_nodenames[i] then
+ nt_primary(pos,node,digger,0)
+ return false
+ end
+
+ i = i + 1
+ end
+ --end
+ break
end
+end
end)