minetest-mods / drinks

Adds a machine to juice fruits and veggies in Minetest
Other
8 stars 4 forks source link

can't initialize barrel or silo with a bucket #4

Closed NathanSalapat closed 7 years ago

NathanSalapat commented 7 years ago

This bug was introduced with the changes @todada made with their pull request, and I didn't catch them at the time. To initialize a juice storage device minetest does a nodelookup and gets a bit of data I added to the registration. It used to do a craftitemlookup, which also worked, unfortunately now we have drinks that are nodes and craftitems, and I don't know of any way to do the lookup. I think the buckets can be changed to nodes without much problem, but I don't understand exactly how the change was done by todada and everything I'm trying is ending in failure.

todada commented 7 years ago

Hi, I made a test just with plain minetest-game plus thirsty and the dev version (0.1.15-dev-55fb4db) and I didn't saw the problem using the code I transferred. I can add buckets, bottles and cups to both the silo and the barrel. Which environment are you using? Unfortunately I didn't had time to download your current version, I can only try it out tomorrow.

For my code changes: I tried to minimize the changes inventing 'drinks.register_item'. This copies a node definition (e.g. glass_bottle from minetest-game) and combines it with the table values coming from drinks. So there should be no magic behind this, I just wanted to avoid copying all the lines from the vessels mod. I would not change the buckets to nodes, as these are not available in mintest-game. I think it would feel a bit strange to have them in this mod (even if it's a nice idea also to have placeable buckets :).

NathanSalapat commented 7 years ago

The most recent version of this mod doesn't even register the buckets, so you may need to update the mod to see the problem. If you fill the barrel or silo with more than 8 cups of juice and then try to take it out with an empty barrel it will give an unknown item with a name of drinks:jbu_

I saw what your code changes were doing, though I didn't fully understand how it works, or why my trying to do it with the bucket didn't work. If we/you can get the buckets to register with the drinks.register_item code everything should work perfectly, but I couldn't get that to work, and that's what has me stumped.

todada commented 7 years ago

Function drinks.register_item is only intended for placeable nodes. It makes a copy the definition of an existing node (second parameter), and you just have to add the specific entries of the new one. Mainly to avoid copying over a lot of text. For buckets (or other craftitems) just leave register_craftitem as it was.

I took over your changes and corrected my PR. I'm still fiddling around with GIT, so I hope I checked it in the right way and you can easily get it from there. Otherwise have a look at my main branch.

And I added a group entry forgotten by me (you've found already the other one...) :(

NathanSalapat commented 7 years ago

I fixed the buckets, they are now registered as nodes, and can be placed, more importantly though they can be used to put the initial liquid into a barrel or silo.