mt-mods / moretrees

Other
8 stars 11 forks source link

placing a sapling without `default` mod fails #45

Closed BuckarooBanzay closed 1 month ago

BuckarooBanzay commented 1 month ago

Still calls the default.sapling_on_place function from default: https://github.com/minetest/minetest_game/blob/master/mods/default/trees.lua#L455

2024-09-06 21:35:18: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'moretrees' in callback item_OnPlace(): /home/user/.minetest/mods/moretrees/node_defs.lua:508: attempt to index global 'default' (a nil value)
2024-09-06 21:35:18: ERROR[Main]: stack traceback:
2024-09-06 21:35:18: ERROR[Main]:   /home/user/.minetest/mods/moretrees/node_defs.lua:508: in function </home/user/.minetest/mods/moretrees/node_defs.lua:507>

Call places:

https://github.com/mt-mods/moretrees/blob/2c891e6c25753515ae15f9a453ae37a6cc65921b/node_defs.lua#L448

https://github.com/mt-mods/moretrees/blob/2c891e6c25753515ae15f9a453ae37a6cc65921b/node_defs.lua#L508

Possible solutions:

wsor4035 commented 1 month ago

someone no idea who should have removed https://github.com/mt-mods/moretrees/blob/master/README.md?plain=1#L11 in there pr as well

BuckarooBanzay commented 1 month ago

no big deal, i'm playing around with non-default worlds and other than that it looks good

i can do the code-part, i just need a decision :)

wsor4035 commented 1 month ago

already implementing a solution in xcompat/src/functions.lua

wsor4035 commented 1 month ago

done