Page 1 of 1

Bucket preservation when using lava buckets as fuel

PostPosted: Fri Jan 04, 2013 04:20
by hdastwb
One of the things that bugs me about using lava buckets in the furnace is that the bucket is always consumed in the process; it seems to me like a bit of a waste. I'm not sure what the "official" view of burning buckets along with the lava as fuel is, but in the mean time I managed to "fix" the issue and change the game's mods on my testing copy to consume only the lava and leave an empty bucket behind. I basically had to change two things:

1. I added support for craft formula replacements in the default mod by setting the output value of the fuel to the "decremented input" return value of get_craft_result rather than the input stack with one item removed:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
(around line 1500)

local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")

--to--

local fuel = nil
local afterfuel
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")


fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})

--to--

fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})


local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)

--to--

inv:set_stack("fuel", 1, afterfuel.items[1])


2. Then, I added a line to the fuel craft definition for the lava bucket in the bucket mod to replace the lava with an empty bucket:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
(line 103)

minetest.register_craft({
    type = "fuel",
    recipe = "bucket:bucket_lava",
    burntime = 60,
})

--to--

minetest.register_craft({
    type = "fuel",
    recipe = "bucket:bucket_lava",
    burntime = 60,
    replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})


In any case, something along the lines of the changes that I made to the default mod should probably be implemented in the official version so that other mods will be able to supply fuel to furnaces without using up containers. In this case, I'm not seeing any reason for burning the buckets along with the lava when smelting, but then the changes were easy enough to make that I wonder why no-one else seems to have made them yet…

PostPosted: Fri Jan 04, 2013 04:26
by jojoa1997
Can someone make a pull request flyer this

PostPosted: Fri Jan 04, 2013 04:34
by Chinchow
Before I knew the bucket was consumed I used it as fuel on a server went to the furnace no fuel I asked a friend if they moved it and they said they didn't touch it I was so confused

PostPosted: Fri Jan 04, 2013 18:07
by InfinityProject
+1 for this.

PostPosted: Fri Jan 04, 2013 18:16
by Obiewan1111
When you place a bucket of lava into the furnace, it should turn into a lava source and then you should get the bucket added to your inventory. And yeah.. That bugs me too.

PostPosted: Fri Jan 04, 2013 18:33
by kaeza
+32767 internetz
I hate this too

PostPosted: Sat Jan 05, 2013 13:46
by rarkenin
Very nice!

PostPosted: Sun Jan 06, 2013 02:11
by hdastwb
The pull request has been submitted; a response on GitHub should be forthcoming…

PostPosted: Tue Jan 08, 2013 01:25
by 4aiman
And I thought that was natural for iron to melt in the lava... That's before I read about lava temperature on Wiki...
Well, immortal bucket is not that bad after all ;)
+1

PostPosted: Tue Jan 08, 2013 04:57
by 0gb.us
Nice. I always thought using lave as a furnace fuel was a waste of precious iron. If this is included upstream, it won't have to be.

If it isn't implemented upstream, I might have to add it to my custom game ....

Re: Bucket preservation when using lava buckets as fuel

PostPosted: Tue Sep 30, 2014 21:08
by Johnny Joy
If multiple buckets are used as fuel will all the empty buckets be returned?

Re: Bucket preservation when using lava buckets as fuel

PostPosted: Tue Sep 30, 2014 23:08
by hdastwb
Johnny Joy wrote:If multiple buckets are used as fuel will all the empty buckets be returned?


This was brought up in the pull request discussion too: https://github.com/minetest/minetest_game/pull/105

Basically, there's no correct behavior in that case since there's only one fuel slot and there's two different types of things that would need to go in it (remaining fuel and spent fuel). However, this isn't much of an issue since it is not possible to use multiple buckets because buckets are non-stackable (or at least they weren't back when I was keeping closer track of Minetest; I haven't been paying as much attention to recent developments). However, if buckets are stackable now and you have an idea about what should happen to a stack of buckets when you put it in a furnace, you can always try implementing a different solution (the information on this thread and the pull request should give you a good idea where the fuel-consuming logic resides), submitting a pull request, and waiting two months like I did for someone to finally decide to merge it.

Re: Bucket preservation when using lava buckets as fuel

PostPosted: Wed Oct 01, 2014 03:35
by Johnny Joy
I'm looking at the ethanol fuel in the Farming Redo mod by tenplus1. The ethanol fuel is crafted using a glass bottle and corn. The resulting ethanol bottles can be stacked as fuel, but after the burn is over only one empty bottle remains. This renders the ethanol fuel moot.

Would there is a simple method to either just try and return the empty bottles to the player's inventory, or capture the number of bottles burned and replace with the correct number at the end of the burn?

I'm a long time programer, but no too experienced with minetest or loa, however loa does appear to be easy to get. With a few pointers I should be able to experiment effectively.

Thanks.

Re: Bucket preservation when using lava buckets as fuel

PostPosted: Wed Oct 01, 2014 03:53
by Johnny Joy
Seems to me that the furnace has 3 different inventories, fuel, src, and dst. Couldn't we just add a third for replacement items? I'm also going to look into dropping the replacements into dst, if I can.

Thanks, again.