[Mod] Realistic woodcut

Post Reply
User avatar
SurekUr
New member
Posts: 5
Joined: Wed Jan 02, 2019 14:34
In-game: SurekUr

[Mod] Realistic woodcut

by SurekUr » Post

Hello Minetesters!

This is my first post here. :D

This is my own solution for the floating tree problem.
If you are digging a node from a tree, an algorithm checking which parts of the tree are still connected to the ground (Any node which belongs to the "soil group") . That part of the tree what is not connected to the ground will fall like a falling node, and leaves are falling like a dropped item.

Right now this mod only support the tree types from default.
Should be work with every mod comes with new tree types, thanks to Krock.


If you dig a bottommost node(s) of a tree, and nothing happened it's because the tree is connected to a neighbour tree by a limb.
Mod is attached to this post:
woodcut.zip
(2.58 KiB) Downloaded 114 times
Minetest version requires: 5.0 or above
depends: Nothing

License: Beerware License
Feel free to report bugs, make suggestions, and enjoy wood cutting!
Happy New Year! God bless you!
Last edited by SurekUr on Sun Jan 06, 2019 01:18, edited 6 times in total.

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Realistic woodcut

by MCL » Post

What license?
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

User avatar
SurekUr
New member
Posts: 5
Joined: Wed Jan 02, 2019 14:34
In-game: SurekUr

Re: [Mod] Realistic woodcut

by SurekUr » Post

migdyn wrote:What license?
Public Domain. Do what you want with it. Mention the author is nice, but not important.

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Realistic woodcut

by MCL » Post

SurekUr wrote:
migdyn wrote:What license?
Public Domain. Do what you want with it. Mention the author is nice, but not important.
Public Domain is not a license.
https://www.linuxjournal.com/article/6225
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

User avatar
SurekUr
New member
Posts: 5
Joined: Wed Jan 02, 2019 14:34
In-game: SurekUr

Re: [Mod] Realistic woodcut

by SurekUr » Post

migdyn wrote:
SurekUr wrote:
migdyn wrote:What license?
Public Domain. Do what you want with it. Mention the author is nice, but not important.
Public Domain is not a license.
https://www.linuxjournal.com/article/6225
Oh, Thank you! :D
I know its not a license but I I thought I can simply state it is in the public domain its will be in. :D Then the license is Beerware License. (Its simple and GPL compatible) I will attach the license to the download soon.
Thank you for your help!

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Realistic woodcut

by MCL » Post

You're welcome!
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Realistic woodcut

by Krock » Post

Beerware? It clearly lacks of a warranty disclaimer but if you like beer, it's surely a welcome license.

I've downloaded your mod five minutes after publishing, extended it to apply to any other tree as well. After all I spent a minute modding your mod and hours into cleaning up and testing the horribly slow biome_lib for moretrees.

Fast forward, this is what I got: (giant sequoia didn't work for some reason)
Image

EDIT: The code I used (requires 5.0.0-dev or newer):

Code: Select all

-- END of function calculate_cuting

local function make_wrapper(node_name)
	local old_destruct = minetest.registered_nodes[node_name].after_destruct
	return function(pos, oldnode)
		old_destruct(pos, oldnode)
		calculate_cuting(pos, oldnode)
	end
end

minetest.register_on_mods_loaded(function()
	local count = 0
	for name, def in pairs(minetest.registered_nodes) do
		if def.groups and def.groups.tree then
			-- No C++ bindings: override directly
			def.after_destruct = make_wrapper(name)
			count = count + 1
		end
	end
	print("[woodcut] Found " .. count .. " tree nodes")
end)
Attachments
screenshot_20190102_232845.png
screenshot_20190102_232845.png (544.23 KiB) Viewed 815 times
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
SurekUr
New member
Posts: 5
Joined: Wed Jan 02, 2019 14:34
In-game: SurekUr

Re: [Mod] Realistic woodcut

by SurekUr » Post

Im sorry for long reaction time, but I have not too much time during exams, and dont want to come with empty hands.
Krock wrote:Beerware? It clearly lacks of a warranty disclaimer
True. I will rethink it.

Krock wrote:I've downloaded your mod five minutes after publishing, extended it to apply to any other tree as well. After all I spent a minute modding your mod and hours into cleaning up and testing the horribly slow biome_lib for moretrees.
I tried the code with your update. Your code is very nice and elegant! You made the mod compatible every existing and future tree mod. Thank you! :D (-> depends.txt deleted :D)
Krock wrote:Fast forward, this is what I got: (giant sequoia didn't work for some reason)
Hehe! Maybe I was too optimistic when I chose the name "Realistic" :P I downloaded and tried moretrees. The problem with giant sequolia: It seems to be minetest dont execute lua scripts in its main cycle, but in a different thread. So if a lua function executed too slow its effect dont come instantly, while the game still runs, players can move, physics works etc... So its worked but very slow (Giantsequlia is a true monstrum...). To solve this i added a little performance boost (Ok just corigated something that I did wrong. But it should be much faster, in a case off huge trees.). I also modified my fall_isle() function to avoid remaining leaf nodes, and added some comment to my code.
Thank you for your help and time!

Image
Attachments
woodcut giant.png
woodcut giant.png (896.75 KiB) Viewed 815 times

User avatar
Oblivious
Member
Posts: 14
Joined: Thu Aug 09, 2018 13:35
In-game: Brielle

Re: [Mod] Realistic woodcut

by Oblivious » Post

I tied this and got an error while loading them game. Says it failed to load and run script. Attempted to cal something. Start traceback. And it specifically mentioned lua:239. (I'm not good with the technical side.)

I've got the two files init.lua and the licence in ...mods/woodcut. Is that correct?

I really want to get it work, because I hope it'll work with the tree in the Australia mod. They can be huger than the giant sequoias and the leaves don't fall naturally which makes them a pain.

User avatar
SurekUr
New member
Posts: 5
Joined: Wed Jan 02, 2019 14:34
In-game: SurekUr

Re: [Mod] Realistic woodcut

by SurekUr » Post

Oblivious wrote:I tied this and got an error while loading them game. Says it failed to load and run script. Attempted to cal something. Start traceback. And it specifically mentioned lua:239. (I'm not good with the technical side.)

I've got the two files init.lua and the licence in ...mods/woodcut. Is that correct?

I really want to get it work, because I hope it'll work with the tree in the Australia mod. They can be huger than the giant sequoias and the leaves don't fall naturally which makes them a pain.
Yes you should have this 2 files only.
Can you send me the full error message you got?
What version of minetest you have? This mod only work with 5.0 or above.

User avatar
Oblivious
Member
Posts: 14
Joined: Thu Aug 09, 2018 13:35
In-game: Brielle

Re: [Mod] Realistic woodcut

by Oblivious » Post

I didn't seem to be able to copy the error message, and I'm too lazy to type it out or figure out how to put a picture up.

I've got 4.16. I suppose it's time to learn to update. I'll let you know if there's still a problem after that.

edited to add: It seems the latest stable released version is 0.4.17.1. So I'm not getting myself 5 until it's fully released.

User avatar
ErrorNull
Member
Posts: 274
Joined: Thu Mar 03, 2016 00:43
GitHub: ErrorNull0

Re: [Mod] Realistic woodcut

by ErrorNull » Post

this is a great mod. i would love to see an option that we can enable/disable for players to take health damage if a wood block falls on them? ...but no damage for the leaves.

also, would it be more realistic for when the leaves fall to remain as block nodes? that way the player will still need to dig the leaves to pick it up. my reason for this idea is that in real life when you cut down a tree, you still need to go through the effort of chopping and cutting the leaves off to harvest it.

one more thing i noticed - the apple does not fall when the tree falls down. is it supposed to fall? or is this something you will be updating in the future? thanks.

Germain
Member
Posts: 42
Joined: Thu Aug 13, 2015 10:16

Re: [Mod] Realistic woodcut

by Germain » Post

ErrorNull wrote:this is a great mod. i would love to see an option that we can enable/disable for players to take health damage if a wood block falls on them? ...but no damage for the leaves.
[...]
There is a mod about this Falling item : https://notabug.org/TenPlus1/falling_item

Post Reply

Who is online

Users browsing this forum: freshreplicant and 34 guests