From 51fccf04917b23c70f80e33bf65e9040c22df14d Mon Sep 17 00:00:00 2001 From: Jacob Piela Date: Sun, 12 Apr 2020 18:21:14 +0200 Subject: [PATCH] fix robot being able to take pipeworks virtual item. --- commands.lua | 7 ++++++- init.lua | 16 ++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/commands.lua b/commands.lua index 771a54f..1598226 100644 --- a/commands.lua +++ b/commands.lua @@ -222,7 +222,12 @@ basic_robot.commands.take_item = function(name,item, inventory,dir) local pos = basic_robot.data[name].spawnpos; -- position of spawner block - if basic_robot.bad_inventory_blocks[ minetest.get_node(tpos).name ] then return false end -- dont allow take from + for i, bad_inventory in pairs(basic_robot.bad_inventory_blocks) do -- dont allow take from + if minetest.get_node(tpos).name:find("^" .. bad_inventory) ~= nil then + return false + end + + end local meta = minetest.get_meta(pos); local tmeta = minetest.get_meta(tpos); diff --git a/init.lua b/init.lua index 67ccb69..489fc2a 100644 --- a/init.lua +++ b/init.lua @@ -15,11 +15,15 @@ basic_robot.maxoperations = 10; -- how many operations (dig, place,move,...,gene basic_robot.dig_require_energy = true; -- does robot require energy to dig stone? basic_robot.bad_inventory_blocks = { -- disallow taking from these nodes inventories to prevent player abuses - ["craft_guide:sign_wall"] = true, - ["basic_machines:battery_0"] = true, - ["basic_machines:battery_1"] = true, - ["basic_machines:battery_2"] = true, - ["basic_machines:generator"] = true, + "craft_guide:sign_wall", + "basic_machines:battery_0", + "basic_machines:battery_1", + "basic_machines:battery_2", + "basic_machines:generator", + "pipeworks:autocrafter", + "pipeworks:mese_filter", + "pipeworks:filter", + "pipeworks:mese_tube_", -- matched to first part of node name } ----- END OF SETTINGS ------ @@ -1904,4 +1908,4 @@ minetest.register_craft({ minetest.register_privilege("robot", "increased number of allowed active robots") minetest.register_privilege("puzzle", "allow player to use puzzle. namespace in robots") -print('[MOD]'.. " basic_robot " .. basic_robot.version .. " loaded.") \ No newline at end of file +print('[MOD]'.. " basic_robot " .. basic_robot.version .. " loaded.")