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 | 56 +++++++++++++++++++++++--------------------------------- 1 files changed, 23 insertions(+), 33 deletions(-) diff --git a/technic/machines/LV/extractor.lua b/technic/machines/LV/extractor.lua index 96ae901..c814d9e 100644 --- a/technic/machines/LV/extractor.lua +++ b/technic/machines/LV/extractor.lua @@ -1,4 +1,7 @@ + technic.extractor_recipes ={} + +local S = technic.getter technic.register_extractor_recipe = function(src, src_count, dst, dst_count) technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count} @@ -50,13 +53,13 @@ local extractor_formspec = "invsize[8,9;]".. - "label[0,0;Extractor]".. + "label[0,0;"..S("Extractor").."]".. "list[current_name;src;3,1;1,1;]".. "list[current_name;dst;5,1;2,2;]".. "list[current_player;main;0,5;8,4;]" minetest.register_node("technic:extractor", { - description = "Extractor", + description = S("Extractor"), tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_front.png"}, paramtype2 = "facedir", @@ -65,27 +68,20 @@ sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Extractor") + meta:set_string("infotext", S("Extractor")) meta:set_string("formspec", extractor_formspec) local inv = meta:get_inventory() 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(), - "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", { - description = "Extractor", + description = S("Extractor"), tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_front_active.png"}, @@ -93,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(), - "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({ @@ -118,7 +107,7 @@ local eu_input = meta:get_int("LV_EU_input") -- Machine information - local machine_name = "Extractor" + local machine_name = S("Extractor") local machine_node = "technic:extractor" local demand = 300 @@ -132,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 @@ -143,20 +133,20 @@ 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) - meta:set_string("infotext", machine_name.." Idle") + technic.swap_node(pos, machine_node) + meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_int("LV_EU_demand", 0) return end if eu_input < demand then -- unpowered - go idle - hacky_swap_node(pos, machine_node) - meta:set_string("infotext", machine_name.." Unpowered") + 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") - meta:set_string("infotext", machine_name.." 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") >= 4 then -- 4 ticks per output -- Gitblit v1.8.0