forked from minetest-mods/more_chests
Compare commits
4 Commits
ddb75a7564
...
master
Author | SHA1 | Date | |
---|---|---|---|
e716e79640 | |||
cc52a10811 | |||
ad63d3d691 | |||
6be81453ca |
@ -29,7 +29,10 @@ local dropbox = gen_def({
|
||||
return 0
|
||||
end
|
||||
return stack_count
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_take = actions.get_allow_metadata_inventory_take({
|
||||
"dropbox", check_privs = actions.has_locked_chest_privilege
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ local function check_privs(meta, player)
|
||||
local shared = " " .. meta:get_string("shared") .. " "
|
||||
if name == meta:get_string("owner") then
|
||||
return true
|
||||
elseif shared:find(" " .. name .. " ") then
|
||||
elseif shared:find(" " .. name .. " ", 1, true) then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
@ -87,3 +87,20 @@ minetest.register_on_joinplayer(function(player)
|
||||
local inv = player:get_inventory()
|
||||
inv:set_size("more_chests:wifi", 8*4)
|
||||
end)
|
||||
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
if (inventory_info.to_list == "more_chests:wifi" or inventory_info.from_list == "more_chests:wifi")
|
||||
and not minetest.is_creative_enabled(player:get_player_name()) then
|
||||
local pos = player:get_pos()
|
||||
pos.y = pos.y + player:get_properties().eye_height
|
||||
|
||||
local def = player:get_wielded_item():get_definition()
|
||||
local range = def and def.range or 4
|
||||
-- Additional tolerance to reach the node corner diagonally
|
||||
-- Also allows minor eye offsets to be used
|
||||
local chest = minetest.find_node_near(pos, range + 1, "more_chests:wifi")
|
||||
if not chest then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -33,6 +33,7 @@ function generate_chest_def(def)
|
||||
choppy=2,
|
||||
oddly_breakable_by_hand=2
|
||||
},
|
||||
is_ground_content = false,
|
||||
sounds = def.sounds or default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
Reference in New Issue
Block a user