From b81d1d3f2debcab4d18cf4dee824075ef0bbb116 Mon Sep 17 00:00:00 2001 From: Lejo Date: Sat, 13 Apr 2019 20:45:49 +0200 Subject: [PATCH] Check protection of the forcefield and Quarry (#468) --- technic/machines/HV/forcefield.lua | 6 ++++++ technic/machines/HV/quarry.lua | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua index 7395284..29c023d 100644 --- a/technic/machines/HV/forcefield.lua +++ b/technic/machines/HV/forcefield.lua @@ -121,6 +121,12 @@ local function set_forcefield_formspec(meta) end local forcefield_receive_fields = function(pos, formname, fields, sender) + local player_name = sender:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.chat_send_player(player_name, "You are not allowed to edit this!") + minetest.record_protection_violation(pos, player_name) + return + end local meta = minetest.get_meta(pos) local range = nil if fields.range then diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 1671c4e..9cf378f 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -60,6 +60,12 @@ local function set_quarry_demand(meta) end local function quarry_receive_fields(pos, formname, fields, sender) + local player_name = sender:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.chat_send_player(player_name, "You are not allowed to edit this!") + minetest.record_protection_violation(pos, player_name) + return + end local meta = minetest.get_meta(pos) if fields.size and string.find(fields.size, "^[0-9]+$") then local size = tonumber(fields.size)