[Mod] Realistic woodcut

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

[Mod] Realistic woodcut

by SurekUr » Wed Jan 02, 2019 18:00

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 23 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
migdyn
Member
 
Posts: 253
Joined: Mon Aug 20, 2018 00:44
Location: A non-existing flat forest on flat earth
GitHub: migdyn
In-game: migdyn
 

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

Re: [Mod] Realistic woodcut

by SurekUr » Wed Jan 02, 2019 18:35

migdyn wrote:What license?

Public Domain. Do what you want with it. Mention the author is nice, but not important.
 

User avatar
migdyn
Member
 
Posts: 253
Joined: Mon Aug 20, 2018 00:44
Location: A non-existing flat forest on flat earth
GitHub: migdyn
In-game: migdyn

Re: [Mod] Realistic woodcut

by migdyn » Wed Jan 02, 2019 19:46

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
 

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

Re: [Mod] Realistic woodcut

by SurekUr » Wed Jan 02, 2019 20:50

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
migdyn
Member
 
Posts: 253
Joined: Mon Aug 20, 2018 00:44
Location: A non-existing flat forest on flat earth
GitHub: migdyn
In-game: migdyn
 

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

Re: [Mod] Realistic woodcut

by Krock » Wed Jan 02, 2019 22:30

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
(544.23 KiB) Not downloaded yet
>> 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 » Sun Jan 06, 2019 01:05

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
(896.75 KiB) Not downloaded yet
 

Oblivious
New member
 
Posts: 6
Joined: Thu Aug 09, 2018 13:35
In-game: Brielle

Re: [Mod] Realistic woodcut

by Oblivious » Mon Jan 07, 2019 22:39

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 » Tue Jan 08, 2019 14:20

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.
 

Oblivious
New member
 
Posts: 6
Joined: Thu Aug 09, 2018 13:35
In-game: Brielle

Re: [Mod] Realistic woodcut

by Oblivious » Wed Jan 09, 2019 10:37

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.
 


Return to WIP Mods



Who is online

Users browsing this forum: Exabot [Bot] and 2 guests