[protomod] Treecapitator (tree falls down) [treecapitator]

Oil_boi
Member
Posts: 139
Joined: Mon Jan 28, 2019 13:12
GitHub: oilboi
IRC: oilboi
In-game: oilboi
Contact:

[protomod] Treecapitator (tree falls down) [treecapitator]

by Oil_boi » Post

Here is a mod which makes the trees fall down. Only default:tree, as this was a prototype for crafter.
Here is the download link
treecapitator.zip
(165.94 KiB) Downloaded 170 times
Here is a video: https://youtu.be/5rAYG0WrGvA

license GPLV2
This account is no longer active

User avatar
Walker
Member
Posts: 1816
Joined: Tue Oct 03, 2017 09:22
In-game: Walker
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by Walker » Post

O.o

WHAT !???!

the Video looks SOOOOO amazing ...

User avatar
FreeLikeGNU
Member
Posts: 280
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by FreeLikeGNU » Post

in the video, it looks great! Can't wait to see this work with more trees (and [more trees] too)!

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Im not sure if Oil_boi is still working on this protomod, I made some minor additions:
  • Supports all MTGame default tree types
  • Apples/Snow fall with the relevant trees
  • Changed drop to log,fruit/attached, leaves & sticks and lowered drop frequency on those last two
  • Axe...well tool should take wear, this will increase or decrease dpending on how many logs are in the tree
  • Tree will fall from cut point not base (not 100% yet)
  • Cutting individual tree nodes wont trigger "falling animation"
  • Cutting logs with no leaves wont trigger "falling animation"
I'm still trying to workout how to increase cut down time on the fly...Im also trying to see if the current code attached can support more trees if I can make that work (semi-reliably) I'll upload the code to git.

Consider the attached a sort of work in progress but with what I thought could be handy additions to just about make the code usable on at least base MTGame.
Attachments
treecapitator.zip
(168.06 KiB) Downloaded 89 times

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Not perfect but I think its a solid start and looking workable, I think these are the biggest trees so they take a bit of time to fall and they certainly make my computer work a bit. I might be able to fake it a little more and only add every 2nd leaf node to the entity and not worry about adding the branch logs.

The small issue of almost 300 logs per tree might create an over resource issue...but oddly very satisfying to cut down.

Hopefully slightly intresting to a few others as well :)

Image
Attachments
screenshot_20210221_213220.jpg
screenshot_20210221_213220.jpg (227.17 KiB) Viewed 3158 times

Termos
Member
Posts: 417
Joined: Sun Dec 16, 2018 12:50

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by Termos » Post

Nice one.
I bet there shouldn't be much of a problem with felling trees consisting of 300 nodes if done one at a time.

Couldn't resist the association: Trees Come Down
Last edited by Termos on Sun Feb 21, 2021 12:55, edited 1 time in total.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by ShadMOrdre » Post

sirrobzeroone,

This looks nice.

Should be easy to read dimensions from lua schems to auto configure tree data.

Shad

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

They come down okay just not quiet as smoothly as smaller trees, fairly sure it relates to the trees being built up from a bunch pf parent/child nodes into an entity...or i should say I think thats what it does I havent tinkered with that bit of the code and pulled it apart to understand it, so its blackbox to me at this point.

I'd hoped to use the schematic files to get shapes/dimensions but moretrees uses the L-System to define trees. My very basic understanding off the L-system, is you specify a tree using a bunch of characters which have different meanings (forward, rotate, place etc). Which actually makes things easier right upto the point the engine runs a random seed in someway over the config instructions making i think every tree unique? The api is a bit unclear on that point...the visual inspection Ive done of a number of trees seems to indicate they are all slightly random although they keep there overal shape, anyways great in game lots of unqiue trees...not so great for figuring out tree dimensions.

Anyways I shouldnt complain Oil_boi did all the hardwork Im very much just plugging into his solution....well hotwiring into his soln might be a better analogy not sure what Ive done is as elegant as a plug :)

Termos
Member
Posts: 417
Joined: Sun Dec 16, 2018 12:50

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by Termos » Post

sirrobzeroone wrote:
Mon Feb 22, 2021 08:49
I'd hoped to use the schematic files to get shapes/dimensions but moretrees uses the L-System to define trees.
An universal solution could be to travel upwards from the initial node trying to recursively find connected wood/leaf nodes within some limits, that way theoretically even hand built trees could be felled.

Are you planning to put it up on git or somewhere?

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Termos wrote:
Mon Feb 22, 2021 10:08
sirrobzeroone wrote:
Mon Feb 22, 2021 08:49
I'd hoped to use the schematic files to get shapes/dimensions but moretrees uses the L-System to define trees.
An universal solution could be to travel upwards from the initial node trying to recursively find connected wood/leaf nodes within some limits, that way theoretically even hand built trees could be felled.

Are you planning to put it up on git or somewhere?
Most definitly, Im going to get moretrees working roughly using the current process then upload to git, then look at adjusting how it functions in regards to "finding trees"....or someone else might beat me too it :)

Currently adding the rough tree config in for the rest of moretrees and making sure they at least sort of work 90/95% of the time. I dont mind leaving the odd leaf block behind but Im trying to get all trunk/log blocks.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

I've uploaded what I've done so far to git, I havent fully supported all tree types in moretrees. I need to go back and re-write/re-think the trunk identification code. I hadn't reliased some tree types in more trees use all 3 types (single, double and crossed). While doing that I'll clean up the top and bottom trunk position code at the moment its all done via estimating but I can adjust that as I do have bottom pos and top pos, that will stop the trunk falling overshooting.

I uploaded the orginal code from Oil_boi 1st then my zipped code above next then my latest code just to keep the history intact. I did a release version for each so: v0.3 supported trees although some are glitchy and its more a yes it sort of works type concept:
  • Beech Tree
  • Apple Tree
  • Oak Tree
  • Poplar Tree
  • Sequoi Tree
  • Birch Tree
  • Spruce Tree
  • Cedar Tree
  • Willow Tree
I'm off to do a partial re-write now and cleanup to support moretrees more :)

u18398

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by u18398 » Post

This is super cool ! Trees falling like in real and it works. I did not really suspect this to happen so I was super surprised after my first cut that the really fall :D

I do not know if that is only me, but there are no saplings dropped ?
And a mod.conf file would be helpful, so you do not have to rename the mod folder to 'treecapitator' after
cloning from github :)

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Gundul wrote:
Sat Feb 27, 2021 15:49
This is super cool ! Trees falling like in real and it works. I did not really suspect this to happen so I was super surprised after my first cut that the really fall :D

I do not know if that is only me, but there are no saplings dropped ?
And a mod.conf file would be helpful, so you do not have to rename the mod folder to 'treecapitator' after
cloning from github :)
Full credit to Oil_boi for making them fall, I keep looking at his code and it's very elegant for what it achieves or at least to me it is :).

Next version I've added saplings to the drops and lowered the leaves drop a little more, additionally although not sure if it will make next version but I also want the drops to fly out along the fall direction at the moment it's centered around the base. As well as try and work on the detect ground as it falls using raytracing Oil_boi orginally mentioned up in post one (maybe it was in the youtube video...) but thats definitly not in the next version, so far everytime I've tried to use raytracing its been a fairly dismal failure. I'll also fix up the naming etc I'd forgotten about that :).

Taken me longer than I thought to work out how to reliably detect nodes around nodes in a specific shape but I have what I think is a reliable way thats not to heavy on the checking. Anyways slow going on the code as I dont get much time to do code with life etc :).

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by ShadMOrdre » Post

sirrobzeroone,

So I have 160 different tree types, each with 1 to 4 models, all in lua schematic form. A lua schem is a table with three elements, size, data, and y_slice. The y_slice is optional. The size element easily defines size of the "box". The data element is a 1D table of values.

Using the size elements, reading the data element to obtain placement values for the code written by Oil_boi shouldn't be too much more difficult. It appears that code creates entities for each tree trunk node, and possibly some leaves. I can look a little more deeply to see how much would be involved, but I gotta say, being able to chop down any tree like this is just awesome.

I'm down for enabling the felling of all the trees I've accumulated. All default, moretrees, treelib, trees, cooltrees, australia, aotearoa, valleys_c, and ethereal trees. Mushrooms also, from ethereal, caverealms, realms mods and a model or two from the legendofminetest and farlands games. Cactii would also be a welcome addition. What about underwater coral "trees", which I've implemented in my GAL project?

Ideas?

Shad

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

ShadMOrdre wrote:
Tue Mar 02, 2021 05:53
Ideas?
Shad
Thanks Shad,

You have nailed how it works basically swap out tree for entity and watch it fall as an on_step. The schematic trees are actually the easy ones to deal with as I could just read the schematic although I guess you would need to compare a certain %/num of nodes to make sure its the same tree.

The L system trees though...sigh those are more of a headache so I've invertantly tackled those 1st as moretrees uses L-trees. Although plus side once L-Trees are sorted no need to worry about schematics (except to grab config data).

My approach so far for trees with multi-sized trunks which is single trunk, 2x2 trunk, X trunk and 3x3 trunk.

~ Get a 5x5 grid of nodes around the cut node (in the center) were the nodes around our cut node name match, no match == nil(0), match populate == pos/coords. 1st grid below numbers were just my thinking/notes

Code: Select all

	Grid 				Plus/Minus X/Z				 Array Pos Num
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+
| 5 | 4 | 3 | 4 | 5 |  | -2x +2z | -1x +2z | 0x +2z | +1x +2z | +2x +2z |  | 21 | 22 | 23 | 24 | 25 |
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+
| 4 | 2 | 1 | 2 | 4 |  | -2x +1z | -1x +1z | 0x +1z | +1x +1z | +2x +1z |  | 16 | 17 | 18 | 19 | 20 |
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+
| 3 | 1 | T | 1 | 3 |  | -2x 0z  | -1x 0z  | 0x 0z  | +1x 0z  | +2x 0z  |  | 11 | 12 | 13 | 14 | 15 |
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+
| 4 | 2 | 1 | 2 | 4 |  | -2x -1z | -1x -1z | 0x -1z | +1x -1z | +2x -1z |  |  6 |  7 |  8 |  9 | 10 |
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+
| 5 | 4 | 3 | 4 | 5 |  | -2x -2z | -1x -2z | 0x -2z | +1x -2z | +2x -2z |  |  1 |  2 |  3 |  4 |  5 |
+---+---+---+---+---+--+---------+---------+--------+---------+---------+--+----+----+----+----+----+ 
~ That gives me a nice array that is basically a cross section which would fit any of the size trunks avaliable in any orientation inside that cross section. Grid2 and Grid3 is just me converting to position offset and then lastly how the array is populated.
~ I have arrays setup with the known positions for example with double trunks they can only appear in certain places (see below for array pos numbers), I dont store position 13 as I already have that pos (node that was cut) and its true for the trunk piece/type:

Code: Select all

local dbl_trk ={{8,9,14},{7,8,12},{12,17,18},{14,18,19}}
~I then cross ref Array Pos and dbl_trk array if the Array Pos has positions in all those locations bingo found a 2x2 trunk. I do the check in size order so 3x3>>X trunk>>2x2>>Single

Works so far although jungle trees are giving me a bit of headache as they grow all over each other which when they get to dense, my pattern picking code dosent cope so well....but those are a bit of an odd exception. I also cleaned up the entity spawning, in the current version I just treat anything outside a single 1x1 trunk as a branch but then you have to have branches coming the ground, so thats been corrected.

I hope that makes some sense and I have no idea if it was most effcient way to identify unknown trunk sizes. I'v encountered quiet a few hicups especially with Jungle trees, to be honest those are the toughest trees other than Palms in more trees. I guess the only downside to the above is that I do at the moment need to configure trees however it shouldnt be hard to plug into schematic files to get the values needed instead of configuring them by hand. Its really only L-trees that need that hand config, although again you could backward workout the tree dimesions from the L settings but that might be more trouble than its worth.

edit: i forgot to mention the above check only happens on the 1st node cut from a trunk at that Y, After that I store all the trunk positions inside the meta of each node that makes up the whole trunk at that Y hieght. That way I can easily check if the last trunk node has been removed/cut and then tree can fall.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

I havent done a new release but I've uploaded my weeks worth of code, feel free to try it out, hopefully I havent stuffed anything up during upload:

https://github.com/sirrobzeroone/Falling_Tree_Capitator
https://github.com/sirrobzeroone/Fallin ... e/main.zip

I had another go at identifying trunks, so a bit closer to working for all moretrees trees, Palms and Fir still dont work although I think fir will work with the functionality I put in for Jungle trees, although dimensionally they are more of a hassle.

I need to improve the branch/leaf/fruit(attachments) code, I have the settings there but havent pushed them through the code to improve accuracy.

I'll keep going I do want to try and lift settings/tree diemsnions from schematic files as well.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

ShadMOrdre wrote:
Tue Mar 02, 2021 05:53

So I have 160 different tree types, each with 1 to 4 models, all in lua schematic form. A lua schem is a table with three elements, size, data, and y_slice. The y_slice is optional. The size element easily defines size of the "box". The data element is a 1D table of values.

Shad
Hi Shad, was going to Pm but you have that disabled :).

I was having a look at Lib ecology to see what I could tap into to get the tree config data or at least the size dimensions. As you said all handly stored at the top of the scematic files for each tree type. Is it possible for me to call or use: https://github.com/ShadMOrdre/lib_ecolo ... lookup.lua in someway to retrieve the data I need from each schematic file? or si this already stored in a lib ecology global table somewhere I could tap into?

Appreciate the pointer in the easy direction to get the X/Y/Z box size for each tree schematic, Im off to clean up more untidy code Ive written but I need something intresting to try as well not just code cleanup :).

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

I think I might have it - just need to lookup registered decorations def's and then I can sift through for size of any registered tree decorations.

I'll see how I go, I'd like to see if I can get the mod to be able to self-configure around tree size shape/drops and other refs I currently have manually configured and as much as possible not be dependeant on default I think at the moment I just use default:stick from default, I know I can get drop from leaves node defs although default dosent drop sticks....

Plenty to try.

Edit:
Im not sure if someone else might find this useful info as a starter to getting access to the schematic files, the below example reads the schematic file path from the decorations setting (my example is focused on decorations with the word tree in them), then it pulls the full schematic info in as a lua table and finally I just output the name and size to debug but you could change that line to "minetest.debug(dump(schematic))" to see the whole structure:

Code: Select all

for k,v in pairs(minetest.registered_decorations) do
	if string.find(k, "tree") then
		local schem_filepath = v.schematic
		local schematic = minetest.read_schematic(schem_filepath, "all")
		minetest.debug(k.." x:"..schematic.size.x.." y:"..schematic.size.y.." z:"..schematic.size.z)
	end
end
Output in debug

Code: Select all

2021-03-07 10:04:59: [Main]: default:pine_tree x:5 y:16 z:5
2021-03-07 10:04:59: [Main]: default:aspen_tree x:5 y:14 z:5
2021-03-07 10:04:59: [Main]: default:small_pine_tree x:5 y:12 z:5
2021-03-07 10:04:59: [Main]: default:jungle_tree(swamp) x:5 y:17 z:5
2021-03-07 10:04:59: [Main]: default:acacia_tree x:9 y:9 z:9
2021-03-07 10:04:59: [Main]: default:emergent_jungle_tree x:7 y:37 z:7
2021-03-07 10:04:59: [Main]: default:apple_tree x:7 y:8 z:7
2021-03-07 10:04:59: [Main]: default:jungle_tree x:5 y:17 z:5
Last edited by sirrobzeroone on Mon Mar 08, 2021 03:12, edited 1 time in total.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Dosen't look like much below but I've managed to read all the settings in for the MTG trees for acacia, apple, aspen from their schematic files and registered decoration settings.

Heres the apple example output:

Code: Select all

2021-03-07 22:32:07: [Main]: 392 x:7 y:8 z:7
2021-03-07 22:32:07: [Main]: tree height: 5
2021-03-07 22:32:07: [Main]: tree type: s
2021-03-07 22:32:07: [Main]: tree leaves: default:leaves
2021-03-07 22:32:07: [Main]: tree leaf width: 3
2021-03-07 22:32:07: [Main]: tree leaf height: 3
2021-03-07 22:32:07: [Main]: tree branch above trunk top: 1
2021-03-07 22:32:07: [Main]: tree branch below trunk top: 0
2021-03-07 22:32:07: [Main]: tree branch wide: 1
2021-03-07 22:32:07: [Main]: tree fruit: default:apple
2021-03-07 22:32:07: [Main]: tree fruit above trunk top: 0
2021-03-07 22:32:07: [Main]: tree fruit below trunk top: 0
2021-03-07 22:32:07: [Main]: tree sapling: default:sapling
Doing this I had to twist the schematic file so it was oriented into X/Z slices just easier for my brain to work with than Y slices its natively stored in. Below is the Apple tree, Slice1= ground slice and so on up; A=Air, T= Trunk, L = Leaves and F=Fruit/Attached.

Code: Select all

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=1
2021-03-07 22:35:58: [Main]: 
 A A A A A A A
 A A A A A A A
 A A A A A A A
 A A A T A A A
 A A A A A A A
 A A A A A A A
 A A A A A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=2
2021-03-07 22:35:58: [Main]:  
 A A A A A A A
 A A A A A A A
 A A A A A A A
 A A A T A A A
 A A A A A A A
 A A A A A A A
 A A A A A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=3
2021-03-07 22:35:58: [Main]:
 A A A A A A A
 A A A A A A A
 A A A A A A A
 A A A T A A A
 A A A A A A A
 A A A A A A A
 A A A A A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=4
2021-03-07 22:35:58: [Main]: 
 A A A A A A A
 A A A A A A A
 A A A A A A A
 A A A T A A A
 A A A A A A A
 A A A A A A A
 A A A A A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=5
2021-03-07 22:35:58: [Main]: 
 A A L L L A A
 A L L F L L A
 L L T A A L L
 L F A T A F L
 L L A A T L L
 A L L F L L A
 A A L L L A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=6
2021-03-07 22:35:58: [Main]: 
 A A A L A A A
 A L L L L L A
 A L L A T L A
 L L A A A L L
 A L T A L L A
 A L L L L L A
 A A A L A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=7
2021-03-07 22:35:58: [Main]: 
 A A A A A A A
 A A L L L A A
 A L L L L L A
 A L L L L L A
 A L L L L L A
 A A L L L A A
 A A A A A A A

2021-03-07 22:35:58: [Main]: X/Z Slice: Y=8
2021-03-07 22:35:58: [Main]: 
 A A A A A A A
 A A A A A A A
 A A A L A A A
 A A L L L A A
 A A A L A A A
 A A A A A A A
 A A A A A A A
I'll run some further tests over the coming week and see if I can read in the GAL project tree schematics.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

I've been playing around with registering on load,

I dont think its going to be viable I ran the larch tree through from cool_trees x/z=11 and y=17. Number of enteries to read from MTS is 11x11x17 = 2057 for one tree which takes a fair bit of time to process through on load. Im not sure were the slow point is yet Ill have to set some timers but if its coming out of the schemtic dump I do and then catagorizing each node i dont think theres much I can do - I have bad feeling thats the slow point.

However I think I might rework what ive done as a utility file then me or "tree_mod author" can run the utility mod once get the settings outputted to a nice clean lua file then I'll write a register function and you can just read the config file in from one line of code from either inside the tree mod or I can directly from this mod if I've run the file. Semi-flexible for changes and supporting new tree mods but not fully dynamic but no slow down on load each time for players for items that change rarely.


Edit: Okay strike that I speed it up a heap I ditched two loops that were checking for existing values and instead wrote the values as keys to a table with a junk value of 1.

This

Code: Select all

if grp.leaves == 1 then								
    nt_name = "L"
    if #leaves == 0 then									
        table.insert(leaves,schematic.data[i].name)	
    else
         for k,v in pairs(leaves) do														
		if v ~= schematic.data[i].name then					
			table.insert(leaves,schematic.data[i].name)
		end

	end
end
to this

Code: Select all

local temp_name = schematic.data[i].name
if grp.leaves == 1 then
      nt_name = "L"
      leaves[temp_name] = 1 
end 

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Busy few days, so havent had a chance to work on this much.

However I have got the auto-registeration for schematic trees working okay, I have a slight bug in the fruit throwing which I need to track down. Also need to add some smarts to the tree reg so if it finds the tree name again the code does something at the moment it just discards the data.

I have it working against cool_trees, default and moretrees at the moment. I need to figure out why I cant get lib_ecology to fire up then I'll work on the code additions for that.

Once I sort this fruit problem out i'll drop some new code up onto git

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

I had to rethink some of my table structures which meant a bit of code rework. I"m hoping with what I've done and how I've structured it now I can more easily support tree mods out of the box, although I still cant get lib_ecology to run and I need to have a think about L-System trees.

I've rolled back support for moretrees in this release but Default and Cool_trees (v4.10) are fully working (from what I can tell). Still treat this as experimental/pre-release its far from stable and theres redundant code still in a number of spots. I didnt get any horrible crashes runnign around chopping trees down but thats not to say they arent there.

Fix's etc
  • Drop Saplings at a rate of 1 per 20 leaves
  • Tree parts are distributed/thrown in the direction the tree fell
  • First working version of auto-registeration of schematic trees, both mts and lua
  • Heaps of code tweaks
https://github.com/sirrobzeroone/fallin ... es/tag/0.4

cool_trees here:viewtopic.php?t=22356

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

The master on git now supports all the trees in moretrees (coconut and fir trees are still a bit dodgy but do work), cooltrees, default and if you really want to give it a try lib_ecology. But I make no gaurentees every tree is working correctly in lib_ecology yet lots of tree types and sizes to test :).

https://github.com/sirrobzeroone/falling_tree_capitator

Edit_1 - Mon 22nd March 10:10pm UTC
Maple_Tree from more trees now works - auto-registering of schematics now better supports trees were the Trunk is not in the middle of the Schematic file.

Vindelle_Pounze
Member
Posts: 26
Joined: Thu Jan 05, 2017 22:06

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by Vindelle_Pounze » Post

Hi,
I have some error to report. In a freshly created world (on Minetest 5.4) with just this mod (from git as of today) I get this error message:

Code: Select all

2021-03-25 11:10:09: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback node_on_dig(): ...rincewind/.minetest/mods/falling_tree_capitator/init.lua:572: attempt to perform arithmetic on field 'tree' (a nil value)
2021-03-25 11:10:09: ERROR[Main]: stack traceback:
2021-03-25 11:10:09: ERROR[Main]: 	...rincewind/.minetest/mods/falling_tree_capitator/init.lua:572: in function 'bvav_create_vessel'
2021-03-25 11:10:09: ERROR[Main]: 	...rincewind/.minetest/mods/falling_tree_capitator/init.lua:67: in function <...rincewind/.minetest/mods/falling_tree_capitator/init.lua:54>
2021-03-25 11:10:09: ACTION[Server]: singleplayer leaves game. List of players: 
2021-03-25 11:10:09: ACTION[Main]: Server: Shutting down
In a different world with some mods present I got the same crash but just when I did not use an axe, otherwise it did work as expected. So I created the new one to be sure that it's not a problem with a conflicting mod or something.
In the new world it does not work no difference if I use an axe or bare hands. I can dig the tree from the top, though. The crash seems to only occur when there is more than one piece of tree above the one I am trying to dig.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [protomod] Treecapitator (tree falls down) [treecapitator]

by sirrobzeroone » Post

Vindelle_Pounze wrote:
Thu Mar 25, 2021 10:36
Hi,
I have some error to report. In a freshly created world (on Minetest 5.4) with just this mod (from git as of today) I get this error message:

Code: Select all

2021-03-25 11:10:09: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback node_on_dig(): ...rincewind/.minetest/mods/falling_tree_capitator/init.lua:572: attempt to perform arithmetic on field 'tree' (a nil value)
2021-03-25 11:10:09: ERROR[Main]: stack traceback:
2021-03-25 11:10:09: ERROR[Main]: 	...rincewind/.minetest/mods/falling_tree_capitator/init.lua:572: in function 'bvav_create_vessel'
2021-03-25 11:10:09: ERROR[Main]: 	...rincewind/.minetest/mods/falling_tree_capitator/init.lua:67: in function <...rincewind/.minetest/mods/falling_tree_capitator/init.lua:54>
2021-03-25 11:10:09: ACTION[Server]: singleplayer leaves game. List of players: 
2021-03-25 11:10:09: ACTION[Main]: Server: Shutting down
In a different world with some mods present I got the same crash but just when I did not use an axe, otherwise it did work as expected. So I created the new one to be sure that it's not a problem with a conflicting mod or something.
In the new world it does not work no difference if I use an axe or bare hands. I can dig the tree from the top, though. The crash seems to only occur when there is more than one piece of tree above the one I am trying to dig.
hmm odd, let me give 5.4 a try, I've been for the most part developing against 5.3 so its possible a minor change in 5.4.

So I could beat an acacia tree down in 5.4 no worries try the git master copy its a bit more cutting edge but might be a little more reliable in 5.4 - What tree type were you attempting to cut down, wasnt jungle tree per chance?

https://github.com/sirrobzeroone/fallin ... s/main.zip

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests