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 = {
|
||||
description = def.description,
|
||||
drawtype = "mesh",
|
||||
tiles = {def.texture},
|
||||
tiles = {},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
|
@ -734,8 +734,8 @@ function doors.register_fencegate(name, def)
|
|||
sounds = def.sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
|
||||
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
|
||||
minetest.swap_node(pos, {name = node_def._gate, param2 = node.param2})
|
||||
minetest.sound_play(node_def._gate_sound, {pos = pos, gain = 0.3,
|
||||
max_hear_distance = 8})
|
||||
return itemstack
|
||||
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
|
||||
fence.sounds = default.node_sound_wood_defaults()
|
||||
end
|
||||
|
@ -753,8 +763,8 @@ function doors.register_fencegate(name, def)
|
|||
|
||||
local fence_closed = table.copy(fence)
|
||||
fence_closed.mesh = "doors_fencegate_closed.obj"
|
||||
fence_closed.gate = name .. "_open"
|
||||
fence_closed.sound = "doors_fencegate_open"
|
||||
fence_closed._gate = name .. "_open"
|
||||
fence_closed._gate_sound = "doors_fencegate_open"
|
||||
fence_closed.collision_box = {
|
||||
type = "fixed",
|
||||
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)
|
||||
fence_open.mesh = "doors_fencegate_open.obj"
|
||||
fence_open.gate = name .. "_closed"
|
||||
fence_open.sound = "doors_fencegate_close"
|
||||
fence_open._gate = name .. "_closed"
|
||||
fence_open._gate_sound = "doors_fencegate_close"
|
||||
fence_open.groups.not_in_creative_inventory = 1
|
||||
fence_open.collision_box = {
|
||||
type = "fixed",
|
||||
|
|
Loading…
Reference in a new issue