Date: 2015/02/05 19:33:45 UTC-08:00
Type: Denizen Script
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>'