Skip to content

Region

A Region is an engine-defined sub-volume of space with environmental properties. Resource regions (where asteroids spawn), hazardous regions (Wave anomaly zones), and nebula regions all use this class. The region datatype is empty (scriptproperties.xml:1356) — region effects are exposed through position-test accessors on Sector, Cluster, and Zone.

Inheritance: component → region. Like Nav beacon, region is a class label with no own properties.

There are no region-specific properties. Region effects are read via:

AccessorDescription
Sector.hashazardousregionSector has any hazardous region
Sector.hashazardousregionat.{position}A specific position is inside a hazardous region
Sector.isregioncurrentlyhazardousat.{position}Position is in a currently active hazardous region
Sector.hasgravidarobscuringregionSector has a nebula (gravidar-obscuring) region
Sector.gravidarfactorat.{position}Gravidar interference at the position (0..1)
Sector.resourcesAll resource wares present (driven by resource regions)
Sector.yieldrating.{ware}Sector’s yield rating for a ware
AccessorDescription
Cluster.hashazardousregionat.{position}Cluster position is in a hazardous region
Cluster.isregioncurrentlyhazardousat.{position}Currently active hazardous
Cluster.gravidarfactorat.{position}Gravidar at cluster position
AccessorDescription
Zone.hashazardousregionat.{position}Zone position is in a hazardous region
Zone.isregioncurrentlyhazardousat.{position}Currently active

The accessors are layered — galaxy → cluster → sector → zone. Each level projects the same region info via position-tests.

Vanilla regions fall into a few categories (data defined in libraries/regions.xml and similar):

TypeEffectRead via
Resource regionAsteroids spawn, mining yieldSector.resources, Sector.yieldrating.{ware}
Hazardous regionDamage over time, Wave anomalyhashazardousregionat.{position}
Gravidar-obscuring (nebula)Radar reductiongravidarfactorat.{position}, hasgravidarobscuringregion

There is no class.region.resource / class.region.hazardous enum — type discrimination happens via the accessor used to test.

<do_if value="$Sector.isregioncurrentlyhazardousat.{$Position}">
<!-- not safe — pick another spot -->
</do_if>

The currentlyhazardous form accounts for the fact that some regions cycle (active / inactive).

”Pick a position inside a nebula sector”

Section titled “”Pick a position inside a nebula sector””

Use the vanilla library:

<run_actions
ref="md.LIB_Generic.GetGravidarObscuringSectorPosition"
result="$pos">
<param name="Sector" value="$NebulaSector"/>
</run_actions>

Pattern from lib_generic.xml:1384. Wraps the gravidar accessor and picks a usable position.

”Filter sectors that have nebula regions”

Section titled “”Filter sectors that have nebula regions””
<find_sector
name="$NebulaSectors"
space="player.galaxy"
hasgravidarobscuringregion="true"
multiple="true"
extension="''"/>

Pattern from vanilla factionlogic_stations.xml:298. The hasgravidarobscuringregion="true" filter on find_sector is dedicated.

<set_value name="$OreRating"
exact="$Sector.yieldrating.{ware.ore}"/>
<do_if value="$OreRating ge 10">
<!-- rich ore sector -->
</do_if>

Yield rating is 0..15 (same scale as Resource probe).

  • Region datatype declares NO properties. All region info comes via parent (cluster / sector / zone) position-test accessors.
  • hashazardousregionat (static) vs isregioncurrentlyhazardousat (current). The first is “this position is inside a defined hazardous region”; the second is “…and it’s hazardous right now”. Some regions cycle.
  • No find_object class=class.region. Regions are not first-class objects in the find-graph. Use sector/cluster/zone accessors instead.
  • gravidarfactorat returns 0..1. 0 = clear, 1 = full obscure. Treat as a multiplier.
  • Multiple regions can overlap. A position can be in both a nebula AND a hazardous region. Accessors don’t disambiguate which region triggered the effect.
  • Position arguments are in the relevant space’s coordinates. Sector.hashazardousregionat.{$pos} expects sector-local coords; Cluster.X expects cluster-coords. They differ for the same logical position.
<set_value name="$Attempt" exact="0"/>
<set_value name="$Position" exact="null"/>
<do_while value="$Attempt lt 10 and not @$Position">
<set_value name="$Candidate"
exact="position.[random.range.5km..30km,
0,
random.range.5km..30km]"/>
<do_if value="not $Sector.isregioncurrentlyhazardousat.{$Candidate}">
<set_value name="$Position" exact="$Candidate"/>
</do_if>
<set_value name="$Attempt"
operation="add" exact="1"/>
</do_while>
<do_if value="@$Position">
<write_to_logbook
text="'Safe position found: ' + $Position"/>
</do_if>

Example 2: Find all mining-rich sectors for a ware

Section titled “Example 2: Find all mining-rich sectors for a ware”
<find_sector
name="$Sectors"
space="player.galaxy"
multiple="true"
extension="''"/>
<create_list name="$Rich"/>
<do_for_each name="$s" in="$Sectors">
<do_if value="$s.yieldrating.{ware.silicon} ge 12">
<append_to_list name="$Rich" exact="$s"/>
</do_if>
</do_for_each>
<write_to_logbook
text="$Rich.count + ' rich silicon sectors'"/>
  • Region system: Architectural overview Region mechanics — how libraries/regions.xml projects environmental effects onto sectors/clusters/zones.
  • The Wave anomaly: Architectural overview The Wave — a runtime-toggling hazardous region in specific sectors.
  • Nebula gravidar mechanics: Architectural overview Nebula combat — gravidar reduction effects on weapon ranges and detection.
  • Sector — primary parent that exposes region effects.
  • Cluster — also exposes region effects (galaxy-level).
  • Zone — also exposes region effects (sector-level).
  • Asteroid — what spawns in resource regions.
  • Resource probe — scans for regions’ yield.