Add backward compatibility to the new supply converter

This commit is contained in:
number Zero 2017-03-17 21:10:43 +03:00
parent 2a7dbe0506
commit 408128d800

View File

@ -68,7 +68,15 @@ local run = function(pos, node, run_stage)
-- Machine information -- Machine information
local machine_name = S("Supply Converter") local machine_name = S("Supply Converter")
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local enabled = meta:get_string("enabled") ~= "0" and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) local enabled = meta:get_string("enabled")
if enabled == "" then
-- Backwards compatibility
minetest.registered_nodes["technic:supply_converter"].on_construct(pos)
enabled = true
else
enabled = enabled == "1"
end
enabled = enabled and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
local demand = enabled and meta:get_int("power") or 0 local demand = enabled and meta:get_int("power") or 0
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z} local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}