mirror of
				https://github.com/mt-mods/homedecor_modpack.git
				synced 2025-11-04 14:25:32 +01:00 
			
		
		
		
	Fix locked ovens reverting to unlocked.
This commit is contained in:
		@@ -288,11 +288,15 @@ function homedecor.register_furnace(name, furnacedef)
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
 | 
			
		||||
			-- XXX: Quick patch, make it better in the future.
 | 
			
		||||
			local locked = node.name:find("_locked$") and "_locked" or ""
 | 
			
		||||
			local desc = minetest.registered_nodes[name..locked].description
 | 
			
		||||
 | 
			
		||||
			if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
 | 
			
		||||
				local percent = math.floor(meta:get_float("fuel_time") /
 | 
			
		||||
						meta:get_float("fuel_totaltime") * 100)
 | 
			
		||||
				meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
 | 
			
		||||
				hacky_swap_node(pos,name_active)
 | 
			
		||||
				hacky_swap_node(pos,name_active..locked)
 | 
			
		||||
				meta:set_string("formspec", make_formspec(furnacedef, percent))
 | 
			
		||||
				return
 | 
			
		||||
			end
 | 
			
		||||
@@ -312,7 +316,7 @@ function homedecor.register_furnace(name, furnacedef)
 | 
			
		||||
 | 
			
		||||
			if (not fuel) or (fuel.time <= 0) then
 | 
			
		||||
				meta:set_string("infotext",desc..S(": Out of fuel"))
 | 
			
		||||
				hacky_swap_node(pos,name)
 | 
			
		||||
				hacky_swap_node(pos,name..locked)
 | 
			
		||||
				meta:set_string("formspec", make_formspec(furnacedef, 0))
 | 
			
		||||
				return
 | 
			
		||||
			end
 | 
			
		||||
@@ -320,7 +324,7 @@ function homedecor.register_furnace(name, furnacedef)
 | 
			
		||||
			if cooked.item:is_empty() then
 | 
			
		||||
				if was_active then
 | 
			
		||||
					meta:set_string("infotext",S("%s is empty"):format(desc))
 | 
			
		||||
					hacky_swap_node(pos,name)
 | 
			
		||||
					hacky_swap_node(pos,name..locked)
 | 
			
		||||
					meta:set_string("formspec", make_formspec(furnacedef, 0))
 | 
			
		||||
				end
 | 
			
		||||
				return
 | 
			
		||||
@@ -328,7 +332,7 @@ function homedecor.register_furnace(name, furnacedef)
 | 
			
		||||
 | 
			
		||||
			if not inv:room_for_item("dst", cooked.item) then
 | 
			
		||||
				meta:set_string("infotext", desc..S(": output bins are full"))
 | 
			
		||||
				hacky_swap_node(pos, name)
 | 
			
		||||
				hacky_swap_node(pos, name..locked)
 | 
			
		||||
				meta:set_string("formspec", make_formspec(furnacedef, 0))
 | 
			
		||||
				return
 | 
			
		||||
			end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user