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

@ -205,7 +205,7 @@ function technic.register_alloy_furnace(data)
end
if 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(tier.."_EU_demand", 0)
return
@ -213,11 +213,11 @@ function technic.register_alloy_furnace(data)
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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)
if meta:get_int("src_time") == data.cook_time then

View File

@ -126,7 +126,7 @@ function technic.register_battery_box(data)
charge_count = math.max(charge_count, 0)
local last_count = meta:get_float("last_side_shown")
if charge_count ~= last_count then
hacky_swap_node(pos,"technic:"..ltier.."_battery_box"..charge_count)
technic.swap_node(pos,"technic:"..ltier.."_battery_box"..charge_count)
meta:set_float("last_side_shown", charge_count)
end

View File

@ -142,18 +142,18 @@ function technic.register_electric_furnace(data)
if not result or result.time == 0 or
not inv:room_for_item("dst", result.item) then
meta:set_int(tier.."_EU_demand", 0)
hacky_swap_node(pos, machine_node)
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
return
end
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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))
technic.smelt_item(meta, result, data.speed)

View File

@ -99,7 +99,7 @@ function technic.register_generator(data)
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if not fuel or fuel.time == 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
hacky_swap_node(pos, "technic:"..ltier.."_generator")
technic.swap_node(pos, "technic:"..ltier.."_generator")
return
end
meta:set_int("burn_time", fuel.time)
@ -107,10 +107,10 @@ function technic.register_generator(data)
local stack = inv:get_stack("src", 1)
stack:take_item()
inv:set_stack("src", 1, stack)
hacky_swap_node(pos, "technic:"..ltier.."_generator_active")
technic.swap_node(pos, "technic:"..ltier.."_generator_active")
meta:set_int(tier.."_EU_supply", data.supply)
else
hacky_swap_node(pos, "technic:"..ltier.."_generator")
technic.swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(tier.."_EU_supply", 0)
end
end

View File

@ -120,7 +120,7 @@ function technic.register_grinder(data)
local result = technic.get_grinder_recipe(inv:get_stack("src", 1))
if not 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(tier.."_EU_demand", 0)
return
@ -128,11 +128,11 @@ function technic.register_grinder(data)
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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)