From 43acec290067f9aca534647d46ba1f13cfeb377a Mon Sep 17 00:00:00 2001
From: TechDudie <73961295+TechDudie@users.noreply.github.com>
Date: Tue, 09 Feb 2021 19:03:55 +0100
Subject: [PATCH] Add Rubber Goo as replacement for the grinder (#578)

---
 technic/machines/other/frames.lua |   54 ++++++++++++++++++++++++++----------------------------
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua
index d5c60a3..e65902c 100644
--- a/technic/machines/other/frames.lua
+++ b/technic/machines/other/frames.lua
@@ -1,7 +1,5 @@
 local S = technic.getter
 
-frames = {}
-
 local infinite_stacks = minetest.settings:get_bool("creative_mode")
 	and minetest.get_modpath("unified_inventory") == nil
 
@@ -100,7 +98,7 @@
 local function add_table(table, toadd)
 	local i = 1
 	while true do
-		o = table[i]
+		local o = table[i]
 		if o == toadd then return end
 		if o == nil then break end
 		i = i + 1
@@ -155,7 +153,7 @@
 	end
 
 	for _, obj in ipairs(objects) do
-		obj:setpos(vector.add(obj:getpos(), vect))
+		obj:set_pos(vector.add(obj:get_pos(), vect))
 	end
 
 	for _, n in ipairs(nodelist) do
@@ -261,8 +259,8 @@
 		sunlight_propagates = true,
 
 		frame_connect_all = function(nodename)
-			l2 = {}
-			l1 = {
+			local l2 = {}
+			local l1 = {
 				{ x = -1, y = 0, z = 0 }, { x = 1, y = 0, z = 0 },
 				{ x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 },
 				{ x = 0, y = 0, z = -1 }, { x = 0, y = 0, z = 1 }
@@ -276,7 +274,7 @@
 		end,
 
 		on_punch = function(pos, node, puncher)
-			local ppos = puncher:getpos()
+			local ppos = puncher:get_pos()
 			local pvect = puncher:get_look_dir()
 			local pface = get_face(pos, ppos, pvect)
 
@@ -311,7 +309,7 @@
 			local node = minetest.get_node(pos)
 			if node.name ~= "air" then
 				if is_supported_node(node.name) then
-					obj = minetest.add_entity(pos, "technic:frame_entity")
+					local obj = minetest.add_entity(pos, "technic:frame_entity")
 					obj:get_luaentity():set_node({ name = itemstack:get_name() })
 				end
 			else
@@ -349,8 +347,8 @@
 				end
 
 				-- Run script hook
-				local _, callback
-				for _, callback in ipairs(minetest.registered_on_placenodes) do
+				local callback = nil
+				for _, _ in ipairs(minetest.registered_on_placenodes) do
 					-- Copy pos and node because callback can modify them
 					local pos_copy = { x = pos.x, y = pos.y, z = pos.z }
 					local newnode_copy = { name = def.name, param1 = 0, param2 = 0 }
@@ -364,7 +362,7 @@
 					itemstack:take_item()
 				end
 
-				obj = minetest.add_entity(pos, "technic:frame_entity")
+				local obj = minetest.add_entity(pos, "technic:frame_entity")
 				obj:get_luaentity():set_node({ name = node.name })
 
 				return itemstack
@@ -414,7 +412,7 @@
 			item_texture = minetest.registered_items[itemname].inventory_image
 			item_type = minetest.registered_items[itemname].type
 		end
-		prop = {
+		local prop = {
 			is_visible = true,
 			textures = { node.name },
 		}
@@ -431,14 +429,14 @@
 	end,
 
 	dig = function(self)
-		minetest.handle_node_drops(self.object:getpos(), { ItemStack("technic:frame_111111") }, self.last_puncher)
-		local pos = vector.round(self.object:getpos())
+		minetest.handle_node_drops(self.object:get_pos(), { ItemStack("technic:frame_111111") }, self.last_puncher)
+		local pos = vector.round(self.object:get_pos())
 		frames_pos[pos_to_string(pos)] = nil
 		self.object:remove()
 	end,
 
 	on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
-		local pos = self.object:getpos()
+		local pos = self.object:get_pos()
 		if self.damage_object == nil then
 			self.damage_object = minetest.add_entity(pos, "technic:damage_entity")
 			self.damage_object:get_luaentity().remaining_time = 0.25
@@ -450,7 +448,7 @@
 		end
 
 		self.last_puncher = puncher
-		local ppos = puncher:getpos()
+		local ppos = puncher:get_pos()
 		local pvect = puncher:get_look_dir()
 		local pface = get_face(pos, ppos, pvect)
 		if pface == nil then return end
@@ -468,8 +466,8 @@
 	end,
 
 	on_rightclick = function(self, clicker)
-		local pos = self.object:getpos()
-		local ppos = clicker:getpos()
+		local pos = self.object:get_pos()
+		local ppos = clicker:get_pos()
 		local pvect = clicker:get_look_dir()
 		local pface = get_face(pos, ppos, pvect)
 
@@ -547,7 +545,7 @@
 				local entity = obj:get_luaentity()
 				if entity and (entity.name == "technic:frame_entity" or
 						entity.name == "technic:damage_entity") then
-					obj:setpos(t.pos)
+					obj:set_pos(t.pos)
 				end
 			end
 		end
@@ -589,7 +587,7 @@
 end
 
 local function get_connected_nodes(pos)
-	c = { pos }
+	local c = { pos }
 	local nodename = minetest.get_node(pos).name
 	if frames_pos[pos_to_string(pos)] then
 		nodename = frames_pos[pos_to_string(pos)]
@@ -695,7 +693,7 @@
 	local saved_node = meta:get_string("saved_node")
 	meta:set_string("saved_node", "")
 	technic.swap_node(pos, new)
-	local meta = minetest.get_meta(pos)
+	meta = minetest.get_meta(pos)
 	meta:set_string("saved_node", saved_node)
 end
 
@@ -857,7 +855,7 @@
 	on_destruct = template_on_destruct,
 	after_dig_node = template_drops,
 	on_punch = function(pos, node, puncher)
-	local meta = minetest.get_meta(pos)
+	local _ = minetest.get_meta(pos)
 		swap_template(pos, "technic:template_connector")
 	end
 })
@@ -979,7 +977,7 @@
 	output = 'technic:frame_111111',
 	recipe = {
 		{ '',              'default:stick',       '' },
-		{ 'default:stick', 'technic:brass_ingot', 'default:stick' },
+		{ 'default:stick', 'basic_materials:brass_ingot', 'default:stick' },
 		{ '',              'default:stick',       '' },
 	}
 })
@@ -988,7 +986,7 @@
 	output = 'technic:frame_motor',
 	recipe = {
 		{ '',                                  'technic:frame_111111', '' },
-		{ 'group:mesecon_conductor_craftable', 'technic:motor',        'group:mesecon_conductor_craftable' },
+		{ 'group:mesecon_conductor_craftable', 'basic_materials:motor',        'group:mesecon_conductor_craftable' },
 		{ '',                                  'technic:frame_111111', '' },
 	}
 })
@@ -996,9 +994,9 @@
 minetest.register_craft({
 	output = 'technic:template 10',
 	recipe = {
-		{ '',                    'technic:brass_ingot',  '' },
-		{ 'technic:brass_ingot', 'default:mese_crystal', 'technic:brass_ingot' },
-		{ '',                    'technic:brass_ingot',  '' },
+		{ '',                    'basic_materials:brass_ingot',  '' },
+		{ 'basic_materials:brass_ingot', 'default:mese_crystal', 'basic_materials:brass_ingot' },
+		{ '',                    'basic_materials:brass_ingot',  '' },
 	}
 })
 
@@ -1016,7 +1014,7 @@
 	output = 'technic:template_motor',
 	recipe = {
 		{ '',                                  'technic:template', '' },
-		{ 'group:mesecon_conductor_craftable', 'technic:motor',    'group:mesecon_conductor_craftable' },
+		{ 'group:mesecon_conductor_craftable', 'basic_materials:motor',    'group:mesecon_conductor_craftable' },
 		{ '',                                  'technic:template', '' },
 	}
 })

--
Gitblit v1.8.0