Paste #13648: Untitled Paste

Date: 2015/02/05 19:33:45 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


dRegions_GetInheritedFlag:
  # Get a region flag value. Start at current child and ascend through parents
  # until a value is set or you reach the origin ancestor
  # <proc[dRegions_GetInheritedFlag].context[world|region|flag]>
  type: procedure
  definitions: world|region|flag
  debug: false

  script:
    - define return '<yaml[dRegions_%world%_regions].read[regions.%region%.flags.%flag%]||null>'
    - define thisRegion '<def[region]>'
    - while <def[return].is[==].to[null]||false> {
      - define thisRegion '<yaml[dRegions_%world%_regions].read[regions.%thisRegion%.parent]||null>'
      - if <def[thisRegion].is[==].to[null]||false>
        || <def[loop_index].is[MORE].than[25]||false> {
        - while stop
        }
      - define return '<yaml[dRegions_%world%_regions].read[regions.%thisRegion%.flags.%flag%]||null>'
      }
    - determine '<def[return]||null>'