From ebc114df71cc20868afbd3c6dea4039dc14c1a0e Mon Sep 17 00:00:00 2001
From: Carter Kolwey <fhrfuyduduf@gmail.com>
Date: Sat, 11 Jan 2014 18:30:10 +0100
Subject: [PATCH] Fixed music player

---
 technic/machines/LV/extractor.lua |   37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/technic/machines/LV/extractor.lua b/technic/machines/LV/extractor.lua
index 0e6f53a..c814d9e 100644
--- a/technic/machines/LV/extractor.lua
+++ b/technic/machines/LV/extractor.lua
@@ -74,17 +74,10 @@
 		inv:set_size("src", 1)
 		inv:set_size("dst", 4)
 	end,
-	can_dig = function(pos,player)
-		local meta = minetest.get_meta(pos);
-		local inv = meta:get_inventory()
-		if not inv:is_empty("src") or not inv:is_empty("dst") then
-			minetest.chat_send_player(player:get_player_name(),
-				S("Machine cannot be removed because it is not empty"))
-			return false
-		else
-			return true
-		end
-	end,
+	can_dig = technic.machine_can_dig,
+	allow_metadata_inventory_put = technic.machine_inventory_put,
+	allow_metadata_inventory_take = technic.machine_inventory_take,
+	allow_metadata_inventory_move = technic.machine_inventory_move,
 })
 
 minetest.register_node("technic:extractor_active", {
@@ -96,17 +89,10 @@
 	groups = {cracky=2, not_in_creative_inventory=1},
 	legacy_facedir_simple = true,
 	sounds = default.node_sound_wood_defaults(),
-	can_dig = function(pos,player)
-		local meta = minetest.get_meta(pos);
-		local inv = meta:get_inventory()
-		if not inv:is_empty("src") or not inv:is_empty("dst") then
-			minetest.chat_send_player(player:get_player_name(),
-				S("Machine cannot be removed because it is not empty"))
-			return false
-		else
-			return true
-		end
-	end,
+	can_dig = technic.machine_can_dig,
+	allow_metadata_inventory_put = technic.machine_inventory_put,
+	allow_metadata_inventory_take = technic.machine_inventory_take,
+	allow_metadata_inventory_move = technic.machine_inventory_move,
 })
 
 minetest.register_abm({
@@ -135,6 +121,7 @@
 		-- Power off automatically if no longer connected to a switching station
 		technic.switching_station_timeout_count(pos, "LV")
 
+		local src_item = nil
 		if srcstack then
 			src_item = srcstack:to_table()
 		end
@@ -146,7 +133,7 @@
 		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
@@ -154,11 +141,11 @@
 
 		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)

--
Gitblit v1.8.0