Paste #9881: Untitled Paste

Date: 2014/09/20 19:33:43 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


MasterChefNPC:
  type: assignment
  debug: false

  actions:
    on assignment:
      - run locally assignment instantly
    on spawn:
      - run locally spawn instantly
    on despawn:
      - run locally despawn instantly

  findFridge:
  # The Fridge is 2 ironblocks tall with a stone button on the front of the top block
    - define ironBlocks <npc.location.find.blocks[iron_block].within[%range%]||null>
    - if <def[ironBlocks].is[!=].to[null]>
      && !<def[ironBlocks].is_empty> {
      - define locations li@
      - foreach %ironBlocks% {
        - define iron '%value%'
        - if <def[iron].sub[0,1,0].material.is[!=].to[iron_block]||true> foreach next

        - define east '<def[iron].add[1,0,0]>'
        - define west '<def[iron].add[-1,0,0]>'
        - define north '<def[iron].add[0,0,1]>'
        - define south '<def[iron].add[0,0,-1]>'
        - define cardinals li@east|west|north|south

        - foreach %cardinals% {
          - define location '<def[%value%]>'

          - if <def[location].material.name.is[==].to[stone_button]>
            && <def[location].sub[0,1,0].material.name.is[==].to[air]>
            && <def[location].sub[0,2,0].material.is_solid> {
            - define locations <def[locations].include[<def[location].below>]>
            }
          }
        }
      }