mirror of
https://github.com/HybridDog/connected_chests.git
synced 2024-12-28 06:00:17 +01:00
fix screwdriver rotated big chest crash
This commit is contained in:
parent
36a49cc3be
commit
7efa31c726
49
init.lua
49
init.lua
@ -128,33 +128,32 @@ local function log_access(pos, player, text)
|
|||||||
" moves stuff "..text.." at "..minetest.pos_to_string(pos))
|
" moves stuff "..text.." at "..minetest.pos_to_string(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
local default_chest = minetest.registered_nodes["default:chest"]
|
|
||||||
minetest.register_node("connected_chests:chest_left", {
|
local chest = table.copy(minetest.registered_nodes["default:chest"])
|
||||||
tiles = {"connected_chests_top.png", "connected_chests_top.png", "default_obsidian_glass.png",
|
chest.description = nil
|
||||||
"default_chest_side.png", "connected_chests_side.png^[transformFX", "connected_chests_side.png^connected_chests_front.png"},
|
chest.tiles = {"connected_chests_top.png", "connected_chests_top.png", "default_obsidian_glass.png",
|
||||||
paramtype2 = "facedir",
|
"default_chest_side.png", "connected_chests_side.png^[transformFX", "connected_chests_side.png^connected_chests_front.png"}
|
||||||
drop = "default:chest 2",
|
chest.drop = "default:chest 2"
|
||||||
groups = default_chest.groups,
|
chest.legacy_facedir_simple = nil
|
||||||
is_ground_content = default_chest.is_ground_content,
|
chest.selection_box = {
|
||||||
sounds = default_chest.sounds,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, 1.5, 0.5, 0.5},
|
{-0.5, -0.5, -0.5, 1.5, 0.5, 0.5},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
can_dig = default_chest.can_dig,
|
chest.after_dig_node = return_remove_next("connected_chests:chest_right")
|
||||||
after_dig_node = return_remove_next("connected_chests:chest_right"),
|
chest.on_metadata_inventory_move = function(pos, _, _, _, _, _, player)
|
||||||
on_metadata_inventory_move = function(pos, _, _, _, _, _, player)
|
|
||||||
log_access(pos, player, "in a big chest")
|
log_access(pos, player, "in a big chest")
|
||||||
end,
|
end
|
||||||
on_metadata_inventory_put = function(pos, _, _, _, player)
|
chest.on_metadata_inventory_put = function(pos, _, _, _, player)
|
||||||
log_access(pos, player, "to a big chest")
|
log_access(pos, player, "to a big chest")
|
||||||
end,
|
end
|
||||||
on_metadata_inventory_take = function(pos, _, _, _, player)
|
chest.on_metadata_inventory_take = function(pos, _, _, _, player)
|
||||||
log_access(pos, player, "from a big chest")
|
log_access(pos, player, "from a big chest")
|
||||||
end,
|
end
|
||||||
})
|
|
||||||
|
minetest.register_node("connected_chests:chest_left", chest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function has_locked_chest_privilege(meta, player)
|
local function has_locked_chest_privilege(meta, player)
|
||||||
@ -231,6 +230,11 @@ for _,i in pairs({"chest", "chest_locked"}) do
|
|||||||
interval = 3,
|
interval = 3,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function (pos, node)
|
action = function (pos, node)
|
||||||
|
if node.param2 > 3 then
|
||||||
|
node.param2 = 0
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
return
|
||||||
|
end
|
||||||
local x, z = unpack(string.split(param_tab2[node.param2], " "))
|
local x, z = unpack(string.split(param_tab2[node.param2], " "))
|
||||||
if minetest.get_node({x=pos.x+x, y=pos.y, z=pos.z+z}).name ~= "connected_chests:"..i.."_left" then
|
if minetest.get_node({x=pos.x+x, y=pos.y, z=pos.z+z}).name ~= "connected_chests:"..i.."_left" then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
@ -243,6 +247,11 @@ for _,i in pairs({"chest", "chest_locked"}) do
|
|||||||
chance = 1,
|
chance = 1,
|
||||||
action = function (pos, node)
|
action = function (pos, node)
|
||||||
local par = node.param2
|
local par = node.param2
|
||||||
|
if par > 3 then
|
||||||
|
node.param2 = 0
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
return
|
||||||
|
end
|
||||||
local x, z = unpack(string.split(param_tab2[par], " "))
|
local x, z = unpack(string.split(param_tab2[par], " "))
|
||||||
pos = {x=pos.x-x, y=pos.y, z=pos.z-z}
|
pos = {x=pos.x-x, y=pos.y, z=pos.z-z}
|
||||||
if minetest.get_node(pos).name == "air" then
|
if minetest.get_node(pos).name == "air" then
|
||||||
|
Loading…
Reference in New Issue
Block a user