From 6154a04c00d7650664b78e2bca37631ae3778411 Mon Sep 17 00:00:00 2001
From: David Leal <halfpacho@gmail.com>
Date: Wed, 24 Jun 2020 21:14:04 +0200
Subject: [PATCH] Remove node_ownership support, cleanup (#560)

---
 technic/machines/MV/tool_workshop.lua |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua
index a1f9a21..678a1fd 100644
--- a/technic/machines/MV/tool_workshop.lua
+++ b/technic/machines/MV/tool_workshop.lua
@@ -5,32 +5,40 @@
 
 local S = technic.getter
 
+local tube_entry = "^pipeworks_tube_connection_wooden.png"
+
 minetest.register_craft({
 	output = 'technic:tool_workshop',
 	recipe = {
 		{'group:wood',                         'default:diamond',        'group:wood'},
 		{'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'},
-		{'default:obsidian',                   'technic:mv_cable0',      'default:obsidian'},
+		{'default:obsidian',                   'technic:mv_cable',       'default:obsidian'},
 	}
 })
 
 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;]"..
 	"list[current_name;upgrade2;2,3;1,1;]"..
 	"label[1,4;"..S("Upgrade Slots").."]"..
-	"list[current_player;main;0,5;8,4;]"
+	"list[current_player;main;0,5;8,4;]"..
+	"listring[current_player;main]"..
+	"listring[current_name;src]"..
+	"listring[current_player;main]"..
+	"listring[current_name;upgrade1]"..
+	"listring[current_player;main]"..
+	"listring[current_name;upgrade2]"..
+	"listring[current_player;main]"
 
 local run = function(pos, node)
 	local meta         = minetest.get_meta(pos)
 	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
@@ -62,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
@@ -75,9 +83,18 @@
 
 minetest.register_node("technic:tool_workshop", {
 	description = S("%s Tool Workshop"):format("MV"),
-	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"},
-	groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, tubedevice=1, tubedevice_receiver=1},
+	paramtype2 = "facedir",
+	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"},
 	sounds = default.node_sound_wood_defaults(),
 	on_construct = function(pos)
 		local meta = minetest.get_meta(pos)
@@ -87,7 +104,7 @@
 		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,
@@ -101,6 +118,8 @@
 		connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
 	},
 	technic_run = run,
+	after_place_node = pipeworks.after_place,
+	after_dig_node = technic.machine_after_dig_node
 })
 
 technic.register_machine("MV", "technic:tool_workshop", technic.receiver)

--
Gitblit v1.8.0