Fix crash with MT 5.7.0 and update mtg fencegate registration
This commit is contained in:
parent
95a6b0dd48
commit
c12e3cdf3f
1 changed files with 17 additions and 7 deletions
|
@ -723,7 +723,7 @@ function doors.register_fencegate(name, def)
|
||||||
local fence = {
|
local fence = {
|
||||||
description = def.description,
|
description = def.description,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
tiles = {def.texture},
|
tiles = {},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
|
@ -734,8 +734,8 @@ function doors.register_fencegate(name, def)
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local node_def = minetest.registered_nodes[node.name]
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
|
minetest.swap_node(pos, {name = node_def._gate, param2 = node.param2})
|
||||||
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
|
minetest.sound_play(node_def._gate_sound, {pos = pos, gain = 0.3,
|
||||||
max_hear_distance = 8})
|
max_hear_distance = 8})
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
@ -745,6 +745,16 @@ function doors.register_fencegate(name, def)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if type(def.texture) == "string" then
|
||||||
|
fence.tiles[1] = {name = def.texture, backface_culling = true}
|
||||||
|
elseif def.texture.backface_culling == nil then
|
||||||
|
fence.tiles[1] = table.copy(def.texture)
|
||||||
|
fence.tiles[1].backface_culling = true
|
||||||
|
else
|
||||||
|
fence.tiles[1] = def.texture
|
||||||
|
end
|
||||||
|
|
||||||
if not fence.sounds then
|
if not fence.sounds then
|
||||||
fence.sounds = default.node_sound_wood_defaults()
|
fence.sounds = default.node_sound_wood_defaults()
|
||||||
end
|
end
|
||||||
|
@ -753,8 +763,8 @@ function doors.register_fencegate(name, def)
|
||||||
|
|
||||||
local fence_closed = table.copy(fence)
|
local fence_closed = table.copy(fence)
|
||||||
fence_closed.mesh = "doors_fencegate_closed.obj"
|
fence_closed.mesh = "doors_fencegate_closed.obj"
|
||||||
fence_closed.gate = name .. "_open"
|
fence_closed._gate = name .. "_open"
|
||||||
fence_closed.sound = "doors_fencegate_open"
|
fence_closed._gate_sound = "doors_fencegate_open"
|
||||||
fence_closed.collision_box = {
|
fence_closed.collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
|
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
|
||||||
|
@ -762,8 +772,8 @@ function doors.register_fencegate(name, def)
|
||||||
|
|
||||||
local fence_open = table.copy(fence)
|
local fence_open = table.copy(fence)
|
||||||
fence_open.mesh = "doors_fencegate_open.obj"
|
fence_open.mesh = "doors_fencegate_open.obj"
|
||||||
fence_open.gate = name .. "_closed"
|
fence_open._gate = name .. "_closed"
|
||||||
fence_open.sound = "doors_fencegate_close"
|
fence_open._gate_sound = "doors_fencegate_close"
|
||||||
fence_open.groups.not_in_creative_inventory = 1
|
fence_open.groups.not_in_creative_inventory = 1
|
||||||
fence_open.collision_box = {
|
fence_open.collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
|
Loading…
Reference in a new issue