Paste #35916: Edit of P#14609 Double Doors

Date: 2016/09/10 01:45:16 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DoubleDoorsEvents:
  type: world
  debug: false
  default 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%
        - flag server "DoubleDoorScriptUsageCountNumber:++"
        }
      }
    on system time hourly:
    - webget "http://stats.denizenscript.com/tracker?script=12&version=your%20mom&used=<server.flag[DoubleDoorScriptUsageCountNumber]>"