From eb36ea30dc65f1a29b37068d121d43e784d05398 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Thu, 15 Jun 2023 02:47:51 +0200 Subject: [PATCH] reuse hash that is asigned to variable anyway --- autocrafter.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autocrafter.lua b/autocrafter.lua index 111fc27..ea681fe 100644 --- a/autocrafter.lua +++ b/autocrafter.lua @@ -189,18 +189,17 @@ end -- note, that this function assumes allready being updated to virtual items -- and doesn't handle recipes with stacksizes > 1 local function after_recipe_change(pos, inventory) + local hash = minetest.hash_node_position(pos) local meta = minetest.get_meta(pos) -- if we emptied the grid, there's no point in keeping it running or cached if inventory:is_empty("recipe") then minetest.get_node_timer(pos):stop() - autocrafterCache[minetest.hash_node_position(pos)] = nil + autocrafterCache[hash] = nil meta:set_string("infotext", S("unconfigured Autocrafter")) inventory:set_stack("output", 1, "") return end local recipe = inventory:get_list("recipe") - - local hash = minetest.hash_node_position(pos) local craft = autocrafterCache[hash] if craft then