From 4a9ad94bf9560770c0efded0c8558c4747dc887f Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 26 Apr 2020 11:32:42 +0200 Subject: [PATCH 1/2] Fix chest formspec protection (#540) This closes #539. --- technic_chests/register.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/technic_chests/register.lua b/technic_chests/register.lua index 0d5150e..9f63617 100644 --- a/technic_chests/register.lua +++ b/technic_chests/register.lua @@ -159,6 +159,16 @@ local function get_receive_fields(name, data) return function(pos, formname, fields, sender) local meta = minetest.get_meta(pos) local page = "main" + + local owner = meta:get_string("owner") + if owner ~= "" then + -- prevent modification of locked chests + if owner ~= sender:get_player_name() then return end + elseif not fields.quit then + -- prevent modification of protected chests + if minetest.is_protected(pos, sender:get_player_name()) then return end + end + if fields.sort or (data.autosort and fields.quit and meta:get_int("autosort") == 1) then sort_inventory(meta:get_inventory()) end From fb4fef783b605dcdc73554019ef46d8354614ad4 Mon Sep 17 00:00:00 2001 From: Louis Royer <55180044+louisroyer@users.noreply.github.com> Date: Sun, 26 Apr 2020 11:33:12 +0200 Subject: [PATCH 2/2] Shapeless locked chests crafts (chest + lockpad) (#530) This was only done for `default:chest`. --- technic_chests/copper_chest.lua | 1 + technic_chests/gold_chest.lua | 1 + technic_chests/iron_chest.lua | 1 + technic_chests/mithril_chest.lua | 1 + technic_chests/silver_chest.lua | 1 + 5 files changed, 5 insertions(+) diff --git a/technic_chests/copper_chest.lua b/technic_chests/copper_chest.lua index fda1db0..6445d46 100644 --- a/technic_chests/copper_chest.lua +++ b/technic_chests/copper_chest.lua @@ -18,6 +18,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:copper_locked_chest 1', + type = "shapeless", recipe = { {'basic_materials:padlock'}, {'technic:copper_chest'}, diff --git a/technic_chests/gold_chest.lua b/technic_chests/gold_chest.lua index 7a50b70..9497646 100644 --- a/technic_chests/gold_chest.lua +++ b/technic_chests/gold_chest.lua @@ -29,6 +29,7 @@ end minetest.register_craft({ output = 'technic:gold_locked_chest', + type = "shapeless", recipe = { {'basic_materials:padlock'}, {'technic:gold_chest'}, diff --git a/technic_chests/iron_chest.lua b/technic_chests/iron_chest.lua index 237067b..d522240 100644 --- a/technic_chests/iron_chest.lua +++ b/technic_chests/iron_chest.lua @@ -25,6 +25,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:iron_locked_chest 1', + type = "shapeless", recipe = { {'basic_materials:padlock'}, {'technic:iron_chest'}, diff --git a/technic_chests/mithril_chest.lua b/technic_chests/mithril_chest.lua index 05cbc40..38ed293 100644 --- a/technic_chests/mithril_chest.lua +++ b/technic_chests/mithril_chest.lua @@ -20,6 +20,7 @@ end minetest.register_craft({ output = 'technic:mithril_locked_chest 1', + type = "shapeless", recipe = { {'basic_materials:padlock'}, {'technic:mithril_chest'}, diff --git a/technic_chests/silver_chest.lua b/technic_chests/silver_chest.lua index 4de196d..8bc8423 100644 --- a/technic_chests/silver_chest.lua +++ b/technic_chests/silver_chest.lua @@ -20,6 +20,7 @@ end minetest.register_craft({ output = 'technic:silver_locked_chest', + type = "shapeless", recipe = { {'basic_materials:padlock'}, {'technic:silver_chest'},