Paste #4286: Check schematic

Date: 2014/05/12 06:52:45 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


CanPlaceSchematic:
  type: procedure

  definitions: schematic|location|ignoreDest|ignoreSource

  script:
  - if %ignoreDest% == false define %ignoreDest%
  - schematic load name:%schematic%
  - define startPoint <%location%.sub[<schematic[%schematic%].origin>]>
  - repeat <schematic[%schematic%].height> {
    - define height %value%
    - repeat <schematic[%schematic%].width> {
      - define width %value%
      - repeat <schematic[%schematic%].length> {
        - define length %value%
        - if <%ignoreSource%.find[<schematic[%schematic%].block[<l@%width%,%height%,%length%,<%location%.world.name>>]>]> < 0 {
          - if %ignoreSource% == null {
            - schematic unload name:%schematic%
            - determine false
            }
            else {
            - if <%ignoreDest%.find[<%startPoint%.add[<l@%width%,%height%,%length%,<%location%.world.name>>].block>]> < 0 {
              - schematic unload name:%schematic%
              - determine false
              }
            }
          }
        }
      }
    }
  - schematic unload name:%schematic%
  - determine true