Add support for minetest.swap_node

This commit is contained in:
ShadowNinja
2013-12-10 20:14:39 -05:00
parent 818a0e5ff0
commit f3d8b47b20
19 changed files with 71 additions and 71 deletions

View File

@ -200,17 +200,17 @@ minetest.register_abm({
if inv:is_empty("src") or
(not minetest.registered_nodes[result]) or
(not inv:room_for_item("dst", result)) then
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_string("cnc_product", "")
return
end
if eu_input < demand then
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then
hacky_swap_node(pos, machine_node.."_active")
technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name))
meta:set_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= 3 then -- 3 ticks per output

View File

@ -121,7 +121,7 @@ minetest.register_abm({
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)")
hacky_swap_node(pos, "technic:coal_alloy_furnace_active")
technic.swap_node(pos, "technic:coal_alloy_furnace_active")
meta:set_string("formspec",
"size[8,9]"..
"label[0,0;"..machine_name.."]"..
@ -144,7 +144,7 @@ minetest.register_abm({
if recipe then
if was_active then
meta:set_string("infotext", "Furnace is empty")
hacky_swap_node(pos, "technic:coal_alloy_furnace")
technic.swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("formspec", formspec)
end
return
@ -160,7 +160,7 @@ minetest.register_abm({
if fuel.time <= 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name))
hacky_swap_node(pos, "technic:coal_alloy_furnace")
technic.swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("formspec", formspec)
return
end

View File

@ -125,7 +125,7 @@ minetest.register_abm({
end
if empty or (not result) or
(not inv:room_for_item("dst", result)) then
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0)
meta:set_int("src_time", 0)
@ -133,10 +133,10 @@ minetest.register_abm({
end
if eu_input < demand then
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then
hacky_swap_node(pos, machine_node.."_active")
technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name))
meta:set_int("src_time", meta:get_int("src_time") + 1)

View File

@ -132,7 +132,7 @@ minetest.register_abm({
end
if inv:is_empty("src") or (not recipe) or (not result) or
(not inv:room_for_item("dst", result)) then
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0)
return
@ -140,11 +140,11 @@ minetest.register_abm({
if eu_input < demand then
-- unpowered - go idle
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then
-- Powered
hacky_swap_node(pos, machine_node.."_active")
technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name))
meta:set_int("src_time", meta:get_int("src_time") + 1)

View File

@ -99,11 +99,11 @@ minetest.register_abm({
S("Geothermal Generator").." ("..production_level.."%)")
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
hacky_swap_node (pos, "technic:geothermal_active")
technic.swap_node (pos, "technic:geothermal_active")
return
end
if production_level == 0 then
hacky_swap_node(pos, "technic:geothermal")
technic.swap_node(pos, "technic:geothermal")
meta:set_int("LV_EU_supply", 0)
end
end

View File

@ -89,12 +89,12 @@ minetest.register_abm({
if production_level > 0 and
minetest.get_node(pos).name == "technic:water_mill" then
hacky_swap_node (pos, "technic:water_mill_active")
technic.swap_node (pos, "technic:water_mill_active")
meta:set_int("LV_EU_supply", 0)
return
end
if production_level == 0 then
hacky_swap_node(pos, "technic:water_mill")
technic.swap_node(pos, "technic:water_mill")
end
end
})