Guest User

Locked Doors mod init.lua

a guest
Sep 30th, 2013
19
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function doorOpen(pos,node, hitter)
  2.     --get the metadata since set_node removes it
  3.     local meta = minetest.env:get_meta(pos)
  4.     local name = meta:get_string("owner")
  5.     local open = meta:get_int("open")
  6.     local close = meta:get_int("close")
  7.     local otherHalf
  8.     local otherHalfNode
  9.     local doorState
  10.     if hitter:get_player_name() == name then
  11.         if string.find(node.name, "open") then
  12.             doorState = close
  13.         else
  14.             doorState = open
  15.         end
  16.         if string.find(node.name,"Top") then
  17.             otherHalf= {x = pos.x, y = pos.y-1, z = pos.z}
  18.             if node.name == "locked_door:lockedDoorTop" then
  19.                 newName = "locked_door:openDoorTop"
  20.                 otherNewName = "locked_door:openDoor"
  21.             elseif node.name == "locked_door:openDoorTop" then
  22.                 newName = "locked_door:lockedDoorTop"
  23.                 otherNewName = "locked_door:lockedDoor"
  24.             end
  25.         else
  26.             otherHalf = {x = pos.x, y = pos.y+1, z = pos.z}
  27.             if node.name == "locked_door:lockedDoor" then
  28.                 newName = "locked_door:openDoor"
  29.                 otherNewName = "locked_door:openDoorTop"
  30.             elseif node.name == "locked_door:openDoor" then
  31.                 newName = "locked_door:lockedDoor"
  32.                 otherNewName = "locked_door:lockedDoorTop"
  33.             end
  34.         end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×