Paste #32917: Untitled Paste

Date: 2016/04/19 19:46:22 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


boolean:
    - goto '<t[<def[orderedRegions].equals_case_sensitive[li@__global__]>]:GLOBAL||REGION>'
    # Global Event Handler.
    - mark 'GLOBAL'
    - define thisRegion '__global__'
    - goto '<yaml[dRegions_%world%_cache].read[cache.boolean.__global__.%flag%]||a>'
    - mark 'a'
    - goto '<proc[dRegions_GetInheritedFlag].context[%world%|__global__|%flag%]>'
    # Region Event Handler.
    - mark 'REGION'
    - define thisRegion '<def[orderedRegions].get[1]>'
    - if '<s@dRegions_Flag_%flag%.yaml_key[region_highestOnly]||false>' {
      - goto '<yaml[dRegions_%world%_cache].read[cache.boolean.%thisRegion%.%flag%]||b>'
      - mark 'b'
      - goto '<proc[dRegions_GetInheritedFlag].context[%world%|%thisRegion%|%flag%]>'
      }
    - foreach '%orderedRegions%' {
      - define finalRegion '%value%'
      - goto '<yaml[dRegions_%world%_cache].read[cache.boolean.%finalRegion%.%flag%]||c>'
      - mark 'c'
      - define flagObj '<proc[dRegions_GetInheritedFlag].context[%world%|%value%|%flag%]>'
      - if '<def[flagObj].equals_case_sensitive[none].not>' {
        - foreach stop
        }
      }
    - goto '%flagObj%'
    # This code is shared by the global and the region handlers
    - mark 'true'
    - yaml set 'cache.boolean.%thisRegion%.%flag%:true' 'id:dRegions_%world%_cache'
    - mark 'none'
    - inject 's@dRegions_Flag_%flag%' 'p:event-allowed'
    # This foreach takes the event to the next flag if it exists
    - foreach next
    - queue clear
    - mark 'false'
    - yaml set 'cache.boolean.%thisRegion%.%flag%:false' 'id:dRegions_%world%_cache'
    - inject 's@dRegions_Flag_%flag%' 'p:event-cancelled'
    - if <def[noCancel].exists> {
      - foreach next
      - queue clear
      }
    - determine cancelled