From 00f61dfb81100094b64de06ca4e1ef73ef8bcd47 Mon Sep 17 00:00:00 2001 From: Tim <t4im@users.noreply.github.com> Date: Fri, 30 Jan 2015 05:09:20 +0100 Subject: [PATCH] rewrite extractor dye recipes, adding a few dyes and making it work better with the dye mod also preventing any issues if it is being run in a game without it --- technic/register.lua | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/technic/register.lua b/technic/register.lua index 38766d9..6a237f9 100644 --- a/technic/register.lua +++ b/technic/register.lua @@ -3,6 +3,7 @@ technic.receiver = "RE" technic.producer = "PR" +technic.producer_receiver = "PR_RE" technic.battery = "BA" technic.machines = {} @@ -43,8 +44,16 @@ end -- Wear down a tool depending on the remaining charge. -function technic.set_RE_wear(item_stack, item_load, max_load) - local temp = 65536 - math.floor(item_load / max_load * 65535) - item_stack.wear = tostring(temp) - return item_stack +function technic.set_RE_wear(itemstack, item_load, max_load) + if (minetest.registered_items[itemstack:get_name()].wear_represents or "mechanical_wear") ~= "technic_RE_charge" then return itemstack end + local temp + if item_load == 0 then + temp = 0 + else + temp = 65536 - math.floor(item_load / max_load * 65535) + if temp > 65535 then temp = 65535 end + if temp < 1 then temp = 1 end + end + itemstack:set_wear(temp) + return itemstack end -- Gitblit v1.8.0