forked from minetest/minetest_game
Add backface_culling to open chests and fencegates
This commit is contained in:
parent
0f7d0bfd7a
commit
2e413b521a
@ -155,7 +155,8 @@ The doors mod allows modders to register custom doors and trapdoors.
|
|||||||
### Fence gate definition
|
### Fence gate definition
|
||||||
|
|
||||||
description = "Wooden Fence Gate",
|
description = "Wooden Fence Gate",
|
||||||
texture = "default_wood.png",
|
texture = "default_wood.png", -- `backface_culling` will automatically be
|
||||||
|
-- set to `true` if not specified.
|
||||||
material = "default:wood",
|
material = "default:wood",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
sounds = default.node_sound_wood_defaults(), -- optional
|
sounds = default.node_sound_wood_defaults(), -- optional
|
||||||
|
@ -1990,12 +1990,19 @@ function default.register_chest(name, d)
|
|||||||
local def_closed = table.copy(def)
|
local def_closed = table.copy(def)
|
||||||
|
|
||||||
def_opened.mesh = "chest_open.obj"
|
def_opened.mesh = "chest_open.obj"
|
||||||
|
for i = 1, #def_opened.tiles do
|
||||||
|
if type(def_opened.tiles[i]) == "string" then
|
||||||
|
def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
|
||||||
|
elseif def_opened.tiles[i].backface_culling == nil then
|
||||||
|
def_opened.tiles[i].backface_culling = true
|
||||||
|
end
|
||||||
|
end
|
||||||
def_opened.drop = "default:" .. name
|
def_opened.drop = "default:" .. name
|
||||||
def_opened.groups.not_in_creative_inventory = 1
|
def_opened.groups.not_in_creative_inventory = 1
|
||||||
def_opened.selection_box = {
|
def_opened.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
||||||
}
|
}
|
||||||
def_opened.can_dig = function()
|
def_opened.can_dig = function()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -712,7 +712,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,6 +734,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
|
||||||
|
Loading…
Reference in New Issue
Block a user