From 7cfb3874a381d5923611242b4cf7756d86049def Mon Sep 17 00:00:00 2001 From: Kevin Zheng <kevinz5000@gmail.com> Date: Wed, 06 Aug 2014 19:08:48 +0200 Subject: [PATCH] Evenly distribute charge across multiple batteries --- technic/machines/MV/power_radiator.lua | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/technic/machines/MV/power_radiator.lua b/technic/machines/MV/power_radiator.lua index 2617578..4f9a837 100644 --- a/technic/machines/MV/power_radiator.lua +++ b/technic/machines/MV/power_radiator.lua @@ -43,7 +43,7 @@ technic.inductive_on_punch_off = function(pos, eu_charge, swapnode) local meta = minetest.get_meta(pos) if meta:get_string("has_supply") ~= "" then - hacky_swap_node(pos, swapnode) + technic.swap_node(pos, swapnode) meta:set_int("active", 1) meta:set_int("EU_charge",eu_charge) --print("-----------") @@ -56,7 +56,7 @@ technic.inductive_on_punch_on = function(pos, eu_charge, swapnode) local meta = minetest.get_meta(pos) - hacky_swap_node(pos, swapnode) + technic.swap_node(pos, swapnode) meta:set_int("active", 0) meta:set_int("EU_charge",eu_charge) --print("-----------") @@ -82,7 +82,7 @@ local nodename = minetest.get_node(pos1).name -- Swap the node and make sure it is off and unpowered if string.sub(nodename, -7) == "_active" then - hacky_swap_node(pos1, string.sub(nodename, 1, -8)) + technic.swap_node(pos1, string.sub(nodename, 1, -8)) meta1:set_int("active", 0) meta1:set_int("EU_charge", 0) end @@ -108,7 +108,7 @@ end minetest.register_node("technic:power_radiator", { - description = "Power Radiator", + description = "MV Power Radiator", tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, @@ -124,7 +124,7 @@ local meta = minetest.get_meta(pos) meta:set_int("MV_EU_demand",1) -- Demand on the primary side when idle meta:set_int("connected_EU_demand",0) -- Potential demand of connected appliances - meta:set_string("infotext", "Power Radiator") + meta:set_string("infotext", "MV Power Radiator") end, on_dig = function(pos, node, digger) shutdown_inductive_appliances(pos) @@ -138,9 +138,9 @@ minetest.register_craft({ output = 'technic:power_radiator 1', recipe = { - {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, - {'technic:copper_coil', 'technic:mv_transformer', 'technic:copper_coil'}, - {'technic:rubber', 'technic:mv_cable0', 'technic:rubber'}, + {'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'}, + {'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'}, + {'technic:rubber', 'technic:mv_cable0', 'technic:rubber'}, } }) @@ -158,7 +158,7 @@ if eu_input == 0 then -- No power - meta:set_string("infotext", "Power Radiator is unpowered"); + meta:set_string("infotext", "MV Power Radiator is unpowered"); -- meta:set_int("active", 1) -- used for setting textures someday maybe shutdown_inductive_appliances(pos) meta:set_int("connected_EU_demand", 0) @@ -201,7 +201,7 @@ -- The appliance has power from this node. Spend power if it is on. used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor) end - meta:set_string("infotext", "Power Radiator is powered (" + meta:set_string("infotext", "MV Power Radiator is powered (" ..math.floor(used_charge / max_charge * 100) .."% of maximum power)"); if used_charge == 0 then -- Gitblit v1.8.0