auouymous
2021-02-06 0f7810e53895f5742ab577559584539e6533a0dc
technic/machines/MV/tool_workshop.lua
@@ -5,6 +5,8 @@
local S = technic.getter
local tube_entry = "^pipeworks_tube_connection_wooden.png"
minetest.register_craft({
   output = 'technic:tool_workshop',
   recipe = {
@@ -17,7 +19,7 @@
local workshop_demand = {5000, 3500, 2000}
local workshop_formspec =
   "invsize[8,9;]"..
   "size[8,9;]"..
   "list[current_name;src;3,1;1,1;]"..
   "label[0,0;"..S("%s Tool Workshop"):format("MV").."]"..
   "list[current_name;upgrade1;1,3;1,1;]"..
@@ -37,7 +39,6 @@
   local inv          = meta:get_inventory()
   local eu_input     = meta:get_int("MV_EU_input")
   local machine_name = S("%s Tool Workshop"):format("MV")
   local machine_node = "technic:tool_workshop"
   -- Setup meta data if it does not exist.
   if not eu_input then
@@ -69,7 +70,7 @@
      meta:set_int("MV_EU_demand", 0)
      return
   end
   if eu_input < workshop_demand[EU_upgrade+1] then
      meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
   elseif eu_input >= workshop_demand[EU_upgrade+1] then
@@ -83,8 +84,14 @@
minetest.register_node("technic:tool_workshop", {
   description = S("%s Tool Workshop"):format("MV"),
   paramtype2 = "facedir",
   tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
            "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
   tiles = {
      "technic_workshop_top.png"..tube_entry,
      "technic_machine_bottom.png"..tube_entry,
      "technic_workshop_side.png"..tube_entry,
      "technic_workshop_side.png"..tube_entry,
      "technic_workshop_side.png"..tube_entry,
      "technic_workshop_side.png"
   },
   groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
      technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1},
   connect_sides = {"bottom", "back", "left", "right"},
@@ -97,14 +104,13 @@
      inv:set_size("src", 1)
      inv:set_size("upgrade1", 1)
      inv:set_size("upgrade2", 1)
   end,
   end,
   can_dig = technic.machine_can_dig,
   allow_metadata_inventory_put = technic.machine_inventory_put,
   allow_metadata_inventory_take = technic.machine_inventory_take,
   tube = {
      can_insert = function (pos, node, stack, direction)
         local onestack = stack:peek_item(1)
         return minetest.get_meta(pos):get_inventory():room_for_item("src", onestack)
         return minetest.get_meta(pos):get_inventory():room_for_item("src", stack)
      end,
      insert_object = function (pos, node, stack, direction)
         return minetest.get_meta(pos):get_inventory():add_item("src", stack)