mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-26 04:23:44 +01:00
Fix fuel recipes not appearing
This commit is contained in:
parent
7ea6899b06
commit
74785bca5e
20
init.lua
20
init.lua
@ -29,6 +29,7 @@ local show_formspec = core.show_formspec
|
|||||||
local globalstep = core.register_globalstep
|
local globalstep = core.register_globalstep
|
||||||
local on_shutdown = core.register_on_shutdown
|
local on_shutdown = core.register_on_shutdown
|
||||||
local get_players = core.get_connected_players
|
local get_players = core.get_connected_players
|
||||||
|
local get_craft_result = core.get_craft_result
|
||||||
local translate = minetest.get_translated_string
|
local translate = minetest.get_translated_string
|
||||||
local on_joinplayer = core.register_on_joinplayer
|
local on_joinplayer = core.register_on_joinplayer
|
||||||
local get_all_recipes = core.get_all_craft_recipes
|
local get_all_recipes = core.get_all_craft_recipes
|
||||||
@ -560,6 +561,21 @@ local function get_filtered_items(player, data)
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_burntime(item)
|
||||||
|
return get_craft_result{method = "fuel", items = {item}}.time
|
||||||
|
end
|
||||||
|
|
||||||
|
local function cache_fuel(item)
|
||||||
|
local burntime = get_burntime(item)
|
||||||
|
if burntime > 0 then
|
||||||
|
fuel_cache[item] = {
|
||||||
|
type = "fuel",
|
||||||
|
items = {item},
|
||||||
|
burntime = burntime,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function show_item(def)
|
local function show_item(def)
|
||||||
return def and not (def.groups.not_in_craft_guide == 1 or
|
return def and not (def.groups.not_in_craft_guide == 1 or
|
||||||
def.groups.not_in_creative_inventory == 1) and
|
def.groups.not_in_creative_inventory == 1) and
|
||||||
@ -1514,6 +1530,10 @@ local function get_init_items()
|
|||||||
if name ~= "" and show_item(def) then
|
if name ~= "" and show_item(def) then
|
||||||
cache_drops(name, def.drop)
|
cache_drops(name, def.drop)
|
||||||
|
|
||||||
|
if not fuel_cache[name] then
|
||||||
|
cache_fuel(name)
|
||||||
|
end
|
||||||
|
|
||||||
if not recipes_cache[name] then
|
if not recipes_cache[name] then
|
||||||
cache_recipes(name)
|
cache_recipes(name)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user