Hugo Locurcio
2020-04-26 4a9ad94bf9560770c0efded0c8558c4747dc887f
Fix chest formspec protection (#540)

This closes #539.
1 files modified
10 ■■■■■ changed files
technic_chests/register.lua 10 ●●●●● patch | view | raw | blame | history
technic_chests/register.lua
@@ -159,6 +159,16 @@
    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