From e90b28895cc28daf1a2e4fb772bd191400cf9e62 Mon Sep 17 00:00:00 2001
From: fgrosswig <falk@grosswig.de>
Date: Mon, 06 Jan 2020 21:50:15 +0100
Subject: [PATCH] battery_box.lua: Make "srcstack" local (#525)

---
 technic/machines/register/battery_box.lua |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua
index 84e992c..bf4d96a 100644
--- a/technic/machines/register/battery_box.lua
+++ b/technic/machines/register/battery_box.lua
@@ -18,7 +18,7 @@
 	output = "technic:battery",
 	recipe = {
 		{"group:wood", "default:copper_ingot", "group:wood"},
-		{"group:wood", "moreores:tin_ingot",   "group:wood"},
+		{"group:wood", "default:tin_ingot",    "group:wood"},
 		{"group:wood", "default:copper_ingot", "group:wood"},
 	}
 })
@@ -129,11 +129,11 @@
 }
 
 local function add_on_off_buttons(meta, ltier, charge_percent)
-	local formspec = ""
-	if ltier == "mv" or ltier == "hv" then
-		formspec = "image[1,1;1,2;technic_power_meter_bg.png"
+	local formspec = "image[1,1;1,2;technic_power_meter_bg.png"
 			.."^[lowpart:"..charge_percent
-			..":technic_power_meter_fg.png]"..
+			..":technic_power_meter_fg.png]"
+	if ltier == "mv" or ltier == "hv" then
+		formspec = formspec..
 			fs_helpers.cycling_button(
 				meta,
 				"image_button[3,2.0;1,0.6",
@@ -255,8 +255,9 @@
 
 		local charge_percent = math.floor(current_charge / max_charge * 100)
 		meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, charge_percent))
-		local infotext = S("@1 Battery Box: @2/@3", tier,
-				technic.pretty_num(current_charge), technic.pretty_num(max_charge))
+		local infotext = S("@1 Battery Box: @2 / @3", tier,
+				technic.EU_string(current_charge),
+				technic.EU_string(max_charge))
 		if eu_input == 0 then
 			infotext = S("%s Idle"):format(infotext)
 		end
@@ -451,7 +452,7 @@
 	if inv:is_empty("dst") then
 		return batt_charge, false
 	end
-	srcstack = inv:get_stack("dst", 1)
+	local srcstack = inv:get_stack("dst", 1)
 	local toolname = srcstack:get_name()
 	if technic.power_tools[toolname] == nil then
 		return batt_charge, false

--
Gitblit v1.8.0