Thanks for explaining it!Jeija wrote:Topywo, I think that is caused by a "bug" in minetest, to be more precise:
Minetest only loads some chunks around you.
If a mod tries to acces a node that is too far away, in an unloaded chunk, minetest simply ignores that. That happens in this mod, as the stone below you seems to be unloaded as well as in the mesecons mod where too big structures don`t work.
[Mod] Timber [0.1] [timber]
love it ... should be working only with a special tool ... for instance a mese axe
0.4 for serious builder click here
Dedicated Minetest redcrab server forum at http://minetestbb.suret.net
It's nice to be important but it is more important to be nice.
Dedicated Minetest redcrab server forum at http://minetestbb.suret.net
It's nice to be important but it is more important to be nice.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
Can anyone combine these two codes? To get the mod timber operation when the mese axe is wielded.
and Jeija code
This may prove to be helpful:
Code: Select all
minetest.register_tool("timber:axe",{
type="tool",
description = "Mese axe",
groups = {},
inventory_image = "mese_axe.png",
wield_image = "mese_axe.png",
wield_scale = {x=1,y=1,z=1},
stack_max = 1,
liquids_pointable = false,
tool_capabilities = {
full_punch_interval=1.5,
max_drop_level=1,
groupcaps={
crumbly={maxlevel=2, uses=20, times={[1]=1.60, [2]=1.20, [3]=0.80}}
}
},
})
minetest.register_craft({
output = 'timber:axe 1',
recipe = {
{'default:mese', 'default:mese'},
{'default:mese', 'default:stick'},
{'', 'default:stick'}
},
})
Code: Select all
timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
minetest.register_on_dignode(function(pos, node, digger)
local i=1
while timber_nodenames[i]~=nil do
if node.name==timber_nodenames[i] then
np={x=pos.x, y=pos.y+1, z=pos.z}
while minetest.env:get_node(np).name==timber_nodenames[i] do
minetest.env:remove_node(np)
digger:get_inventory():add_item('main', timber_nodenames[i])
np={x=np.x, y=np.y+1, z=np.z}
end
end
i=i+1
end
end)
Code: Select all
- get_wield_list(): returns the name of the inventory list the wielded item is in
- get_wield_index(): returns the index of the wielded item
- get_wielded_item() -> ItemStack
- set_wielded_item(item): replaces the wielded item, returns true if successful
Nope
Thanks for help.jin_xi wrote:maybe put something like this at the beginning of the register_on_dignode function:
if digger:get_wielded_item():get_name() ~= "timber:axe" then
return
end
Jeija's timber mod, mod operation when the mese axe is wielded.
The amount to use an axe: 60
Mese axe craft: like steel axe, but with mese instead steel.
DOWNLOAD
Preview http://pastebin.com/Zk44BTW0
Last edited by cactuz_pl on Wed Jul 18, 2012 11:09, edited 1 time in total.
Nope
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
Added a change so the leaves fall too:
https://github.com/cornernote/minetest- ... r/init.lua
https://github.com/cornernote/minetest- ... r/init.lua
Jeija your epicJeija wrote:This is the equivalent to the minecraft timber mod.
An easy 2-minute-coding mod.
YouTube (of Minecraft Version)
Works with
- Jungletree
- Tree
- Papyrus
- Cactus
Download
V 0.1 as .zip
License: GPLv3
TACOS!!!!!!!!!!!!!!!!!!!!!!!!!
Hello I have played a bit with the code and created a variant which instead of only going straight upward searches in an upward cone for similar nodes. Additionally nodes are only removed if no similar node is in a 3x3 grid below. I left out the leafs part, because they are removed automatically anyways in recent versions.
I primary did this change so that trees from the nature mod can be chopped down in a reasonable way.
As a result is is possible to timber more complex trees and at the same time is is save to remove a piece of wood from a wall without getting the whole wall timbered down.
I primary did this change so that trees from the nature mod can be chopped down in a reasonable way.
As a result is is possible to timber more complex trees and at the same time is is save to remove a piece of wood from a wall without getting the whole wall timbered down.
Code: Select all
timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree", "conifers:trunk", "irontrees:irontree"}
digupwards = function(pos, searchname, player)
for dx = -1, 1 do
for dz = -1, 1 do
local timerallowed = 1
timber_pos={x=pos.x+dx, y=pos.y, z=pos.z+dz}
if minetest.env:get_node(timber_pos).name ~= searchname then
-- early abort for invalid nodes
--print("early abort")
timerallowed = 0
--continue --check next dz position <-- lua does not have such a command?!
end
if timerallowed == 1 then -- (one additional check to spare the 9 checks)
for ddx = -1, 1 do
for ddz = -1, 1 do
local pillar_pos={x=timber_pos.x+ddx, y=timber_pos.y-1, z=timber_pos.z+ddz}
--print(minetest.env:get_node(pillar_pos).name)
if minetest.env:get_node(pillar_pos).name == searchname then
--print("aborting timber because there is a similar node below")
timerallowed = 0
end
end
end
end
if timerallowed == 1 then
-- Node is of type 'seachname' and no similar node is below in a 3x3 area
minetest.env:remove_node(timber_pos)
-- direct addition to inventory
--player:get_inventory():add_item('main', searchname)
-- drop item in place (only usefull with autopickup mod)
local timber_item = minetest.env:add_item(timber_pos, searchname)
timber_item:get_luaentity().dug_by = player:get_player_name()
-- increase recursion depth
timber_pos.y = timber_pos.y + 1
digupwards(timber_pos, searchname, player)
end
end
end
end
minetest.register_on_dignode(function(pos, node, player)
for _,timber_nodename in ipairs(timber_nodenames) do
if node.name==timber_nodename then
timber_pos={x=pos.x, y=pos.y+1, z=pos.z}
digupwards(timber_pos, node.name, player)
return -- there can be only one match
end
end
end)
any way we can get this to work with growing_trees mod? http://minetest.net/forum/viewtopic.php?id=978
I stitched something together, but it is really brute force. --> inefficient as hell, but seem to get this monsters down.Spots wrote:any way we can get this to work with growing_trees mod? http://minetest.net/forum/viewtopic.php?id=978
complete content of init.lua:
Code: Select all
timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree", "conifers:trunk", "irontrees:irontree", "growing_trees:trunk"}
growingTreesPartsTable={"growing_trees:trunk", "growing_trees:branch", "growing_trees:branch_xmzm", "growing_trees:branch_xpzm", "growing_trees:branch_xmzp", "growing_trees:branch_xpzp", "growing_trees:branch_zz", "growing_trees:branch_xx", "growing_trees:sprout", "growing_trees:branch_sprout"}
function table.contains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
digupwards = function(pos, searchname, player)
for dx = -1, 1 do
for dz = -1, 1 do
for dy = 0, 1 do
local timerallowed = 1
timber_pos={x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
if searchname == "growing_trees:trunk" then
if table.contains(growingTreesPartsTable, minetest.env:get_node(timber_pos).name) == false then
timerallowed = 0
end
else
if minetest.env:get_node(timber_pos).name ~= searchname then
-- early abort for invalid nodes
--print("early abort")
timerallowed = 0
--continue --check next dz position <-- lua does not have such a command?!
end
end
if timerallowed == 1 then -- (one additional check to spare the 9 checks)
for ddx = -1, 1 do
for ddz = -1, 1 do
local pillar_pos={x=timber_pos.x+ddx, y=timber_pos.y-1, z=timber_pos.z+ddz}
--print(minetest.env:get_node(pillar_pos).name)
if minetest.env:get_node(pillar_pos).name == searchname then
--print("aborting timber because there is a similar node below")
timerallowed = 0
end
end
end
end
if timerallowed == 1 then
-- Node is of type 'seachname' and no similar node is below in a 3x3 area
local dugname = minetest.env:get_node(timber_pos).name
minetest.env:remove_node(timber_pos)
-- drop item in place and use get_node_drops function
local itemstacks = minetest.get_node_drops(dugname)
for _, itemname in ipairs(itemstacks) do
if itemname ~= "default:leaves" then
local p_drop = {
x = timber_pos.x - 0.5 + math.random(),
y = timber_pos.y - 0.5 + math.random(),
z = timber_pos.z - 0.5 + math.random(),
}
minetest.env:add_item(p_drop, itemname)
end
end
-- increase recursion depth
--timber_pos.y = timber_pos.y + 1
digupwards(timber_pos, searchname, player)
end
end
end
end
end
minetest.register_on_dignode(function(pos, node, player)
for _,timber_nodename in ipairs(timber_nodenames) do
if node.name==timber_nodename then
timber_pos={x=pos.x, y=pos.y+1, z=pos.z}
digupwards(timber_pos, node.name, player)
return -- there can be only one match
end
end
end)
chlue your solution seems to leave the tip of the tree intact.chlue wrote:I stitched something together, but it is really brute force. --> inefficient as hell, but seem to get this monsters down.Spots wrote:any way we can get this to work with growing_trees mod? http://minetest.net/forum/viewtopic.php?id=978
complete content of init.lua:
Folder is corrupted or invalid.cactuz_pl wrote:Thanks for help.jin_xi wrote:maybe put something like this at the beginning of the register_on_dignode function:
if digger:get_wielded_item():get_name() ~= "timber:axe" then
return
end
Jeija's timber mod, mod operation when the mese axe is wielded.
The amount to use an axe: 60
Mese axe craft: like steel axe, but with mese instead steel.
DOWNLOAD
Preview http://pastebin.com/Zk44BTW0
- RealBadAngel
- Member
- Posts: 557
- Joined: Wed Jul 18, 2012 16:30
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
I don't know the code in the timber mod, but I doubt it will work with moretrees - they're just too complex. Now if someone wants to write a mod to walk a tree manually...
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
it only works with the blocks set in it. this is literally the entire code.
and this is the blocks it works with
Code: Select all
timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
minetest.register_on_dignode(function(pos, node)
local i=1
while timber_nodenames[i]~=nil do
if node.name==timber_nodenames[i] then
np={x=pos.x, y=pos.y+1, z=pos.z}
while minetest.env:get_node(np).name==timber_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, timber_nodenames[i])
np={x=np.x, y=np.y+1, z=np.z}
end
end
i=i+1
end
end)
Code: Select all
timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
Coding;
1X coding
3X debugging
12X tweaking to be just right
1X coding
3X debugging
12X tweaking to be just right
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Yup, that won't work with moretrees. You'll have to walk the tree manually then to fell it.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
I'm working on a small mod that places huts close to trees and offers a way to trade other things for wood so that you don't have to cut down the trees. The trader from Sapiers animals mod is well capable of selling wood when modified. It's still a lot of work until everything will work as I intend it to.
A list of my mods can be found here.
Hello.
I make a change here:
This line: timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
to this line:
local timber_nodenames={"irontrees:irontree","bamboo:bamboo","bamboo:bamboo_dry","default:jungletree", "default:papyrus", "default:cactus", "default:tree", "vines:vine", "vines:vine_rotten"}
Without the "local" I detected some problems with variables in other mods. Is working fine now. Nice mod.
I make a change here:
This line: timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
to this line:
local timber_nodenames={"irontrees:irontree","bamboo:bamboo","bamboo:bamboo_dry","default:jungletree", "default:papyrus", "default:cactus", "default:tree", "vines:vine", "vines:vine_rotten"}
Without the "local" I detected some problems with variables in other mods. Is working fine now. Nice mod.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Rather check for the group "tree".deivan wrote:Hello.
I make a change here:
This line: timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"}
to this line:
local timber_nodenames={"irontrees:irontree","bamboo:bamboo","bamboo:bamboo_dry","default:jungletree", "default:papyrus", "default:cactus", "default:tree", "vines:vine", "vines:vine_rotten"}
Without the "local" I detected some problems with variables in other mods. Is working fine now. Nice mod.
Who is online
Users browsing this forum: Ahrefs [Bot] and 34 guests