Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Furnace only works if recipe's cooktime is 0 #1

Open
kakalak-lumberJack opened this issue Feb 21, 2019 · 1 comment
Open

Furnace only works if recipe's cooktime is 0 #1

kakalak-lumberJack opened this issue Feb 21, 2019 · 1 comment

Comments

@kakalak-lumberJack
Copy link

Minetest 5.0.0 (up to date, compiled on Linux) in stripped down custom game(few nodes registered for mapgen, not much else)
Steps to reproduce:

  1. Create Mod depending on simplecrafting_lib
  2. Register furnace:
local furn_def = {
    description = "Lab Furnace",
    tiles = {
        "default_steel.png", "default_steel.png",
        "default_steel.png","default_steel.png",
        "default_steel.png", "lab_furnace_ready.png"
    },
    paramtype2 = "facedir",
    groups = {oddly_breakable_by_hand = 1, cracky = 3},
    legacy_facedir_simple = true,
    is_ground_content = false,
    sounds = default.node_sound_stone_defaults(),    
}

local multifurn_def = {
    ["description"] = "Lab Furnace",
    ["show_guides"] = true,
    ["alphabetize_items"] = true,
    ["protect_inventory"] = true,
    ["active_node"] = "crafting:furnace_active"
}

local furn_functions = simplecrafting_lib.generate_multifurnace_functions("furnace", "fuel", multifurn_def)

for k, v in pairs(furn_functions) do
	furn_def[k] = v
end

minetest.register_node("crafting:furnace", furn_def)


minetest.register_node("crafting:furnace_active", {
    description = "Lab Furnace",
    tiles = {
      "default_steel.png", "default_steel.png",
      "default_steel.png","default_steel.png",
      "default_steel.png", "lab_furnace_working.png"
    },
    paramtype2 = "facedir",
	  light_source = 8,
	  groups = {not_in_creative_inventory=1, oddly_breakable_by_hand = 1},
	  legacy_facedir_simple = true,
	  is_ground_content = false,
	  sounds = default.node_sound_metal_defaults(),
})
  1. Register relevant crafts:
simplecrafting_lib.register("fuel", {
	input = {["crafting:fuel_cell"] = 1},
	burntime = 10.0,
})

simplecrafting_lib.register("furnace", {
	input = {["default:cave_ice"] = 1},
	output = {["default:water_source"]  = 1},
	cooktime = 20,
})

As such, furnace initiates, and swaps to active node but no product is produced, no fuel used, no inputs are taken. Debugging suggests that on_timer() in "templates/multifurnace.lua" is called once and then the node is stuck in active mode with nothing else happening. Inputs and fuels can be removed freely but the target_item is locked in.

However, if the "furnace" craft's cooktime = 0, the furnace then behaves basically as expected. If there is fuel the furnace continues to produce outputs as long as fuel is there. otherwise it produces only one output per on_receive_fields() (because no fuel is actually required.--which is a bit buggy in its self but at least shows that the problem seems to be in how the `on_timer()' function is handling burntime/cooktime.

Its possible that I am implementing something incorrectly as the docs are a little vague here but I've toyed with the mod and tweaked the code enough that I'm fairly sure there is some bug here. Just haven't been able to pinpoint exactly where the problem is. Thanks for any assistance.

@NathanSalapat
Copy link
Contributor

NathanSalapat commented Oct 18, 2020

I'm working through this issue currently, and it seems as if simplecrafting_lib.room_for_items(inv, "output", output) fails to return good data. I don't understand what that function does exactly, but for testing purposes I just set it to return true, and autocrafting now works as expected.
Furnaces don't show the output for most items, but some do. Interestingly clicking the show guide button shows everything, so I'm not sure what's going on there.
Really trying to get this to work on my server, will make a pull request if I can get it working.
Should mention that I'm working with the workshop mod that FaceDeer has for different workshops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants