What's the point? ContentDB showed that there were no dependencies on ts_furniture even though it provided an API. I'll just add the woods for popular mods. Just make sure your wood is in the group wood
I tried to register the wood ("group wood" defined) of a not yet published mod with this code:
if minetest.get_modpath("tables_chairs") then
tables_chairs.register_furniture("terraria_for_valleys:beech_wood", "Beech Wood Planks")
tables_chairs.register_furniture("terraria_for_valleys:maple_wood", "Maple Wood Planks")
tables_chairs.register_furniture("terraria_for_valleys:oak_wood", "Oak Wood Planks")
tables_chairs.register_furniture("terraria_for_valleys:spruce_wood", "Spruce Wood Planks")
end
and got this error:
2024-06-02 16:02:39: ERROR[Main]: ModError: Failed to load and run script from /home/roland/minetest-5.8.0/minetest/bin/../mods/terraria_for_valleys/init.lua:
2024-06-02 16:02:39: ERROR[Main]: ...5.8.0/minetest/bin/../mods/terraria_for_valleys/init.lua:99: attempt to index global 'tables_chairs' (a nil value)
2024-06-02 16:02:39: ERROR[Main]: stack traceback:
2024-06-02 16:02:39: ERROR[Main]: ...5.8.0/minetest/bin/../mods/terraria_for_valleys/init.lua:99: in main chunk
If I additionally test
if minetest.global_exists("tables_chairs")
I get no error. So I can't access global value "tables_chairs" because the mod is present in folder but not yet loaded. I thought an API could help.
It doesn't work because there is no public API. tables_chairs is a local. I understand that you want to have furniture for your woods though and just made an update that adds universal wood support across mods and games.
If your game/mod added its wooden planks to the group "wood" it will now work out of the box with no extra work needed.
How can I register trees from other mods? An API-function would be helpful.
What's the point? ContentDB showed that there were no dependencies on ts_furniture even though it provided an API. I'll just add the woods for popular mods. Just make sure your wood is in the group wood
I tried to register the wood ("group wood" defined) of a not yet published mod with this code:
and got this error:
If I additionally test
I get no error. So I can't access global value "tables_chairs" because the mod is present in folder but not yet loaded. I thought an API could help.
It doesn't work because there is no public API. tables_chairs is a local. I understand that you want to have furniture for your woods though and just made an update that adds universal wood support across mods and games. If your game/mod added its wooden planks to the group "wood" it will now work out of the box with no extra work needed.
Please leave a positive review on the mod.