1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-05-11 21:30:22 +02:00

hash can be reused

since it is asigned to local var anyway, makes code
more compact and easier to read
This commit is contained in:
Luke aka SwissalpS 2023-06-11 03:16:33 +02:00
parent 9395013cde
commit 89d997d6bb

View File

@ -97,18 +97,18 @@ end
-- note, that this function assumes allready being updated to virtual items -- note, that this function assumes allready being updated to virtual items
-- and doesn't handle recipes with stacksizes > 1 -- and doesn't handle recipes with stacksizes > 1
local function after_recipe_change(pos, inventory) local function after_recipe_change(pos, inventory)
local hash = minetest.hash_node_position(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
-- if we emptied the grid, there's no point in keeping it running or cached -- if we emptied the grid, there's no point in keeping it running or cached
if inventory:is_empty("recipe") then if inventory:is_empty("recipe") then
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
autocrafterCache[minetest.hash_node_position(pos)] = nil autocrafterCache[hash] = nil
meta:set_string("infotext", S("unconfigured Autocrafter")) meta:set_string("infotext", S("unconfigured Autocrafter"))
inventory:set_stack("output", 1, "") inventory:set_stack("output", 1, "")
return return
end end
local recipe = inventory:get_list("recipe")
local hash = minetest.hash_node_position(pos) local recipe = inventory:get_list("recipe")
local craft = autocrafterCache[hash] local craft = autocrafterCache[hash]
if craft then if craft then