Paste #12344: Edit of P#12310 Double Doors

Date: 2014/12/28 17:28:35 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DoubleDoorsEvents:
  type: world
  debug: false
  constants:
    directions:
    - 0,0,1
    - 1,0,0
    - 0,0,-1
    - -1,0,0
    - 0,0,-1
    - -1,0,0
    - 0,0,1
    - 1,0,0
  events:
    on player right clicks block:
    - define loc <context.location.block>
    - if <def[loc].material.name.ends_with[door]> {
      - define data <def[loc].material.data>
      - if %data% > 7 {
        - define loc <context.location.block.sub[0,1,0]>
        - define data <def[loc].material.data>
        }
      - define direction <script.constant[directions].get[<def[data].add[1]>]>
      - define top_data <def[loc].add[0,1,0].material.data>
      - define other <def[loc].add[%direction%]>
      - define other_top <def[other].add[0,1,0].material.data>
      - if <def[other].material.name.ends_with[door]> && <def[other].material.data> == %data% && %other_top% != %top_data% {
        - switch %other%
        - queue clear
        }
      - define other <def[loc].sub[%direction%]>
      - define other_top <def[other].add[0,1,0].material.data>
      - if <def[other].material.name.ends_with[door]> && <def[other].material.data> == %data% && %other_top% != %top_data% {
        - switch %other%
        }
      }