mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-18 07:40:22 +01:00
Add trapdoor/door model specification
This commit is contained in:
parent
76a08a7058
commit
ee46de28d3
@ -437,11 +437,19 @@ function doors.register(name, def)
|
|||||||
def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
||||||
def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
||||||
|
|
||||||
|
if def.model then
|
||||||
|
def.mesh = def.model .. "_a.obj"
|
||||||
|
minetest.register_node(":" .. name .. "_a", def)
|
||||||
|
|
||||||
|
def.mesh = def.model .. "_b.obj"
|
||||||
|
minetest.register_node(":" .. name .. "_b", def)
|
||||||
|
else
|
||||||
def.mesh = "door_a.obj"
|
def.mesh = "door_a.obj"
|
||||||
minetest.register_node(":" .. name .. "_a", def)
|
minetest.register_node(":" .. name .. "_a", def)
|
||||||
|
|
||||||
def.mesh = "door_b.obj"
|
def.mesh = "door_b.obj"
|
||||||
minetest.register_node(":" .. name .. "_b", def)
|
minetest.register_node(":" .. name .. "_b", def)
|
||||||
|
end
|
||||||
|
|
||||||
doors.registered_doors[name .. "_a"] = true
|
doors.registered_doors[name .. "_a"] = true
|
||||||
doors.registered_doors[name .. "_b"] = true
|
doors.registered_doors[name .. "_b"] = true
|
||||||
@ -460,7 +468,7 @@ doors.register("door_wood", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
doors.register("door_steel", {
|
doors.register("door_steel", {
|
||||||
tiles = {{name = "doors_door_steel.png", backface_culling = true}},
|
tiles = {{ name = "doors_door_steel.png", backface_culling = true }},
|
||||||
description = "Steel Door",
|
description = "Steel Door",
|
||||||
inventory_image = "doors_item_steel.png",
|
inventory_image = "doors_item_steel.png",
|
||||||
protected = true,
|
protected = true,
|
||||||
@ -634,10 +642,14 @@ function doors.register_trapdoor(name, def)
|
|||||||
local def_opened = table.copy(def)
|
local def_opened = table.copy(def)
|
||||||
local def_closed = table.copy(def)
|
local def_closed = table.copy(def)
|
||||||
|
|
||||||
|
if def.closed and def.opened then
|
||||||
|
def_closed.node_box = def.closed
|
||||||
|
else
|
||||||
def_closed.node_box = {
|
def_closed.node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
||||||
}
|
}
|
||||||
|
end
|
||||||
def_closed.selection_box = {
|
def_closed.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
||||||
@ -651,10 +663,14 @@ function doors.register_trapdoor(name, def)
|
|||||||
def.tile_side
|
def.tile_side
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if def.opened and def.closed then
|
||||||
|
def_opened.node_box = def.opened
|
||||||
|
else
|
||||||
def_opened.node_box = {
|
def_opened.node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
||||||
}
|
}
|
||||||
|
end
|
||||||
def_opened.selection_box = {
|
def_opened.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
||||||
|
Loading…
Reference in New Issue
Block a user