From 701240bc3a17a73d73f3a96cd81e559d662ac42c Mon Sep 17 00:00:00 2001
From: Thomas Rudin <thomas@rudin.li>
Date: Sun, 09 Dec 2018 16:01:10 +0100
Subject: [PATCH] Quarry: Check for valid facedir to fix server freeze #465 (#466)

---
 technic/machines/register/battery_box.lua |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua
index f176395..d10b705 100644
--- a/technic/machines/register/battery_box.lua
+++ b/technic/machines/register/battery_box.lua
@@ -12,12 +12,59 @@
 technic.register_power_tool("technic:green_energy_crystal", 150000)
 technic.register_power_tool("technic:blue_energy_crystal", 450000)
 
+-- Battery recipes:
+-- Tin-copper recipe:
 minetest.register_craft({
-	output = 'technic:battery',
+	output = "technic:battery",
 	recipe = {
-		{'group:wood', 'default:copper_ingot', 'group:wood'},
-		{'group:wood', 'moreores:tin_ingot',   'group:wood'},
-		{'group:wood', 'default:copper_ingot', 'group:wood'},
+		{"group:wood", "default:copper_ingot", "group:wood"},
+		{"group:wood", "default:tin_ingot",    "group:wood"},
+		{"group:wood", "default:copper_ingot", "group:wood"},
+	}
+})
+-- Sulfur-lead-water recipes:
+-- With sulfur lumps:
+-- With water:
+minetest.register_craft({
+	output = "technic:battery",
+	recipe = {
+		{"group:wood",         "technic:sulfur_lump", "group:wood"},
+		{"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"},
+		{"group:wood",         "technic:sulfur_lump", "group:wood"},
+	},
+	replacements = {
+		{"bucket:bucket_water", "bucket:bucket_empty"}
+	}
+})
+-- With oil extract:
+minetest.register_craft({
+	output = "technic:battery",
+	recipe = {
+		{"group:wood",         "technic:sulfur_lump",   "group:wood"},
+		{"technic:lead_ingot", "homedecor:oil_extract", "technic:lead_ingot"},
+		{"group:wood",         "technic:sulfur_lump",   "group:wood"},
+	}
+})
+-- With sulfur dust:
+-- With water:
+minetest.register_craft({
+	output = "technic:battery",
+	recipe = {
+		{"group:wood",         "technic:sulfur_dust", "group:wood"},
+		{"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"},
+		{"group:wood",         "technic:sulfur_dust", "group:wood"},
+	},
+	replacements = {
+		{"bucket:bucket_water", "bucket:bucket_empty"}
+	}
+})
+-- With oil extract:
+minetest.register_craft({
+	output = "technic:battery",
+	recipe = {
+		{"group:wood",         "technic:sulfur_dust",   "group:wood"},
+		{"technic:lead_ingot", "homedecor:oil_extract", "technic:lead_ingot"},
+		{"group:wood",         "technic:sulfur_dust",   "group:wood"},
 	}
 })
 
@@ -208,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

--
Gitblit v1.8.0