mirror of
https://github.com/HybridDog/connected_chests.git
synced 2024-12-28 06:00:17 +01:00
Update for new minetest_game
This commit is contained in:
parent
24c17ac7d6
commit
244e7fbf3a
@ -17,3 +17,4 @@ If you got ideas or found bugs, please tell them to me.
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* add abms when registering the chest instead of using chestdata
|
* add abms when registering the chest instead of using chestdata
|
||||||
|
* lid opening
|
42
init.lua
42
init.lua
@ -200,7 +200,7 @@ function connected_chests.register_chest(fromname, data)
|
|||||||
chest.after_place_node = nil
|
chest.after_place_node = nil
|
||||||
chest.on_receive_fields = nil
|
chest.on_receive_fields = nil
|
||||||
if data.on_rightclick then
|
if data.on_rightclick then
|
||||||
chest.on_rightclick = function()print"yem"end--data.on_rightclick
|
chest.on_rightclick = data.on_rightclick
|
||||||
end
|
end
|
||||||
function chest.on_rotate()
|
function chest.on_rotate()
|
||||||
return false
|
return false
|
||||||
@ -289,7 +289,20 @@ local big_formspec = "size[13,9]"..
|
|||||||
connected_chests.register_chest("default:chest", {
|
connected_chests.register_chest("default:chest", {
|
||||||
get_formspec = function()
|
get_formspec = function()
|
||||||
return big_formspec
|
return big_formspec
|
||||||
|
end,
|
||||||
|
on_rightclick = function(pos, _, player)
|
||||||
|
minetest.sound_play("default_chest_open", {gain = 0.3,
|
||||||
|
pos = pos, max_hear_distance = 10})
|
||||||
|
|
||||||
|
minetest.show_formspec(
|
||||||
|
player:get_player_name(),
|
||||||
|
"default:chest_locked_connected_left",
|
||||||
|
"size[13,9]"..
|
||||||
|
"list[nodemeta:".. pos.x .. "," .. pos.y .. "," ..pos.z .. ";main;0,0;13,5;]"..
|
||||||
|
"list[current_player;main;2.5,5.2;8,4;]"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
connected_chests.register_chest("default:chest_locked", {
|
connected_chests.register_chest("default:chest_locked", {
|
||||||
@ -297,19 +310,22 @@ connected_chests.register_chest("default:chest_locked", {
|
|||||||
return big_formspec
|
return big_formspec
|
||||||
end,
|
end,
|
||||||
lock = true,
|
lock = true,
|
||||||
on_rightclick = function(pos, _, clicker)
|
on_rightclick = function(pos, _, player)
|
||||||
local meta = minetest.get_meta(pos)
|
if not default.can_interact_with_node(player, pos) then
|
||||||
local pname = clicker:get_player_name()
|
minetest.sound_play("default_chest_locked", {pos = pos})
|
||||||
if pname == meta:get_string"owner"
|
return
|
||||||
or pname == minetest.settings:get"name" then
|
|
||||||
minetest.show_formspec(
|
|
||||||
pname,
|
|
||||||
"default:chest_locked_connected_left",
|
|
||||||
"size[13,9]"..
|
|
||||||
"list[nodemeta:".. pos.x .. "," .. pos.y .. "," ..pos.z .. ";main;0,0;13,5;]"..
|
|
||||||
"list[current_player;main;2.5,5.2;8,4;]"
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.sound_play("default_chest_open", {gain = 0.3,
|
||||||
|
pos = pos, max_hear_distance = 10})
|
||||||
|
|
||||||
|
minetest.show_formspec(
|
||||||
|
player:get_player_name(),
|
||||||
|
"default:chest_locked_connected_left",
|
||||||
|
"size[13,9]"..
|
||||||
|
"list[nodemeta:".. pos.x .. "," .. pos.y .. "," ..pos.z .. ";main;0,0;13,5;]"..
|
||||||
|
"list[current_player;main;2.5,5.2;8,4;]"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user