From 0fb44d5afe49e31ce7f3d521e5440d17982bf263 Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Sun, 11 Oct 2020 17:35:24 +0200
Subject: [PATCH] collect rubber and cut tree

---
 technic/machines/other/injector.lua |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua
index c98be59..fc3e3cd 100644
--- a/technic/machines/other/injector.lua
+++ b/technic/machines/other/injector.lua
@@ -16,7 +16,7 @@
 				if stack then
 				local item0=stack:to_table()
 				if item0 then
-					item0["count"] = "1"
+					item0["count"] = 1
 					technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
 					stack:take_item(1)
 					inv:set_stack("main", i, stack)
@@ -40,7 +40,7 @@
 				end
 			end
 		end
-		
+
 end
 
 minetest.register_craft({
@@ -95,7 +95,7 @@
 			if meta:get_int("splitstacks") == 1 then
 				stack = stack:peek_item(1)
 			end
-			return meta:get_inventory():room_for_item("main", stack)
+			return inv:room_for_item("main", stack)
 		end,
 		insert_object = function(pos, node, stack, direction)
 			return minetest.get_meta(pos):get_inventory():add_item("main", stack)
@@ -117,6 +117,8 @@
 		return inv:is_empty("main")
 	end,
 	on_receive_fields = function(pos, formanme, fields, sender)
+		if minetest.is_protected(pos, sender:get_player_name()) then return end
+
 		local meta = minetest.get_meta(pos)
 		if fields.mode_item then meta:set_string("mode", "single items") end
 		if fields.mode_stack then meta:set_string("mode", "whole stacks") end

--
Gitblit v1.8.0