Skip to content
Browse files

Doors: Allow schematic placement of wooden doors.

If LVM or some other nonmetadata method is used to place a door,
then metadata is missing that tells us whether the door is left
or right-hinged.

However, we can detect that nodemeta is missing and see if the node
name is _a or _b. In the case of _a, nothing needs to be done and we
can just open the door. In the case of _b we assume the door is right
hinged, and tune the state nodemeta value so that the door opens the
right way. This all of course assumes that the schematic method places
the doors *closed* by default, which is reasonable.
  • Loading branch information
sofar authored and paramat committed Mar 21, 2016
1 parent 1a5f89e commit ffba9d978e2b1414c7c80ddf8c1615cbd839c993
Showing with 10 additions and 1 deletion.
  1. +10 −1 mods/doors/init.lua
@@ -132,10 +132,19 @@ local transform = {

function _doors.door_toggle(pos, clicker)
local meta = minetest.get_meta(pos)
local state = meta:get_int("state")
local def = minetest.registered_nodes[minetest.get_node(pos).name]
local name =

local state = meta:get_string("state")
if state == "" then
-- fix up lvm-placed right-hinged doors, default closed
if minetest.get_node(pos).name:sub(-2) == "_b" then
state = 2
state = tonumber(state)

if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
local owner = meta:get_string("doors_owner")
if owner ~= "" then

0 comments on commit ffba9d9

Please sign in to comment.
You can’t perform that action at this time.