mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-09 09:13:50 +01:00
Add trapdoor/door model specification (#2371)
This commit is contained in:
parent
a5547a3a76
commit
172b62f802
@ -218,6 +218,8 @@ The doors mod allows modders to register custom doors and trapdoors.
|
|||||||
description = "Door description",
|
description = "Door description",
|
||||||
inventory_image = "mod_door_inv.png",
|
inventory_image = "mod_door_inv.png",
|
||||||
groups = {choppy = 2},
|
groups = {choppy = 2},
|
||||||
|
model = "mod_door", -- (optional)
|
||||||
|
-- Model name without a suffix ("big_door" not "big_door_a.obj", "big_door_b.obj")
|
||||||
tiles = {"mod_door.png"}, -- UV map.
|
tiles = {"mod_door.png"}, -- UV map.
|
||||||
-- The front and back of the door must be identical in appearence as they swap on
|
-- The front and back of the door must be identical in appearence as they swap on
|
||||||
-- open/close.
|
-- open/close.
|
||||||
@ -236,6 +238,9 @@ The doors mod allows modders to register custom doors and trapdoors.
|
|||||||
|
|
||||||
description = "Trapdoor description",
|
description = "Trapdoor description",
|
||||||
inventory_image = "mod_trapdoor_inv.png",
|
inventory_image = "mod_trapdoor_inv.png",
|
||||||
|
nodebox_closed = {} -- Nodebox for closed model
|
||||||
|
nodebox_opened = {} -- Nodebox for opened model
|
||||||
|
-- (optional) both nodeboxes must be used, not one only
|
||||||
groups = {choppy = 2},
|
groups = {choppy = 2},
|
||||||
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
|
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
|
||||||
tile_side = "doors_trapdoor_side.png",
|
tile_side = "doors_trapdoor_side.png",
|
||||||
|
@ -670,10 +670,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)
|
||||||
|
|
||||||
def_closed.node_box = {
|
if def.nodebox_closed and def.nodebox_opened then
|
||||||
type = "fixed",
|
def_closed.node_box = def.nodebox_closed
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
else
|
||||||
}
|
def_closed.node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
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}
|
||||||
@ -687,10 +691,14 @@ function doors.register_trapdoor(name, def)
|
|||||||
def.tile_side
|
def.tile_side
|
||||||
}
|
}
|
||||||
|
|
||||||
def_opened.node_box = {
|
if def.nodebox_opened and def.nodebox_closed then
|
||||||
type = "fixed",
|
def_opened.node_box = def.nodebox_opened
|
||||||
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
else
|
||||||
}
|
def_opened.node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
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