minetest.register_node("default:chest_locked", {
description = "Locked Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
paramtype2 = "facedir",
groups = {choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- meta:set_string("infotext", "Locked Chest")
-- meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
end,
-- allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return count
-- end,
-- allow_metadata_inventory_put = function(pos, listname, index, stack, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return stack:get_count()
-- end,
-- allow_metadata_inventory_take = function(pos, listname, index, stack, player)
-- local meta = minetest.get_meta(pos)
-- if not has_locked_chest_privilege(meta, player) then
-- return 0
-- end
-- return stack:get_count()
-- end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, clicker) then
minetest.show_formspec(
clicker:get_player_name(),
"default:chest_locked",
get_locked_chest_formspec(pos)
)
end
end,
on_blast = function() end,
})Hybrid Dog wrote:Maybe it's caused by that:
https://github.com/minetest/minetest/bl ... ample#L764
yyt16384 wrote:Hybrid Dog wrote:Maybe it's caused by that:
https://github.com/minetest/minetest/bl ... ample#L764
I think it is this one: https://github.com/minetest/minetest/bl ... e.cpp#L358
It is not changed anywhere outside of this method, so once you set it to 2.0 you will not push blocks to send for 2 seconds, which looks wrong to me. Probably it should be reset when blocks are changed.
Users browsing this forum: Bing [Bot] and 3 guests