XRWS          "v  ‹ ëext_01.cat ext_01.dat libraries/aiscripts.xsd 144100 1542811842 2055ca7749dc65c4d057f36d6eea25c8
libraries/common.xsd 1026038 1543497992 c6b81297c1f4a5b2c532bddfed1baef2
libraries/drops.xsd 7757 1524728287 6a7dd9e9d8708a24b1dce7fe3ae76d4a
libraries/factions.xsd 16959 1539284040 e60072556bab5f8fd41746e6bf73eeed
libraries/gamestarts.xsd 24378 1543272239 a879efe55a7f18f421afdbbfd804952b
libraries/libraries.xsd 68295 1541886894 c0e0bf84120bf62af2facb33bea602e4
libraries/loadoutrules.xsd 11871 1529335178 8608c909a16b72f69c0a62a2f9835ee6
libraries/material_library.xsd 5960 1535620717 9a6049e525946e65fd7a0d46301f13d9
libraries/md.xsd 112136 1542198014 6492a5ef21f82cb30e29e98b2ddf1026
libraries/objectspawnpoints.xsd 5863 1491479139 8b32521e6d8290ec7769749bee75972f
libraries/objectspawnrules.xsd 7143 1536935167 9d02a185536b00ac52d7f6475e8269cc
libraries/parameters.xsd 126884 1542800046 900b84aa2fab0705a1cc895129029ddd
libraries/people.xsd 900 1491572109 d50f4511a238f3b3455caa2ec9250907
libraries/quotas.xsd 17961 1534932817 8569f906050aec71e9fa625a1b6e35c5
libraries/races.xsd 9055 1537439211 49dbb0a094b842c2c364e850fe6e0be5
libraries/region_definitions.xsd 31485 1537275351 e96ef60350ba44c0a4e163c1fe1e227c
libraries/regionobjectgroups.xsd 3167 1539164675 677e87bd71bbdb0c0f5b980a8308c269
libraries/regionyields.xsd 5166 1526030639 e20a442b32b2726e566cefd4478aae81
libraries/scriptproperties.xsd 8980 1505734149 7e137e33081fec75b9f51a4367e0a769
libraries/sound_library.xsd 24256 1523440184 202193e553d065819526e50027033bf9
libraries/stats.xsd 12092 1543501350 6d571512738d2bebe4cdcd10bb5e7b18
libraries/timeline.xsd 2515 1531476394 5cac130a70419550499189519d20a8f5
libraries/unlocks.xsd 21428 1542800046 a53bb1be86af7cb0782756be5cb10e89
libraries/voicesequences.xsd 4504 1531319808 0c94303fcc1775db3c4b3f7e2c8d0c9c
md/md.xsd 207 1434634445 55fb063dcc1445f92bc2458bab10e858
md/Missions_Bonus.xml 11727 1544792691 d3c78f34f7880d9b973f9ab438efa6d2
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <!-- Script name starts with letter, . is allowed, this is different from MD scripts etc. -->
  <xs:simpleType name="aiscriptname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[!A-Za-z][A-Za-z0-9_.]+" />
    </xs:restriction>
  </xs:simpleType>

  <!-- ===== Text simple types ==== -->

  <xs:simpleType name="labelname">
    <xs:annotation>
      <xs:documentation>
        Label name
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="interrupt_conditionsref">
    <xs:annotation>
      <xs:documentation>
        Name of a library interrupt condition set
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="interrupt_actionsref">
    <xs:annotation>
      <xs:documentation>
        Name of a library interrupt action set
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="interrupt_handlerref">
    <xs:annotation>
      <xs:documentation>
        Name of a library interrupt handler
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="resumeflag">
    <xs:annotation>
      <xs:documentation>
        Resume this action when an interrupt script returns, instead of resuming at a label? This has no effect if a resume attribute was specified in &lt;run_interrupt_script&gt;.
        If the action was already completed during the interrupt, the script will continue after the action immediately.
        Note that changing the resume attribute has no effect on existing savegames. The resume state will be restored as it was saved before, even if the attribute changes in the script.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <!-- ===== Enumeration simple types ==== -->

  <xs:simpleType name="fbehaviourlookup">
    <xs:annotation>
      <xs:documentation>
        Flight behaviour
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="flightbehaviour.default" />
          <xs:enumeration value="flightbehaviour.none" />
          <xs:enumeration value="flightbehaviour.gaindistance" />
          <xs:enumeration value="flightbehaviour.generic" />
          <xs:enumeration value="flightbehaviour.guidedmissile" />
          <xs:enumeration value="flightbehaviour.swarmmissile" />
          <xs:enumeration value="flightbehaviour.attackrun" />
          <xs:enumeration value="flightbehaviour.dogfight1" />
          <xs:enumeration value="flightbehaviour.dogfight2" />
          <xs:enumeration value="flightbehaviour.bigfight" />
          <xs:enumeration value="flightbehaviour.evasive_loop" />
          <xs:enumeration value="flightbehaviour.evasive_simple" />
          <xs:enumeration value="flightbehaviour.evasive_random" />
          <xs:enumeration value="flightbehaviour.evasive_roll" />
          <xs:enumeration value="flightbehaviour.evasive_spiral" />
          <xs:enumeration value="flightbehaviour.swarmdrone" />
          <xs:enumeration value="flightbehaviour.chase" />
          <xs:enumeration value="flightbehaviour.hardbrake" />
          <xs:enumeration value="flightbehaviour.crazyivan" />
          <xs:enumeration value="flightbehaviour.spiral" />
          <xs:enumeration value="flightbehaviour.halfloop" />
          <xs:enumeration value="flightbehaviour.loop" />
          <xs:enumeration value="flightbehaviour.dock" />
          <xs:enumeration value="flightbehaviour.undock" />
          <xs:enumeration value="flightbehaviour.pickup" />
          <xs:enumeration value="flightbehaviour.observe" />
          <xs:enumeration value="flightbehaviour.mining" />
          <xs:enumeration value="flightbehaviour.boardingpod" />
          <xs:enumeration value="flightbehaviour.dock_highspeed" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="fcmlookup">
    <xs:annotation>
      <xs:documentation>
        Flight control model
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="flightcontrolmodel.forced" />
          <xs:enumeration value="flightcontrolmodel.highway" />
          <xs:enumeration value="flightcontrolmodel.linear" />
          <xs:enumeration value="flightcontrolmodel.spline" />
          <xs:enumeration value="flightcontrolmodel.steering" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <!-- ===== Commands ==== -->

  <xs:simpleType name="commandlookup">
    <xs:annotation>
      <xs:documentation>
        Command
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="command.attackenemies">
            <xs:annotation>
              <xs:documentation>
                Attack Enemies Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.attackobject">
            <xs:annotation>
              <xs:documentation>
                Attack Object Command (param = the target to attack)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.buildexpansion">
            <xs:annotation>
              <xs:documentation>
                Build Expansion Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.buildship">
            <xs:annotation>
              <xs:documentation>
                Build Ship Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.buildstation">
            <xs:annotation>
              <xs:documentation>
                Build Station Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.buildupgrades">
            <xs:annotation>
              <xs:documentation>
                Build Upgrades Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.collect">
            <xs:annotation>
              <xs:documentation>
                Collect Command (param = the object to collect)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.dockat">
            <xs:annotation>
              <xs:documentation>
                Dock at Command (param = the object to dock at)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.freemining">
            <xs:annotation>
              <xs:documentation>
                Free Mining Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.freetrade">
            <xs:annotation>
              <xs:documentation>
                Free Trading Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.follow">
            <xs:annotation>
              <xs:documentation>
                Follow Command (param = the object to follow)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.escort">
            <xs:annotation>
              <xs:documentation>
                Escort Command (param = the object to escort)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.mining">
            <xs:annotation>
              <xs:documentation>
                Mining Command (param = the zone where stuff is mined)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.move">
            <xs:annotation>
              <xs:documentation>
                Move Command for object (param = the object to fly to)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.movetozone">
            <xs:annotation>
              <xs:documentation>
                Move Command for zone (param = the zone to fly to)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.patrol">
            <xs:annotation>
              <xs:documentation>
                Patrol Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.police">
            <xs:annotation>
              <xs:documentation>
                Police Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.protect">
            <xs:annotation>
              <xs:documentation>
                Protect Command (param = the object to protect)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.refuel">
            <xs:annotation>
              <xs:documentation>
                Refuel Command (param = amount of fuel)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.repair">
            <xs:annotation>
              <xs:documentation>
                Repair Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.scan">
            <xs:annotation>
              <xs:documentation>
                Scan Object Command (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.support">
            <xs:annotation>
              <xs:documentation>
                Support Command (param = the object to support)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.searchresources">
            <xs:annotation>
              <xs:documentation>
                Search for Resources Command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.searchtrades">
            <xs:annotation>
              <xs:documentation>
                Search for Trades Command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.trade">
            <xs:annotation>
              <xs:documentation>
                Trade Command (param = the object to trade with)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.wait">
            <xs:annotation>
              <xs:documentation>
                Wait Command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.explore">
            <xs:annotation>
              <xs:documentation>
                Explore Command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.withdrawbattle">
            <xs:annotation>
              <xs:documentation>
                Withdraw from Battle Command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.resupply">
            <xs:annotation>
              <xs:documentation>
                Resupply command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.recon">
            <xs:annotation>
              <xs:documentation>
                Reconnoiter command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="command.investigate">
            <xs:annotation>
              <xs:documentation>
                Investigate command
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <!-- ===== Command Actions ==== -->

  <xs:simpleType name="commandactionlookup">
    <xs:annotation>
      <xs:documentation>
        Command action
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="commandaction.standingby">
            <xs:annotation>
              <xs:documentation>
                Stand By Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.calculating">
            <xs:annotation>
              <xs:documentation>
                Calculating parameters action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.repairingto">
            <xs:annotation>
              <xs:documentation>
                Reparing to component Command action (param = component to repair)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.repairchecking">
            <xs:annotation>
              <xs:documentation>
                Stand By Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.scanningto">
            <xs:annotation>
              <xs:documentation>
                Scanning to component Command action (param = component to scan)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.searchingresources">
            <xs:annotation>
              <xs:documentation>
                Searching resources Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.executingtrade">
            <xs:annotation>
              <xs:documentation>
                Executing Trade Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.docking">
            <xs:annotation>
              <xs:documentation>
                Docking Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.undocking">
            <xs:annotation>
              <xs:documentation>
                Undocking (also detach from masstraffic) Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.waitingtodock">
            <xs:annotation>
              <xs:documentation>
                Waiting for a free dock Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.attacking">
            <xs:annotation>
              <xs:documentation>
                Attacking Enemies Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.attackingto">
            <xs:annotation>
              <xs:documentation>
                Attacking to Enemy Command action (param = enemy object)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.flying">
            <xs:annotation>
              <xs:documentation>
                Flying Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.flyingto">
            <xs:annotation>
              <xs:documentation>
                Flying to zone Command action (param = destination zone)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.jumping">
            <xs:annotation>
              <xs:documentation>
                Jumping Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.searchingtrades">
            <xs:annotation>
              <xs:documentation>
                Searching for trades Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.waitingdrones">
            <xs:annotation>
              <xs:documentation>
                Waiting for drones to dock (detach from masstraffic) Command action (no param)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="commandaction.investigating">
            <xs:annotation>
              <xs:documentation>
                Investigating Object Command action (param = object being investigated)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <!-- ===== Attribute groups ==== -->

  <xs:attributeGroup name="blockingaction">
    <xs:attributeGroup ref="action" />
    <xs:attribute name="sinceversion" type="xs:nonNegativeInteger">
      <xs:annotation>
        <xs:documentation>
          Script version in which this blocking action was added
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- ===== Complex Types ===== -->

  <xs:complexType name="run_script_param">
    <xs:annotation>
      <xs:documentation>
        AI script parameter
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" type="paramname" use="required">
      <xs:annotation>
        <xs:documentation>
          Parameter name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          Parameter value
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- ===== Conditions ==== -->

  <!--
  <xs:group name="specificconditions_event">
    <xs:choice>

      <xs:element name="event_...">
      </xs:element>

    </xs:choice>
  </xs:group>
  -->

  <!--
  XML restriction: Elements with the same name and in the same scope must have the same type.
  Which means that check_all / check_any always have to behave the same, even if we know whether
  they are allowed to have event conditions or not. So we always allow them.
  -->

  <xs:group name="conditions_single_nonevent">
    <xs:choice>
      <xs:group ref="commonconditions_nonevent"/>
      <!-- There are no AI-specific non-event conditions -->
    </xs:choice>
  </xs:group>

  <xs:group name="conditions_single_event">
    <xs:choice>
      <xs:group ref="commonconditions_event"/>
      <!-- There are no AI-specific event conditions (yet) -->
      <!-- <xs:group ref="specificconditions_event"/> -->
    </xs:choice>
  </xs:group>

  <xs:group name="conditions_nonevent">
    <xs:choice>
      <xs:element name="check_all" type="checkall"/>
      <xs:element name="check_any" type="checkany"/>
      <xs:group ref="conditions_single_nonevent"/>
    </xs:choice>
  </xs:group>

  <xs:group name="conditions">
    <xs:sequence>
      <xs:group ref="conditions_single_event" minOccurs="0" maxOccurs="1"/>
      <xs:group ref="conditions_nonevent" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:group>

  <xs:complexType name="checkall">
    <xs:annotation>
      <xs:documentation>
        List of conditions all of which must be met
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="conditions"/>
    <xs:attributeGroup ref="condition" />
    <xs:attributeGroup ref="counting" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:complexType>

  <xs:complexType name="checkany">
    <xs:annotation>
      <xs:documentation>
        List of conditions any one of which must be met
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="check_all" type="checkall"/>
        <xs:element name="check_any" type="checkany"/>
        <xs:group ref="conditions_single_event"/>
        <xs:group ref="conditions_single_nonevent"/>
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="condition" />
    <xs:attributeGroup ref="counting" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:complexType>

  <xs:group name="blockingaction">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="on_attentionchange">
          <xs:annotation>
            <xs:documentation>
              Actions to be performed right before the script switches to a different &lt;attention&gt; block on an attention level change. Blocking actions are not allowed. &lt;break&gt; and &lt;continue&gt; only work on loops within the attention change actions. &lt;resume&gt; is supported.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="actions" />
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="interrupt_after_time">
          <xs:complexType>
            <xs:attribute name="time" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Time duration until timeout
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="interrupt">
          <xs:annotation>
            <xs:documentation>
              Conditionally interrupt a blocking action and perform certain actions when the interrupt occurs.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="conditions" type="interrupt_conditions_withref">
                <xs:annotation>
                  <xs:documentation>
                    Conditions that must be met in order for the interrupt to occur.
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="actions" type="interrupt_actions" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>
                    Actions to be performed on an interrupt. Blocking actions are not allowed. &lt;break&gt; and &lt;continue&gt; only work on loops within the interrupt actions.
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <!-- ===== Actions ==== -->

  <xs:group name="specificactions">
    <xs:choice>

      <xs:element name="add_ware_reservation">
        <xs:annotation>
          <xs:documentation>
            Reserve space for selling ware to an object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="container" use="required">
            <xs:annotation>
              <xs:documentation>
                The container where the reserver(object) wants to reserve space for an amount of ware.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" use="required">
            <xs:annotation>
              <xs:documentation>
                Buy or sell?
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="buy">
                  <xs:annotation>
                    <xs:documentation>
                      We want to buy, this will reduce sell-offer amounts.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="sell">
                  <xs:annotation>
                    <xs:documentation>
                      We want to sell, this will reduce buy-offer amounts.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="reserver" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Which object to reserve this amount for.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Positive number of units to reserve.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                Duration of this reservation (optional, defaults to 1 hour)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mission" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the reservation is for a mission trade (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="replace" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether amount should be added to any existing reservation or replace it. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="supplies" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether to check reservations for "supplies" (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="virtual" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether to look at the "real" or the "virtual" dataset - virtual reservations are IGNORED for trades. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The amount that is now reserved for this reserver. Can be different from amount if there already was a reservation. (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_ware_reservation">
        <xs:annotation>
          <xs:documentation>
            Remove a space reservation that was previously added with &lt;add_ware_reservation&gt; (fails silently if there was no matching reservation)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="container" use="required">
            <xs:annotation>
              <xs:documentation>
                The container from which to remove the reservation.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type">
            <xs:annotation>
              <xs:documentation>
                Type of reservation to remove (optional, defaults to all)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="buy">
                  <xs:annotation>
                    <xs:documentation>
                      Remove buy reservations only.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="sell">
                  <xs:annotation>
                    <xs:documentation>
                      Remove sell reservations only.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="reserver" type="object">
            <xs:annotation>
              <xs:documentation>
                Whose reservation to remove (optional, all reservations for ware (if specified) will be removed if omitted!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware">
            <xs:annotation>
              <xs:documentation>
                What reservations to remove (optional, all reservations for reserver (if specified) will be removed if omitted!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                How many units from the reservation to remove (optional, will remove all units if omitted, only has an effect if reserver and ware are specified!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mission" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the reservation is for a mission trade (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="supplies" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the reservation is for a supplies trade (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="virtual" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether to look at the "real" or the "virtual" dataset - virtual reservations are IGNORED for trades. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="dock_masstraffic_drone">
        <xs:annotation>
          <xs:documentation>
            Dock a masstraffic drone. Any picked up objects will be transferred to the cargostorage of destination (if possible). (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="destination" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Destination the drone should dock at. This object must have masstraffic docks defined! (Large+ ships or stations)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="immediate" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If docking process should happen immediately, the drone will be teleported to destination(optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="execute_custom_trade">
        <xs:annotation>
          <xs:documentation>
            Execute trade procedure, this will create the necessary trade and cause cargo to be transferred from seller to buyer (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction"/>
          <xs:attribute name="buyer" type="buyer" use="required" />
          <xs:attribute name="seller" type="seller" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount of goods to transfer
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attribute name="totalprice" type="expression">
            <xs:annotation>
              <xs:documentation>
                Total price of goods in this trade (defaults to 0! takes precedence over price)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="expression">
            <xs:annotation>
              <xs:documentation>
                Price per unit in this trade (defaults to 0! ignored if totalprice is set)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unbundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be unbundled on transfer? (turn ware into ammo for the recipient, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="trade" type="expression">
            <xs:annotation>
              <xs:documentation>
                Trade to be removed from shopping list, in case this action is aborted. Accessed by &lt;save_ai_action_state&gt;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="usecommandermoney" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Use money from the commanders' account to pay for this trade. Defaults to player account for player-owned ships without commander (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="resume" type="resumeflag" />
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="execute_trade">
        <xs:annotation>
          <xs:documentation>
            Execute trade procedure, this will cause cargo to be transferred (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction"/>
          <xs:attribute name="tradeoffer" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The trade offer (buy or sell) that is to be acted upon
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tradepartner" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object that wants to do the trade (if a ship wants to use a trade offer on a station, that station is the owner and the ship is the tradepartner)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Amount of goods to transfer, can not exceed amount in offer (0=default=all in offer)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="custom" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this using a trade(offer) that is not a Production or Script TradeOffer? (e.g. taken from a Ships' shopping list). Note that you must specify an amount if ware reservations are involved!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unbundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be unbundled on transfer? (turn ware into ammo for the recipient, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="resume" type="resumeflag" />
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="move_approach_path">
        <xs:annotation>
          <xs:documentation>
            Move along a dynamic path that will lead to the docking bay (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="destination" type="expression">
            <xs:annotation>
              <xs:documentation>
                Destination object (will be derived from docking bay if omitted)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The DockingBay that should be used for docking
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_docking">
        <xs:annotation>
          <xs:documentation>
            Move to dock (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Docking bay component slot (find using &lt;find_dockingbay&gt;)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup">
            <xs:annotation>
              <xs:documentation>
                Flight behaviour overrride, defaults to flightbehaviour.dock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcerotation" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should keep rotating to match the defined orientation at the end of the path (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forceposition" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object has to be in the exact given position at the end of the path (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_undocking">
        <xs:annotation>
          <xs:documentation>
            Move to undock (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="dock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Docking bay component slot
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcerotation" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should keep rotating to match the defined orientation at the end of the path (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forceposition" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object has to be in the exact given position at the end of the path (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup">
            <xs:annotation>
              <xs:documentation>
                Flight behaviour overrride, defaults to flightbehaviour.dock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_gate">
        <xs:annotation>
          <xs:documentation>
            Move through a Jump Gate, after the transition the ship will move out of the way of the gate (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="gate" type="expression">
            <xs:annotation>
              <xs:documentation>
                Jump Gate to go through
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_navmesh">
        <xs:annotation>
          <xs:documentation>
            Move to destination via navmesh (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="usemasstrafficlane" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If object is originates from mass traffic, plot a navmesh path that follows the original traffic lane
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="destination" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object that has the navmesh to fly over
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="avoid" type="booleanexpression" />
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="radius" type="expression">
            <xs:annotation>
              <xs:documentation>
                Radius of the target. Can be used by some flight behaviours (default, -1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_strafe">
        <xs:annotation>
          <xs:documentation>
            Move to destination by strafing (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="booleanexpression" />
          <xs:attribute name="destination" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Destination object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="avoid" type="booleanexpression" />
          <xs:attribute name="forcerotation" type="booleanexpression" />
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="radius" type="expression">
            <xs:annotation>
              <xs:documentation>
                Radius of the target. Can be used by some flight behaviours (default, -1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_target_points">
        <xs:annotation>
          <xs:documentation>
            Move to destination (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="nextposition" type="position" minOccurs="0" maxOccurs="1" >
              <xs:annotation>
                <xs:documentation>
                  Next position to look at for the last target point.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="boolean" />
          <xs:attribute name="destination" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Destination object (macro of this object will be used for target point lookup!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the target points
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reverse" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly to the target points in reverse order
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_waypoints">
        <xs:annotation>
          <xs:documentation>
            Move to destination using waypoint path (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="nextposition" type="position" minOccurs="0" maxOccurs="1" >
              <xs:annotation>
                <xs:documentation>
                  Next position to look at for the last waypoint.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="boolean" />
          <xs:attribute name="destination" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Destination object (will be used for waypoint lookup!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the waypoints
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="starttags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the start waypoint
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reverse" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly to the waypoints in reverse order
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="move_to">
        <xs:annotation>
          <xs:documentation>
            Move to destination (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="abortpath" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should abort the previous path points if any (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="finishonapproach" type="booleanexpression" >
            <xs:annotation>
              <xs:documentation>
                Whether the object should stop if the movement is approaching to finish (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="uselocalhighways" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether local highways should be used (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="destination" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Destination object or space
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" />
          <xs:attribute name="avoid" type="booleanexpression" />
          <xs:attribute name="forcerotation" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should keep rotating to match the defined orientation at the end of the path (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forceposition" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object has to be in the exact given position at the end of the path (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="relativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should fly in the coordinate space of the defined object as opposed to its parent component (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="torelativemovement" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should start flying in the coordinate space of the defined object as opposed to its parent component after this movement is done (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="forcesteering" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If this is true the ship will fly on steering flight control model (while in high attention), this is also implictely true if relativemovemt is true or the ship is flying in a formation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reverse" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Let the ship fly in reverse (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="radius" type="expression">
            <xs:annotation>
              <xs:documentation>
                Radius of the target. Can be used by some flight behaviours (default, -1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="boost" type="expression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should boost. The flight control model / behaviour can have the final say over when and if boosting actually happens. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="travel" type="expression">
            <xs:annotation>
              <xs:documentation>
                Whether the object should use travel mode. The flight control model / behaviour can have the final say over when and if travel mode actually happens. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="endzone" type="lvalueexpression" >
            <xs:annotation>
              <xs:documentation>
                Receives the true target zone that this move_to will end in, may be a tempzone that has just been created so this move_to can end there (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="resume">
        <xs:annotation>
          <xs:documentation>
            Resume at specified label. This is only supported in &lt;actions&gt; and &lt;init&gt;. In global interrupts, use &lt;run_interrupt_script&gt; or &lt;abort_called_scripts&gt; instead.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="label" type="labelname" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="return">
        <xs:annotation>
          <xs:documentation>
            Return to caller. In global interrupts and actions of &lt;on_abort&gt;, &lt;patch&gt; or &lt;editable&gt; elements, this action does not return to the caller and just aborts the current sequence of actions.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="retval" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Named return value
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Return value name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="value" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Return value
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="value" type="expression">
            <xs:annotation>
              <xs:documentation>
                Unnamed return value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
        <xs:key name="return_value">
          <xs:selector xpath="retval" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>

      <xs:element name="include_interrupt_actions">
        <xs:annotation>
          <xs:documentation>
            Perform the referenced library interrupt actions in the current script context
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ref" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of the library interrupt action set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="return_to_masstraffic">
        <xs:annotation>
          <xs:documentation>
            Instruct object to re-join the mass traffic, only works for ships that came from mass traffic in the first place!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="detach_from_masstraffic">
        <xs:annotation>
          <xs:documentation>
            (blocking) Instruct object to detach from mass traffic, e.g. after executing a trade - OK to call for ships that don't use mass traffic as well
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="blockingaction" />
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="wait" type="boolean" />
          <xs:attribute name="commandaction" type="boolean">
            <xs:annotation>
              <xs:documentation>
                If the current command action should be override with this action (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="run_script">
        <xs:annotation>
          <xs:documentation>
            Run script (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" type="run_script_param" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="save_retval" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Save named return value in a variable
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Return value name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="variable" type="lvaluename" use="required" />
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
            <!-- No blockingaction elements here -->
            <!-- <xs:group ref="blockingaction" /> -->
            <xs:element name="on_attentionchange" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Actions to be performed when called script returns, in case the attention level changed in the meantime. Blocking actions are not allowed. &lt;break&gt; and &lt;continue&gt; only work on loops within the attention change actions.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:group ref="actions" />
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Script name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
        <xs:key name="run_script_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
        <xs:key name="run_script_save_retval_name">
          <xs:selector xpath="save_retval" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>

      <xs:element name="run_order_script">
        <xs:annotation>
          <xs:documentation>
            Run order script (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <!-- No blockingaction elements here -->
            <!-- <xs:group ref="blockingaction" /> -->
            <xs:element name="on_attentionchange" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Actions to be performed when called script returns, in case the attention level changed in the meantime. Blocking actions are not allowed. &lt;break&gt; and &lt;continue&gt; only work on loops within the attention change actions.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:group ref="actions" />
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="order" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                AI order to be executed. It must be an object's current order and its state must be orderstate.ready.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="run_interrupt_script">
        <xs:annotation>
          <xs:documentation>
            Run a script on a global interrupt. The script will be executed on top of the current call-stack if its interrupt priority is high enough.
            No further interrupt actions will run after this action. This action is only allowed in global interrupt actions, but not in library actions.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" type="run_script_param" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Script name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="abortscripts" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If true then the scripts called by this script will be aborted before the interrupt script is started.
                If false (default) then the interrupt script will be started on top of the callstack.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="resume" type="labelname">
            <xs:annotation>
              <xs:documentation>
                Label to resume at when the interrupt script returns. By default the script will resume at the current label.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
        <xs:key name="run_interrupt_script_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>

      <xs:element name="abort_called_scripts">
        <xs:annotation>
          <xs:documentation>
            Abort scripts that were called by this script on a global interrupt. No further interrupt actions will run after this action
            and this script will resume at the current label. This action is only allowed in global interrupt actions, not in library actions.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="resume" type="labelname">
            <xs:annotation>
              <xs:documentation>
                Label to resume at after the interrupt. By default the script will resume at the current label.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="wait_for_prev_script">
        <xs:annotation>
          <xs:documentation>
            Wait for blocking action of previous AI script to complete (blocking).
            Requires information stored on this object via &lt;save_ai_action_state&gt;. Only a few specific blocking actions are handled here, in other cases no blocking happens.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="blockingaction" />
          </xs:sequence>
          <xs:attributeGroup ref="blockingaction" />
          <xs:attribute name="action" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Value that receives the name of the blocking action of the previous script
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Value that receives the event source object of the blocking action of the previous script
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Value that receives the first parameter of the blocking action of the previous script (depends on the action).
                For &lt;execute_custom_trade&gt; this is the buyer.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param2" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Value that receives the second parameter of the blocking action of the previous script (depends on the action).
                For &lt;execute_custom_trade&gt; this is the trade.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="select_flight_behaviour">
        <xs:annotation>
          <xs:documentation>
            Randomly select an appropriate flight behaviour for the given entity
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="required" />
          <xs:attribute name="evasive" type="boolean" use="required" />
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_command">
        <xs:annotation>
          <xs:documentation>
            Sets the current command for the script's entity. The command data will remain valid until either it's overwritten or this script ends. It becomes valid again automatically when a called script returns.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="command" type="commandlookup" use="required" />
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                Primary command parameter (meaning depends on command)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param2" type="expression">
            <xs:annotation>
              <xs:documentation>
                Secondary command parameter (meaning depends on command)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_command_action">
        <xs:annotation>
          <xs:documentation>
            Sets the current command action for the script's entity. The command action data will remain valid until either it's overwritten or this script ends. It becomes valid again automatically when a called script returns. The following blocking actions can override it: move_to actions ....
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="commandaction" type="commandactionlookup" use="required" />
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                Primary command action parameter (meaning depends on command action)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_flight_behaviour">
        <xs:annotation>
          <xs:documentation>
            Sets the default flight behaviour for this unit (can still be overridden per move_to order)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="flightbehaviour" type="fbehaviourlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_flight_control_model">
        <xs:annotation>
          <xs:documentation>
            Overrides this unit's default flight control model
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="flightcontrolmodel" type="fcmlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_to_default_flight_control_model">
        <xs:annotation>
          <xs:documentation>
            Resets the unit to use the default flight control model
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_avoid_collisions">
        <xs:annotation>
          <xs:documentation>
            Enables/disabled collision avoidance for this object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="bigobjects" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Whether this object should use octree path finding to navigate to its target
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="smallobjects" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Whether this object should use dynamically avoid nearby ships of similar or smaller size
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_flight_assist">
        <xs:annotation>
          <xs:documentation>
            Enables/disables flight assist for this object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="enabled" type="booleanexpression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="shoot">
        <xs:annotation>
          <xs:documentation>
            Start shooting a weapon
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="primary" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Which weapon set to shoot with (true for primary, false for secondary)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="weaponmode" type="weaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Only weapons/turrets set to the specified mode will shoot at the target, defaults to any.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="shoot_at">
        <xs:annotation>
          <xs:documentation>
            Shoot at target when the opportunity arises
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="attacker" use="required" />
          <xs:attribute name="primary" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Which weapon set to shoot with (true for primary, false for secondary)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="targetobject" use="required" />
          <xs:attribute name="additional_targets" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Optional list of additional targets that may be fired upon if opportunity arises (not supported together with largetarget=true). The object specified by the target attribute must not be in this list (will be ignored and an error will be logged otherwise)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tolerance" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Tolerance angle
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="fixedtarget" type="expression">
            <xs:annotation>
              <xs:documentation>
                Prevent target from being overridden? Default is false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="largetarget" type="expression">
            <xs:annotation>
              <xs:documentation>
                Is the target a very large object, e.g. a station? Default is false (does not support additonal targets)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="weaponmode" type="weaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Only weapons/turrets set to the specified mode will shoot at the target(s), defaults to any.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_moving">
        <xs:annotation>
          <xs:documentation>
            Stop moving
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="immediate" type="boolean" />
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_shooting">
        <xs:annotation>
          <xs:documentation>
            Stop shooting
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="primary" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Which weapon set to stop shooting (true for primary, false for secondary)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="wait">
        <xs:annotation>
          <xs:documentation>
            Wait (sleep) for specified time duration (blocking)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="blockingaction" />
          <xs:attributeGroup ref="blockingaction" />
          <xs:attributeGroup ref="random" />
          <xs:attribute name="resume" type="resumeflag" />
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <xs:group name="actionchoice">
    <xs:choice>
      <xs:element name="do_all" type="doall"/>
      <xs:element name="do_any" type="doany"/>
      <xs:sequence>
        <xs:element name="do_if" type="doif" />
        <xs:element name="do_elseif" type="doelseif" minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="do_else" type="doelse" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:element name="do_while" type="dowhile"/>
      <xs:group ref="commonactions"/>
      <xs:group ref="specificactions"/>
    </xs:choice>
  </xs:group>

  <xs:group name="actions">
    <xs:sequence>
      <xs:group ref="actionchoice" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:group>

  <xs:group name="actionswithlabel">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="actionchoice"/>

        <xs:element name="label">
          <xs:annotation>
            <xs:documentation>
              Label
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="name" type="labelname" use="required" />
          </xs:complexType>
        </xs:element>

      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:complexType name="actions">
    <xs:annotation>
      <xs:documentation>
        AI script actions
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actionswithlabel" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="doall">
    <xs:annotation>
      <xs:documentation>
        Actions in all sub-nodes will be performed.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="counting"/>
  </xs:complexType>

  <xs:complexType name="doany">
    <xs:annotation>
      <xs:documentation>
        A randomly selected sub-node action will be performed. The chances of selection can be specified by using weights on the actions.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
  </xs:complexType>

  <xs:complexType name="doif">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the value matches.
        Can be followed by &lt;do_elseif&gt; and/or &lt;do_else&gt;.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <xs:complexType name="doelseif">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the conditions in the previous nodes are not met and if this action's values matches.
        Can be followed by &lt;do_elseif&gt; and/or &lt;do_else&gt;.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <xs:complexType name="doelse">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the conditions in the previous nodes are not met.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
  </xs:complexType>

  <xs:complexType name="dowhile">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed in a loop while the value matches.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <!-- ===== Interrupts ===== -->

  <!-- Interrupt conditions -->
  <xs:complexType name="interrupt_conditions">
    <xs:group ref="conditions" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="interrupt_conditions_withref">
    <xs:complexContent>
      <xs:extension base="interrupt_conditions">
        <xs:attribute name="ref" type="interrupt_conditionsref" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="interrupt_actions">
    <xs:group ref="actions" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="interrupt_actions_withref">
    <xs:complexContent>
      <xs:extension base="interrupt_actions">
        <xs:attribute name="ref" type="interrupt_actionsref" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Interrupt handler -->
  <xs:complexType name="interrupt_handler">
    <xs:sequence>
      <xs:element name="conditions" type="interrupt_conditions_withref" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Conditions that must be met in order for the global interrupt to occur.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="actions" type="interrupt_actions_withref" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Actions to be performed on the global interrupt. Blocking actions are not allowed. &lt;break&gt; and &lt;continue&gt; only work on loops within the interrupt actions.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="consume" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Will the interrupt event be consumed by this handler when the conditions are met, preventing it from triggering further handlers in this script callstack?
          Default is true - set to false to allow the event to be passed on, so that multiple handlers in the callstack can be triggered simultaneously.
          Note that handlers are first triggered in the current script, then in the caller, and so on. The event processing stops as soon as a handler consumes the event.
          Interrupt actions are always deferred until after the event processing.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="interrupt_handler_withref">
    <xs:annotation>
      <xs:documentation>
        Global interrupt handler for this AI script and any called scripts. Can reference a library interrupt handler.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="interrupt_handler">
        <xs:attribute name="ref" type="interrupt_handlerref" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="interrupt_library">
    <xs:annotation>
      <xs:documentation>
        Library of named interrupts and interrupt conditions in global namespace
      </xs:documentation>
    </xs:annotation>
    <!-- Named conditions and named handlers -->
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="handler">
        <xs:annotation>
          <xs:documentation>
            Library definition of a global interrupt handler. Can be referenced by any AI script.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="interrupt_handler">
              <xs:attribute name="name" type="namestring" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Globally unique handler name
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="conditions">
        <xs:annotation>
          <xs:documentation>
            Library definition of conditions that must be met in order for an interrupt to occur. Can be referenced by interrupt handlers in any AI script.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="interrupt_conditions">
              <xs:attribute name="name" type="namestring" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Globally unique condition set name
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="actions">
        <xs:annotation>
          <xs:documentation>
            Library definition of actions that can be referenced by interrupts or by &lt;include_interrupt_actions&gt; in any AI script.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="interrupt_actions">
              <xs:attribute name="name" type="namestring" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Globally unique action set name
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="interrupts">
    <xs:annotation>
      <xs:documentation>
        Global interrupt handlers and library definitions
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="library" type="interrupt_library" minOccurs="0" maxOccurs="1" />
      <xs:element name="handler" type="interrupt_handler_withref" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!-- ===== Order ===== -->

  <xs:simpleType name="ordercategorylookup">
    <xs:annotation>
      <xs:documentation>
        Order category type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="internal" />
      <xs:enumeration value="navigation" />
      <xs:enumeration value="combat" />
      <xs:enumeration value="trade" />
      <xs:enumeration value="mining" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="orderparamlookup">
    <xs:annotation>
      <xs:documentation>
        Order parameter type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="internal">
        <xs:annotation>
          <xs:documentation>
            Internal parameter that is hidden in the UI. Parameters of this type must be optional, i.e. have a default value.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="bool">
        <xs:annotation>
          <xs:documentation>
            Boolean parameter
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="number">
        <xs:annotation>
          <xs:documentation>
            Untyped number input from slider (input param "max" required)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="length">
        <xs:annotation>
          <xs:documentation>
            Length input from slider (input param "max" required)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="time">
        <xs:annotation>
          <xs:documentation>
            Time input from slider (input param "max" required)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="money">
        <xs:annotation>
          <xs:documentation>
            Money input from slider (input param "max" required)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="object">
        <xs:annotation>
          <xs:documentation>
            Object selected by player
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="space">
        <xs:annotation>
          <xs:documentation>
            Space selected by player
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="position">
        <xs:annotation>
          <xs:documentation>
            Position in space, result is [$space, $position]
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ware">
        <xs:annotation>
          <xs:documentation>
            Ware selected by player
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="trade">
        <xs:annotation>
          <xs:documentation>
            Trade deal selected by player (including trade partner, ware, amount and price - only to be used in special trade orders)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="build">
        <xs:annotation>
          <xs:documentation>
            Build task selected by player (only to be used in special build orders)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="formationshape">
        <xs:annotation>
          <xs:documentation>
            Formation shape selected by player
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="list">
        <xs:annotation>
          <xs:documentation>
            A list of any other order parameter type (input param "type" is required, additional input params for that type are valid)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="macro">
        <xs:annotation>
          <xs:documentation>
            Macro
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="orderinputparamlookup">
    <xs:restriction base="namestring">
      <xs:enumeration value="type">
        <xs:annotation>
          <xs:documentation>
            Valid input param for list: Type of the list elements
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="step">
        <xs:annotation>
          <xs:documentation>
            Valid input param for number/length/time/money, default is 1
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="min">
        <xs:annotation>
          <xs:documentation>
            Valid input param for number/length/time/money, default is 0
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="max">
        <xs:annotation>
          <xs:documentation>
            Valid input param for number/length/time/money
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="startvalue">
        <xs:annotation>
          <xs:documentation>
            Valid input param for number/length/time/money/position, start value for selection in UI (of same type as the expected result)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="class">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (list of allowed classes) and position (expected result space class, class.zone or class.sector)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="context">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object/position (space or container)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="owner">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (faction)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="excludeself">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean, for preventing current object from being selected, default is true)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="mining">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (ware transport type, for selecting object with mining capability) and ware (zone, for selecting mining resources)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="attackcapacity">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean, whether object can attack)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cargocapacity">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean or ware transport type, for selecting object with appropriate cargo storage)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hascargo">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean or ware, for selecting object with cargo)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="canbecommanderof">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (controllable, for selecting object that can be commander of the controllable)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unitcapacity">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean, for selecting object with unit storage)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="issubordinate">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hasorders">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hascontrolentity">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hasbuildmodule">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hasbuildingmodule">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean, for selecting object that is target of a buildmodule)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hasbuyoffer">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean or ware)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hasselloffer">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean or ware)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="isbuilding">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="isconstruction">
        <xs:annotation>
          <xs:documentation>
            Valid input param for object (boolean, for selecting object in state construction)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cargoof">
        <xs:annotation>
          <xs:documentation>
            Valid input param for ware (container, for selecting cargo of given container)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="boughtby">
        <xs:annotation>
          <xs:documentation>
            Valid input param for ware (container, for selecting ware that the container has buy offers for)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="soldby">
        <xs:annotation>
          <xs:documentation>
            Valid input param for ware (container, for selecting ware that the container has sell offers for)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancarry">
        <xs:annotation>
          <xs:documentation>
            Valid input param for ware (container, for selecting ware that the container can carry)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="falsevalue">
        <xs:annotation>
          <xs:documentation>
            Valid input param for bool (if false parameter is set to value)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="truevalue">
        <xs:annotation>
          <xs:documentation>
            Valid input param for bool (if true parameter is set to value)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="orderdef">
    <xs:annotation>
      <xs:documentation>
        Definition of an order, determining this AI script as the associated order script. Script parameters must be defined as order parameters.
        NOTE: During setup of order parameters, the script keyword &quot;this&quot; is only partially supported since the entity is not determined yet.
        &quot;this&quot; can only be used to access the following properties: exists, object, defensible, container, station, ship, zone, sector, cluster.
        For example, &quot;this.object&quot; and &quot;this.zone&quot; are always supported, but &quot;this.type&quot; will not work until the script has started.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="params" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Order parameters (AI script parameters with additional order-related properties)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="param">
              <xs:annotation>
                <xs:documentation>
                  AI order script parameter
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="input_param" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                      <xs:documentation>
                        Internal parameter required by the UI for player input of this order parameter. The order parameter type determines which input parameters are expected.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="name" type="orderinputparamlookup" use="required">
                        <xs:annotation>
                          <xs:documentation>
                            Input parameter name
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="value" type="expression">
                        <xs:annotation>
                          <xs:documentation>
                            Input parameter value
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="comment" type="comment" />
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="editable" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Declares that the script is capable of handling an &quot;edit&quot; event for this parameter while in the &quot;critical&quot; state, provided
                        that the defined edit conditions are met. This declaration only affects the critical state, as all parameters are editable anyway in the started (non-critical) state.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="conditions" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              Non-event conditions that determine whether editing the parameter is currently possible. The checks are triggered by the UI or by the script system (e.g. &lt;edit_order_param&gt;) when necessary.
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:group ref="conditions_nonevent" minOccurs="0" maxOccurs="unbounded" />
                            <xs:attribute name="comment" type="comment" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="actions" type="interrupt_actions_withref" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              Actions to be performed immediately when the player or a script edits the parameter. The provided event.* properties are the same as for &lt;event_object_order_param_edited&gt;.
                              Interrupt-specific actions (&lt;run_interrupt_script&gt;, &lt;abort_called_scripts&gt;) are not supported.
                              To perform interrupt actions, the script needs to define an actual interrupt handler and listen to &lt;event_object_order_param_edited&gt;.
                            </xs:documentation>
                          </xs:annotation>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="type" type="orderparamlookup" use="required" />
                <xs:attribute name="text" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Localised parameter name displayed in the UI
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="default" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Default value. If required=&quot;false&quot; then a default value must be supplied.
                      If user input is required, a default value does not have to be supplied, but if it is, it may be taken into account by the UI.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="infinitevalue" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Special constant value that marks the order as infinite. In other words, if the parameter value matches this value, the order becomes an infinite order.
                      Infinite orders in the order queue have special behaviors (see infinite attribute of &lt;order&gt; element). The existence of this attribute also allows
                      the user to create this order as a default order (which must be infinite). In this case, this order parameter is hidden from the UI, it is automatically
                      initialised to the the infinitevalue, and the attributes "default" and "required" have no effect.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="required" type="boolean">
                  <xs:annotation>
                    <xs:documentation>
                      Is parameter input by user required? Default is true, unless a default value is provided. If false then the input UI is skipped (but parameter may be edited by the user later)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="advanced" type="boolean">
                  <xs:annotation>
                    <xs:documentation>
                      Is UI visibility of the parameter restricted to the advanced UI mode? Default is false (parameter is always visible). An advanced parameter must be neither required nor internal.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
        <xs:key name="aiscript_order_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>
      <xs:element name="skill" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Skill requirement for the pilot of a player-owned ship, to determine whether this order is selectable in the UI. The UI will check this requirement
            when selecting a default order. To prevent exploits, the default order is supposed to get cleared when the player changes the ship's pilot.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:nonNegativeInteger" use="required">
            <xs:annotation>
              <xs:documentation>
                Minimal required combined skill value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="requires" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Filter criteria to determine for a player-owned object whether this order is selectable in the UI. For the case of an unselectable order,
            the reason can be provided as TextDB reference in the text attribute. There can be multiple elements of this type with different reason texts.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="text" type="textdbref">
                <xs:annotation>
                  <xs:documentation>
                    Reason for the order not being selectable (TextDB reference)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="comment" type="comment" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="location" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location definition for visualisation in the UI. The location may be queried by the UI at any time after the order is set up.
            There can be multiple subsequent location elements, and each location element can have a condition. In this case, for each location element
            the condition is evaluated until a valid location element is found, which will then be used.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="condition" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional condition expression. If the condition is not met then this location element is regarded as invalid.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="early" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Should the location element be available even if there are parameters that have not been set up in the UI yet? Default is false.
                Note that the location definition still relies on certain parameters, so the condition expression is required to check for the
                existence of these parameters, e.g. condition=&quot;$object?&quot;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Reference object or space of the location
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="additionalobjects" type="expression">
            <xs:annotation>
              <xs:documentation>
                Additional location objects (can be null or omitted, otherwise it must be a list or group of objects). Cannot be combined with position.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="expression">
            <xs:annotation>
              <xs:documentation>
                Position (offset) relative to the reference object or space (can be null or omitted). Cannot be combined with additionalobjects.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="radius" type="expression">
            <xs:annotation>
              <xs:documentation>
                Radius around order location (can be zero or omitted)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="idname">
      <xs:annotation>
        <xs:documentation>
          Globally unique order ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="expression">
      <xs:annotation>
        <xs:documentation>
          Localised order name displayed in the UI
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="expression">
      <xs:annotation>
        <xs:documentation>
          Localised order description displayed in the UI
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="infinite" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Is this an infinite order? Default is false. Infinite orders in the order queue have a theoretically infinite duration, but they have special termination conditions:
          If a sync point exists, the order terminates when the order has reached the sync point and it is released, otherwise it terminates when a next order is ready in the queue.
          Even if the infinite attribute value is false, this order can become infinite if there is a param element with an infinitevalue attribute.
          Default orders must be infinite since they should not terminate until another order is ready. Any order with an infinite or infinitevalue attribute can be used as default order.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canplayercancel" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Allows the order to be cancelled by specific player actions even if it is in the critical state (default is false).
          This causes the order script to be aborted like in the non-critical case. The script has to clean up the order state
          in the on_abort node. Note that usually the critical state indicates an irreversible process that cannot be cancelled.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="category" type="ordercategorylookup" />
  </xs:complexType>

  <!-- ===== Root element ==== -->

  <xs:element name="aiscript">
    <xs:annotation>
      <xs:documentation>
        AI Script root element
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="documentation" type="filedoc" minOccurs="0" maxOccurs="1" />
        <xs:choice minOccurs="0" maxOccurs="1">
          <xs:element name="order" type="orderdef" />
          <xs:element name="params">
            <xs:complexType>
              <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="param">
                  <xs:annotation>
                    <xs:documentation>
                      AI script parameter
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="name" type="paramname" use="required">
                      <xs:annotation>
                        <xs:documentation>
                          Parameter name
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="default" type="expression">
                      <xs:annotation>
                        <xs:documentation>
                          Default value (parameter is required if default value not supplied)
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="comment" type="comment" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
            <xs:key name="aiscript_param_name">
              <xs:selector xpath="param" />
              <xs:field xpath="@name" />
            </xs:key>
          </xs:element>
        </xs:choice>
        <xs:element name="interrupts" type="interrupts" minOccurs="0" maxOccurs="1" />
        <xs:element name="init" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Non-blocking AI script actions for initialization (will be performed immediately when the script is started, before setting up global interrupt events)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="actions" />
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="patch" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Non-blocking AI script actions for patching a script of an older version (will be performed when loading the script from a save)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="actions" />
            <xs:attribute name="sinceversion" use="required" type="xs:positiveInteger">
              <xs:annotation>
                <xs:documentation>
                  Script version at which this patch element was added (it will only be applied when loading a script of an older version)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="early" type="boolean">
              <xs:annotation>
                <xs:documentation>
                  If true, the patch actions will be performed as early as possible while importing the script, before setting up global interrupt events.
                  If false or omitted, the patch actions will be performed only when the savegame is fully loaded.
                  With early=&quot;true&quot; accessing and manipulating other objects is not safe, because at that point the game is not fully loaded yet.
                  However, this is useful for setting up variables that are required for global interrupt events.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="actions" type="actions" minOccurs="0" maxOccurs="1">
          <xs:key name="label_name">
            <xs:selector xpath="label" />
            <xs:field xpath="@name" />
          </xs:key>
          <xs:keyref name="resume_label" refer="label_name">
            <xs:selector xpath=".//resume" />
            <xs:field xpath="@label" />
          </xs:keyref>
        </xs:element>
        <xs:element name="attention" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Actions for minimum attention level
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="actions" type="actions">
                <xs:key name="attention_label_name">
                  <xs:selector xpath="label" />
                  <xs:field xpath="@name" />
                </xs:key>
                <xs:keyref name="attention_resume_label" refer="attention_label_name">
                  <xs:selector xpath=".//resume" />
                  <xs:field xpath="@label" />
                </xs:keyref>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="min" type="attentionlookup" use="required">
              <xs:annotation>
                <xs:documentation>
                  Minimum attention level
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="on_abort" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Non-blocking AI script actions for cleanup, in case the script is aborted (will be performed right before the script is terminated).
              If the script is aborted as a result of the entity being killed, the event data of &lt;event_object_destroyed&gt; can be accessed.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="actions" />
            <xs:attribute name="killed" type="boolean">
              <xs:annotation>
                <xs:documentation>
                  Set to true if the actions should only be performed if the entity is killed.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="signature" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Signature
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="name" type="aiscriptname" use="required" />
      <xs:attribute name="priority" type="xs:nonNegativeInteger">
        <xs:annotation>
          <xs:documentation>
            The interrupt priority. In order for this script to be triggered by a global interrupt handler, this priority must be higher than the previous interrupt priority (default is 0).
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="version" type="xs:nonNegativeInteger">
        <xs:annotation>
          <xs:documentation>
            Script version. The version has to be increased when new blocking actions are inserted.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="comment" type="comment" />
    </xs:complexType>
    <xs:key name="attention">
      <xs:selector xpath="attention" />
      <xs:field xpath="@min" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <!-- ===== Text simple types ==== -->

  <xs:simpleType name="boolean">
    <xs:restriction base="xs:boolean"/>
  </xs:simpleType>

  <xs:simpleType name="booleanexpression">
    <xs:union memberTypes="boolean expression"/>
  </xs:simpleType>

  <!-- Non-expression name, don't allow single quote. Technically it would be allowed, but this helps detecting mistakes. -->
  <xs:simpleType name="namestring">
    <xs:restriction base="xs:string">
      <xs:pattern value="[^']*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Script name (MD script, cue...) starts with upper case letter so it can't be a keyword, AI script is slightly different -->
  <xs:simpleType name="scriptname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Z][A-Za-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Variables start with $ character. (Visual Studio requires \$, but \$ is not allowed by libxml2... so we use [$]) -->
  <xs:simpleType name="variablename">
    <xs:restriction base="xs:string">
      <xs:pattern value="[$][a-zA-Z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="idname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z_][a-zA-Z0-9_]*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="paramname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z_][a-zA-Z0-9_]*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- TextDB reference: {pageid, textid} -->
  <xs:simpleType name="textdbref">
    <xs:restriction base="xs:string">
      <xs:pattern value=" *\{[1-9][0-9]*, *[1-9][0-9]*\} *" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Expressions - also checks string 'delimiters', strings may contain anything, even \' -->
  <xs:simpleType name="expression">
    <xs:restriction base="xs:string">
      <!--                *([ initial character ]|(' any string  '))([ a non-string character                   ]|(' any string  '))* -->
      <xs:pattern value=" *([A-Za-z0-9_$@+\-({\[]|('([^'\\]|\\.)*'))([A-Za-z0-9_$!?@=&lt;&gt;,.+\-*/%\^(){}\[\] ]|('([^'\\]|\\.)*'))*" />
    </xs:restriction>
  </xs:simpleType>

  <!-- Lvalue expression, with various supported styles:
    $variable:            lvalue is a variable of name '$variable' in the current context/namespace (see simpleType "variablename")
    <expression>.{value}: lvalue is a property value of the base expression, e.g. a list index or a table key
    <expression>.$var:    lvalue is a string property '$var' of the base expression, e.g. a variable of an MD cue or an entity, or a string key in a table
    stat.foo:             lvalue is a statistics value, typically used in <set_value> to update the stat (exceptionally not using $variable style)
  -->
  <xs:simpleType name="lvalueexpression">
    <xs:restriction base="xs:string">
      <!--       either:    $ <varname....>   -->
      <xs:pattern value=" *[$][a-zA-Z0-9_]+ *" />
      <!--           or:   <property base expression..................................................> .     {<property expression............................................> }                        -->
      <!--           or:   <property base expression..................................................> .                                                                             $ <varname....>     -->
      <xs:pattern value=" *[A-Za-z_$(]([A-Za-z0-9_$!?@=&lt;&gt;,.+\-*/%\^(){}\[\] ]|('([^'\\]|\\.)*'))*\. *((\{([A-Za-z0-9_$!?@=&lt;&gt;,.+\-*/%\^(){}\[\] ]|('([^'\\]|\\.)*'))+\})|([$][a-zA-Z0-9_]+)) *" />
      <!--           or:   stat   .  <statname............>   -->
      <xs:pattern value=" *stat *\. *[a-zA-Z_][a-zA-Z0-9_]* *" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="lvaluename">
    <xs:annotation>
      <xs:documentation>
        Name of the value that will receive the result
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="lvalueexpression" />
  </xs:simpleType>

  <xs:simpleType name="groupname">
    <xs:annotation>
      <xs:documentation>
        Name of the group to which the result will be added (group will be created if it does not exist yet)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="lvalueexpression" />
  </xs:simpleType>

  <xs:simpleType name="group">
    <xs:annotation>
      <xs:documentation>
        Group of objects
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="object">
    <xs:annotation>
      <xs:documentation>
        Object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="destructible">
    <xs:annotation>
      <xs:documentation>
        Destructible
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="entity">
    <xs:annotation>
      <xs:documentation>
        Entity
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="ship">
    <xs:annotation>
      <xs:documentation>
        Ship
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="station">
    <xs:annotation>
      <xs:documentation>
        Station
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="space">
    <xs:annotation>
      <xs:documentation>
        Containing space (zone, sector, cluster, or galaxy)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="cluster">
    <xs:annotation>
      <xs:documentation>
        Cluster
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="room">
    <xs:annotation>
      <xs:documentation>
        Room
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="sector">
    <xs:annotation>
      <xs:documentation>
        Sector
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="zone">
    <xs:annotation>
      <xs:documentation>
        Zone
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="holomap">
    <xs:annotation>
      <xs:documentation>
        HoloMap
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="actor">
    <xs:annotation>
      <xs:documentation>
        Actor object (NPC)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="targetobject">
    <xs:annotation>
      <xs:documentation>
        Target object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="targetcomponent">
    <xs:annotation>
      <xs:documentation>
        Target component
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="targetcomponentslot">
    <xs:annotation>
      <xs:documentation>
        Target component slot
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="asteroid">
    <xs:annotation>
      <xs:documentation>
        Asteroid
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="weapon">
    <xs:annotation>
      <xs:documentation>
        Weapon
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="source">
    <xs:annotation>
      <xs:documentation>
        Source object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="killer">
    <xs:annotation>
      <xs:documentation>
        Killer object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="killedobject">
    <xs:annotation>
      <xs:documentation>
        Killed object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="attacker">
    <xs:annotation>
      <xs:documentation>
        Attacker object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="attackedobject">
    <xs:annotation>
      <xs:documentation>
        Attacked object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="attackedcomponent">
    <xs:annotation>
      <xs:documentation>
        Attacked component object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="damagedcomponent">
    <xs:annotation>
      <xs:documentation>
        Damaged component
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="repairedcomponent">
    <xs:annotation>
      <xs:documentation>
        Repaired component
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="buildmodule">
    <xs:annotation>
      <xs:documentation>
        Build module
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="productionmodule">
    <xs:annotation>
      <xs:documentation>
        Production module
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="buyer">
    <xs:annotation>
      <xs:documentation>
        Buyer object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="seller">
    <xs:annotation>
      <xs:documentation>
        Seller object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="buyerrequired">
    <xs:annotation>
      <xs:documentation>
        Buyer object (attribute must be present if seller not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="sellerrequired">
    <xs:annotation>
      <xs:documentation>
        Seller object (attribute must be present if buyer not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="tradeoffer">
    <xs:annotation>
      <xs:documentation>
        Trade Offer
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="eventtradeoffer">
    <xs:annotation>
      <xs:documentation>
        Trade offer to match. All other attributes and amount check nodes are ignored.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="build">
    <xs:annotation>
      <xs:documentation>
        Build Task
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="ware">
    <xs:annotation>
      <xs:documentation>
        Ware
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="signalleak">
    <xs:annotation>
      <xs:documentation>
        SignalLeak object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="scannerrequired">
    <xs:annotation>
      <xs:documentation>
        Object which performs the scanning, or group of objects (attribute must be present if scanned not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="scannedrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is scanned, or group of objects (attribute must be present if scanner not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="hackerrequired">
    <xs:annotation>
      <xs:documentation>
        Object which performs the hacking, or group of objects (attribute must be present if hacked not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="hackedrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is hacked, or group of objects (attribute must be present if hacker not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="lockattackerrequired">
    <xs:annotation>
      <xs:documentation>
        Attacker object (ship or station) which is doing the locking (attribute must be present if target not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="locktargetrequired">
    <xs:annotation>
      <xs:documentation>
        The attacker's lock target object (attribute must be present if attacker not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="locktargetcomponent">
    <xs:annotation>
      <xs:documentation>
        The attacker's lock target component (either the whole target object or a contained component)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="observerrequired">
    <xs:annotation>
      <xs:documentation>
        Object which performs the observation, or group of objects (attribute must be present if observed not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="observedrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is observed, or group of objects (attribute must be present if observer not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="attackerrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is attacking the target (attribute must be present if target not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="attackedrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is attacked, or group of objects (attribute must be present if attacker not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="claimedrequired">
    <xs:annotation>
      <xs:documentation>
        Object which is claimed, or group of objects (attribute must be present if pilot not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="claimerrequired">
    <xs:annotation>
      <xs:documentation>
        The claiming entity, or group of entities (attribute must be present if claimed not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="numfreeactorslots">
    <xs:annotation>
      <xs:documentation>
        Minimal required number of free slots for actor NPCs
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="freemissionactorslot">
    <xs:annotation>
      <xs:documentation>
        Is a free slot for a mission actor NPC required?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="booleanexpression" />
  </xs:simpleType>

  <xs:simpleType name="cutscenekey">
    <xs:annotation>
      <xs:documentation>
        Cutscene key name
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="list">
    <xs:annotation>
      <xs:documentation>
        List
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="table">
    <xs:annotation>
      <xs:documentation>
        Table
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="order">
    <xs:annotation>
      <xs:documentation>
        AI order
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="immediateorder">
    <xs:annotation>
      <xs:documentation>
        Start this order immediately? If true, the order is inserted as the current order. If there is an active current order, it will be interrupted, so that it restarts
        when the new order is completed. If the current order cannot be interrupted (i.e. it's in the critical state) the new order is inserted right after it.
        This attribute has no effect when creating a default order.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="booleanexpression" />
  </xs:simpleType>

  <xs:simpleType name="findappend">
    <xs:annotation>
      <xs:documentation>
        If true then the found objects are appended to the value used as the result. Should the value used as the result not be a list, it will become one, losing its previous value (default false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="findclusterappend">
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="findmultiple">
    <xs:annotation>
      <xs:documentation>
        If true then the result is a list of all found objects, otherwise the result is a random object or null (default is true for count_ conditions, false for find_ actions)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="findrequired">
    <xs:annotation>
      <xs:documentation>
        If true then an error message will be produced if no result is found (default is false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="findrecursive">
    <xs:annotation>
      <xs:documentation>
        If true then the search does not stop at contained objects, but these objects and their sub-components are searched recursively as well (default is false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="findincludeobjects">
    <xs:annotation>
      <xs:documentation>
        If true then the search will include contained objects (of class object, e.g. docked ships). Sub-components of these objects are not included, unless the recursive attribute is set.
        The recursive attribute takes precedence over includeobjects. Default is false.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="offset">
    <xs:annotation>
      <xs:documentation>
        Offset from reference object
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="comment">
    <xs:annotation>
      <xs:documentation>
        Comment for documentation purposes only
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:simpleType name="container">
    <xs:annotation>
      <xs:documentation>
        Container (ship or station)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="crate">
    <xs:annotation>
      <xs:documentation>
        Crate (on first-person platform)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="macro">
    <xs:annotation>
      <xs:documentation>
        Macro
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="macroname">
    <xs:annotation>
      <xs:documentation>
        Macro name (either a plain macro string or a script expression that evaluates to a string or macro)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="constructionplan">
    <xs:annotation>
      <xs:documentation>
        Construction plan
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="moduletypelimit">
    <xs:annotation>
      <xs:documentation>
        Module type limit. Integer or a script expression that evaluates to an integer
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="docked">
    <xs:annotation>
      <xs:documentation>
        Object is docked?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="booleanexpression" />
  </xs:simpleType>

  <xs:simpleType name="known">
    <xs:annotation>
      <xs:documentation>
        Known to player?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="hasmasstraffic">
    <xs:annotation>
      <xs:documentation>
        Is the station connected to a mass traffic network?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="page">
    <xs:annotation>
      <xs:documentation>
        Text page ID
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="pagewithdefault">
    <xs:annotation>
      <xs:documentation>
        Text page ID (defaults to the speaker's voice page if not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="line">
    <xs:annotation>
      <xs:documentation>
        Line ID in a text page
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="section">
    <xs:annotation>
      <xs:documentation>
        Conversation section name
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="conversation">
    <xs:annotation>
      <xs:documentation>
        Conversation name
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="namestring" />
  </xs:simpleType>

  <xs:simpleType name="negatecondition">
    <xs:annotation>
      <xs:documentation>
        Negate condition?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="negatefilter">
    <xs:annotation>
      <xs:documentation>
        Negate filter outcome? The negation applies to the whole element, e.g. &lt;match_content negate=&quot;true&quot;&gt; matches objects which do NOT have the specified content.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="colour">
    <xs:annotation>
      <xs:documentation>
        Colour Value (0 - 255)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="masstraffic">
    <xs:annotation>
      <xs:documentation>
        Mass traffic network ID
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="pricemodifieramount">
    <xs:annotation>
      <xs:documentation>
        Discount/commission amount as percentage of a ware's price variation range, valid range from 1 to 100.
        NOTE: This is not the actual discount/commission percentage, which depends on the ware that the price modifier is applied to. Discounts/Commissions apply to all sell/buy offers of object/faction respectively.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="groupeventsource">
    <xs:annotation>
      <xs:documentation>
        Group of event objects (can be supplied instead of a single event object). The check attribute does not apply. The group is required to exist but may be empty.
        Adding/removing group members is possible even after the event is set up.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <xs:simpleType name="checkeventsource">
    <xs:annotation>
      <xs:documentation>
        Produce an error message if the provided event object does not exist? Default is true.
        NOTE: If the event object is a variable or a changeable property, changing it at a later time has no direct effect on this event condition,
        i.e. it is not re-enabled automatically. It is only updated under certain conditions, e.g. when loading a savegame or when
        the event condition is restarted explicitly (resetting MD cue or starting AI script).
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="boolean" />
  </xs:simpleType>

  <xs:simpleType name="notificationtext">
    <xs:annotation>
      <xs:documentation>
        Notification text to be displayed, either a single string with possible line breaks (left-aligned), or a list of strings.
        In a list, each pair of strings defines a single row (left-aligned and right-aligned text).
        In the list you can use [ string, r, g, b ] instead of a simple string to specify an RGB text color, with color values between 0 and 255.
        The default color is determined by the notification priority (a priority above 1 will turn the color red).
        Numbers are also accepted instead of strings.
        The maximum number of rows is 4 in the message ticker (&lt;show_ticker_message&gt;), and 7 in the target monitor (&lt;show_interactive_message&gt;)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <!-- ===== Enumeration simple types ===== -->

  <xs:simpleType name="versionstatus">
    <xs:annotation>
      <xs:documentation>
        Version status
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="concept">
        <xs:annotation>
          <xs:documentation>
            Proof of concept only
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="development">
        <xs:annotation>
          <xs:documentation>
            Under development
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="testing">
        <xs:annotation>
          <xs:documentation>
            Test version
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="candidate">
        <xs:annotation>
          <xs:documentation>
            Release candidate
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="release">
        <xs:annotation>
          <xs:documentation>
            Released
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="waiting">
        <xs:annotation>
          <xs:documentation>
            Waiting for other assets
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="selectionlookup">
    <xs:annotation>
      <xs:documentation>
        Selection type (used with select sub-nodes)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <!-- TODO: Improve documentation -->
      <xs:enumeration value="one">
        <xs:annotation>
          <xs:documentation>
            One
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="random">
        <xs:annotation>
          <xs:documentation>
            Random
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="random_except">
        <xs:annotation>
          <xs:documentation>
            Random, excluding an item that can be optionally specified by code
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="choose">
        <xs:annotation>
          <xs:documentation>
            Choose
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="selectionweight">
    <xs:annotation>
      <xs:documentation>
        Weight which determines the chance of this node being selected
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="setoperationlookup">
    <xs:annotation>
      <xs:documentation>
        Operation to perform (default is set)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="set">
        <xs:annotation>
          <xs:documentation>
            Set value (default operation if not supplied, default action is to set to 1 if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="add">
        <xs:annotation>
          <xs:documentation>
            Add to value (default is to add 1 if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="subtract">
        <xs:annotation>
          <xs:documentation>
            Subtract from value (default is to subtract 1 if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <!--
      <xs:enumeration value="multiply">
        <xs:annotation>
          <xs:documentation>
            Multiply value (default is to do nothing if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="divide">
        <xs:annotation>
          <xs:documentation>
            Divide value (default is to do nothing if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      -->
      <xs:enumeration value="insert">
        <xs:annotation>
          <xs:documentation>
            Insert value into the list as the specified list element, moving all following elements. Insertion at list count + 1 is allowed. (Default value is null if no random range supplied)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="killmethodlookup">
    <xs:annotation>
      <xs:documentation>
        Kill method
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <!-- TODO: Improve documentation -->
          <xs:enumeration value="killmethod.unknown">
            <xs:annotation>
              <xs:documentation>
                Unknown
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.collected">
            <xs:annotation>
              <xs:documentation>
                Collected
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.collided">
            <xs:annotation>
              <xs:documentation>
                Collided
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.contextkilled">
            <xs:annotation>
              <xs:documentation>
                Context killed
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.hitbyareadamage">
            <xs:annotation>
              <xs:documentation>
                Hit by area damage
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.hitbybomb">
            <xs:annotation>
              <xs:documentation>
                Hit by bomb
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.hitbybullet">
            <xs:annotation>
              <xs:documentation>
                Hit by bullet
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.hitbymine">
            <xs:annotation>
              <xs:documentation>
                Hit by mine
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.hitbymissile">
            <xs:annotation>
              <xs:documentation>
                Hit by missile
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.lowattentionattack">
            <xs:annotation>
              <xs:documentation>
                Attacked in low attention
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.removed">
            <xs:annotation>
              <xs:documentation>
                Removed
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.selfdestructed">
            <xs:annotation>
              <xs:documentation>
                Self-destructed
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.suffocated">
            <xs:annotation>
              <xs:documentation>
                Suffocated
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.targetpointdiscarded">
            <xs:annotation>
              <xs:documentation>
                Target point discarded
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.timedout">
            <xs:annotation>
              <xs:documentation>
                Timed out
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="killmethod.weaponswap">
            <xs:annotation>
              <xs:documentation>
                Weapon swap
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="racelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="argon">
        <xs:annotation>
          <xs:documentation>
            Argon
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="boron">
        <xs:annotation>
          <xs:documentation>
            Boron
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="split">
        <xs:annotation>
          <xs:documentation>
            Split
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="drone">
        <xs:annotation>
          <xs:documentation>
            Drone
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="khaak">
        <xs:annotation>
          <xs:documentation>
            Kha'ak
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="paranid">
        <xs:annotation>
          <xs:documentation>
            Paranid
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="teladi">
        <xs:annotation>
          <xs:documentation>
            Teladi
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="terran">
        <xs:annotation>
          <xs:documentation>
            Terran
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="xenon">
        <xs:annotation>
          <xs:documentation>
            Xenon
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="rawraceexprlookup">
    <xs:union memberTypes="expression racelookup" />
  </xs:simpleType>

  <xs:simpleType name="raceexprlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="race.argon">
            <xs:annotation>
              <xs:documentation>
                Argon
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.boron">
            <xs:annotation>
              <xs:documentation>
                Boron
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.drone">
            <xs:annotation>
              <xs:documentation>
                Drone
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.khaak">
            <xs:annotation>
              <xs:documentation>
                Kha'ak
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.split">
            <xs:annotation>
              <xs:documentation>
                Split
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.paranid">
            <xs:annotation>
              <xs:documentation>
                Paranid
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.teladi">
            <xs:annotation>
              <xs:documentation>
                Teladi
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.terran">
            <xs:annotation>
              <xs:documentation>
                Terran
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="race.xenon">
            <xs:annotation>
              <xs:documentation>
                Xenon
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="race">
    <xs:annotation>
      <xs:documentation>
        Race (species)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="raceexprlookup" />
  </xs:simpleType>

  <xs:simpleType name="factionlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="alliance">
        <xs:annotation>
          <xs:documentation>
            Alliance of the Word
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="antigone">
        <xs:annotation>
          <xs:documentation>
            Antigone Republic
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="argon">
        <xs:annotation>
          <xs:documentation>
            Argon Federation
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="civilian">
        <xs:annotation>
          <xs:documentation>
            Civilian
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="criminal">
        <xs:annotation>
          <xs:documentation>
            Criminal
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="hatikvah">
        <xs:annotation>
          <xs:documentation>
            Hatikvah Free League
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="holyorder">
        <xs:annotation>
          <xs:documentation>
            Holy Order of the Pontifex
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="khaak">
        <xs:annotation>
          <xs:documentation>
            Kha'ak
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ministry">
        <xs:annotation>
          <xs:documentation>
            Ministry of Finance
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ownerless">
        <xs:annotation>
          <xs:documentation>
            Ownerless
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="paranid">
        <xs:annotation>
          <xs:documentation>
            Paranid
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="player">
        <xs:annotation>
          <xs:documentation>
            Player
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="scaleplate">
        <xs:annotation>
          <xs:documentation>
            Scale Plate Pact
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="smuggler">
        <xs:annotation>
          <xs:documentation>
            Smuggler
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="teladi">
        <xs:annotation>
          <xs:documentation>
            Teladi Company
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="xenon">
        <xs:annotation>
          <xs:documentation>
            Xenon
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="rawfactionexprlookup">
    <xs:union memberTypes="expression factionlookup" />
  </xs:simpleType>

  <xs:simpleType name="factionexprlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="faction.alliance">
            <xs:annotation>
              <xs:documentation>
                Alliance of the Word
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.antigone">
            <xs:annotation>
              <xs:documentation>
                Antigone Republic
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.argon">
            <xs:annotation>
              <xs:documentation>
                Argon Federation
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.civilian">
            <xs:annotation>
              <xs:documentation>
                Civilian
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.criminal">
            <xs:annotation>
              <xs:documentation>
                Criminal
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.hatikvah">
            <xs:annotation>
              <xs:documentation>
                Hatikvah Free League
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.holyorder">
            <xs:annotation>
              <xs:documentation>
                Holy Order of the Pontifex
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.khaak">
            <xs:annotation>
              <xs:documentation>
                Kha'ak
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.ministry">
            <xs:annotation>
              <xs:documentation>
                Ministry of Finance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.ownerless">
            <xs:annotation>
              <xs:documentation>
                Ownerless
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.paranid">
            <xs:annotation>
              <xs:documentation>
                Paranid
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.player">
            <xs:annotation>
              <xs:documentation>
                Player
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.scaleplate">
            <xs:annotation>
              <xs:documentation>
                Scale Plate Pact
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.smuggler">
            <xs:annotation>
              <xs:documentation>
                Smuggler
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.teladi">
            <xs:annotation>
              <xs:documentation>
                Teladi Company
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction.xenon">
            <xs:annotation>
              <xs:documentation>
                Xenon
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="faction">
    <xs:annotation>
      <xs:documentation>
        Faction
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="factionexprlookup" />
  </xs:simpleType>

  <xs:simpleType name="modulesettypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="defence" />
      <xs:enumeration value="equipmentdock" />
      <xs:enumeration value="factory" />
      <xs:enumeration value="tradingstation" />
      <xs:enumeration value="shipyard" />
      <xs:enumeration value="headquarters" />
      <xs:enumeration value="piratebase" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="owner">
    <xs:annotation>
      <xs:documentation>
        Owner faction
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="factionexprlookup" />
  </xs:simpleType>

  <xs:simpleType name="owners">
    <xs:annotation>
      <xs:documentation>
        Owner faction, or list of owner factions
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="factionexprlookup" />
  </xs:simpleType>

  <xs:simpleType name="quadrantlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="quadrant.none" />
          <xs:enumeration value="quadrant.front" />
          <xs:enumeration value="quadrant.back" />
          <xs:enumeration value="quadrant.left" />
          <xs:enumeration value="quadrant.right" />
          <xs:enumeration value="quadrant.up" />
          <xs:enumeration value="quadrant.down" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="quadrant">
    <xs:annotation>
      <xs:documentation>
        Directional Quadrant
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="quadrantlookup" />
  </xs:simpleType>

  <xs:simpleType name="ammotypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="missile" />
      <xs:enumeration value="countermeasure" />
      <xs:enumeration value="deployable" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="roomtypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="bar" />
      <xs:enumeration value="corridor" />
      <xs:enumeration value="factionrep" />
      <xs:enumeration value="infrastructure" />
      <xs:enumeration value="manager" />
      <xs:enumeration value="office" />
      <xs:enumeration value="prison" />
      <xs:enumeration value="security" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="roomtypeexprlookup">
    <xs:annotation>
      <xs:documentation>
        Room type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="roomtype.bar" />
          <xs:enumeration value="roomtype.corridor" />
          <xs:enumeration value="roomtype.factionrep" />
          <xs:enumeration value="roomtype.infrastructure" />
          <xs:enumeration value="roomtype.manager" />
          <xs:enumeration value="roomtype.office" />
          <xs:enumeration value="roomtype.prison" />
          <xs:enumeration value="roomtype.security" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="weaponsystemlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="all" />
      <xs:enumeration value="drone_attack" />
      <xs:enumeration value="drone_defence" />
      <xs:enumeration value="drone_repair" />
      <xs:enumeration value="laser" />
      <xs:enumeration value="missile" />
      <xs:enumeration value="torpedo" />
      <xs:enumeration value="turret_shortrange" />
      <xs:enumeration value="turret_midrange" />
      <xs:enumeration value="turret_longrange" />
      <xs:enumeration value="turret_missile" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="weapontypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="all">
        <xs:annotation>
          <xs:documentation>
            All weapons (including mining or repair lasers!)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="combat">
        <xs:annotation>
          <xs:documentation>
            Combat weapons (default)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="mining">
        <xs:annotation>
          <xs:documentation>
            Mining weapons
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="repair">
        <xs:annotation>
          <xs:documentation>
            Repair weapons
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="weaponmodelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="weaponmode.any">
            <xs:annotation>
              <xs:documentation>
                Any mode applies
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="weaponmode.attackenemies">
            <xs:annotation>
              <xs:documentation>
                Attack all enemies
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="weaponmode.defend">
            <xs:annotation>
              <xs:documentation>
                Defend against attackers (default for non-mining weapons)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="weaponmode.mining">
            <xs:annotation>
              <xs:documentation>
                Mining asteroids (default for mining weapons)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="weaponmode.missiledefence">
            <xs:annotation>
              <xs:documentation>
                Attempt to shoot down missiles
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="extendedweaponmodelookup">
    <xs:union memberTypes="weaponmodelookup">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="weaponmode.autoassist">
            <xs:annotation>
              <xs:documentation>
                Automatically target the current target (player only)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="weaponmode.holdfire">
            <xs:annotation>
              <xs:documentation>
                Do not shoot
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="dockstatelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="dockstate.default">
            <xs:annotation>
              <xs:documentation>
                Dock is either empty or the docked ship is stationary
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="dockstate.docking">
            <xs:annotation>
              <xs:documentation>
                A ship is in its final docking manoeuvre
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="dockstate.retrieving">
            <xs:annotation>
              <xs:documentation>
                A ship is currently being retrieved
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="dockstate.retrieving_to_undock">
            <xs:annotation>
              <xs:documentation>
                A ship is currently being retrieved, it will undock as soon as this is done
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="dockstate.storing">
            <xs:annotation>
              <xs:documentation>
                A ship is currently being stored
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="dockstate.undocking">
            <xs:annotation>
              <xs:documentation>
                A ship is currently undocking
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="shiptypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="personalvehicle" />
      <xs:enumeration value="police" />
      <xs:enumeration value="xsdrone" />
      <xs:enumeration value="escapepod" />
      <xs:enumeration value="lasertower" />
      <xs:enumeration value="scout" />
      <xs:enumeration value="fighter" />
      <xs:enumeration value="heavyfighter" />
      <xs:enumeration value="interceptor" />
      <xs:enumeration value="courier" />
      <xs:enumeration value="smalldrone" />
      <xs:enumeration value="bomber" />
      <xs:enumeration value="frigate" />
      <xs:enumeration value="corvette" />
      <xs:enumeration value="transporter" />
      <xs:enumeration value="miner" />
      <xs:enumeration value="personnelcarrier" />
      <xs:enumeration value="scavenger" />
      <xs:enumeration value="destroyer" />
      <xs:enumeration value="freighter" />
      <xs:enumeration value="largeminer" />
      <xs:enumeration value="carrier" />
      <xs:enumeration value="resupplier" />
      <xs:enumeration value="builder" />
      <xs:enumeration value="battleship" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="shiptypeexprlookup">
    <xs:annotation>
      <xs:documentation>
        Ship type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="shiptype.personalvehicle" />
          <xs:enumeration value="shiptype.police" />
          <xs:enumeration value="shiptype.xsdrone" />
          <xs:enumeration value="shiptype.escapepod" />
          <xs:enumeration value="shiptype.lasertower" />
          <xs:enumeration value="shiptype.scout" />
          <xs:enumeration value="shiptype.fighter" />
          <xs:enumeration value="shiptype.heavyfighter" />
          <xs:enumeration value="shiptype.interceptor" />
          <xs:enumeration value="shiptype.courier" />
          <xs:enumeration value="shiptype.smalldrone" />
          <xs:enumeration value="shiptype.bomber" />
          <xs:enumeration value="shiptype.frigate" />
          <xs:enumeration value="shiptype.corvette" />
          <xs:enumeration value="shiptype.transporter" />
          <xs:enumeration value="shiptype.miner" />
          <xs:enumeration value="shiptype.personnelcarrier" />
          <xs:enumeration value="shiptype.scavenger" />
          <xs:enumeration value="shiptype.destroyer" />
          <xs:enumeration value="shiptype.freighter" />
          <xs:enumeration value="shiptype.largeminer" />
          <xs:enumeration value="shiptype.carrier" />
          <xs:enumeration value="shiptype.resupplier" />
          <xs:enumeration value="shiptype.builder" />
          <xs:enumeration value="shiptype.battleship" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="orientationlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="align_left">
        <xs:annotation>
          <xs:documentation>
            Align so that refpos/refobj is on the left side
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="align_left_bbox">
        <xs:annotation>
          <xs:documentation>
            Align so that refobj-bounding-box is on the left side (requires valid refobject!)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="align_right">
        <xs:annotation>
          <xs:documentation>
            Align so that refpos/refobj is on the right side
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="align_right_bbox">
        <xs:annotation>
          <xs:documentation>
            Align so that refobj-bounding-box is on the right side (requires valid refobject!)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="look_at">
        <xs:annotation>
          <xs:documentation>
            Orientation that looks directly at refpos/refobj-center
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="look_at_bbox">
        <xs:annotation>
          <xs:documentation>
            Orientation that looks directly at refobj-bounding-box (requires valid refobject!)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="look_away">
        <xs:annotation>
          <xs:documentation>
            Orientation that looks away from refpos/refobj-center
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="look_away_bbox">
        <xs:annotation>
          <xs:documentation>
            Orientation that looks away from refobj-bounding-box (requires valid refobject!)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="activityexprlookup">
    <xs:annotation>
      <xs:documentation>
        Player activity
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="activity.none" >
            <xs:annotation>
              <xs:documentation>
                No activity
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="activity.scan_longrange" >
            <xs:annotation>
              <xs:documentation>
                Long-Range Scanning activity
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="activity.scan" >
            <xs:annotation>
              <xs:documentation>
                Object Scanning activity
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="activity.travel" >
            <xs:annotation>
              <xs:documentation>
                Travel drive
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="alertlevellookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="green" >
        <xs:annotation>
          <xs:documentation>
            No alert
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="red" >
        <xs:annotation>
          <xs:documentation>
            Red alert
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="yellow" >
        <xs:annotation>
          <xs:documentation>
            Yellow alert
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="classlookup">
    <xs:union memberTypes="destructibleclasslookup spaceclasslookup roomclasslookup expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.component">
            <xs:annotation>
              <xs:documentation>
                Component
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.positional">
            <xs:annotation>
              <xs:documentation>
                Positional
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="destructibleclasslookup">
    <xs:union memberTypes="objectclasslookup entityclasslookup expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.adsign">
            <xs:annotation>
              <xs:documentation>
                Ad Sign (child of an object)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.buildmodule">
            <xs:annotation>
              <xs:documentation>
                Build Module
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.cargobay">
            <xs:annotation>
              <xs:documentation>
                Cargo Bay
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.construction">
            <xs:annotation>
              <xs:documentation>
                Construction
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.controlcomponent">
            <xs:annotation>
              <xs:documentation>
                Control Component
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.controlpanel">
            <xs:annotation>
              <xs:documentation>
                Control Panel
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.destructible">
            <xs:annotation>
              <xs:documentation>
                Destructible
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.dockarea">
            <xs:annotation>
              <xs:documentation>
                Dock Area
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.engine">
            <xs:annotation>
              <xs:documentation>
                Engine
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.hackerprobe">
            <xs:annotation>
              <xs:documentation>
                Hacker Probe
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.habitation">
            <xs:annotation>
              <xs:documentation>
                Habitation Module
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.interior">
            <xs:annotation>
              <xs:documentation>
                Interior
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.launcher">
            <xs:annotation>
              <xs:documentation>
                Launcher
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.lock">
            <xs:annotation>
              <xs:documentation>
                Lock
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.navcontext">
            <xs:annotation>
              <xs:documentation>
                Nav Context
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.production">
            <xs:annotation>
              <xs:documentation>
                Production
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.radar">
            <xs:annotation>
              <xs:documentation>
                Radar
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.scanner">
            <xs:annotation>
              <xs:documentation>
                Scanner
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.shieldgenerator">
            <xs:annotation>
              <xs:documentation>
                Shield Generator
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.storage">
            <xs:annotation>
              <xs:documentation>
                Storage Module
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.turret">
            <xs:annotation>
              <xs:documentation>
                Turret
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.walkablemodule">
            <xs:annotation>
              <xs:documentation>
                Walkable Module (Docking Bay or Build Module)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.weapon">
            <xs:annotation>
              <xs:documentation>
                Weapon
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <!--TODO Finish-->
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="objectclasslookup">
    <xs:union memberTypes="shipclasslookup stationclasslookup expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.adsignobject">
            <xs:annotation>
              <xs:documentation>
                Ad Sign Object (child of a zone)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.asteroid">
            <xs:annotation>
              <xs:documentation>
                Asteroid
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.bomb">
            <xs:annotation>
              <xs:documentation>
                Bomb
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.collectable">
            <xs:annotation>
              <xs:documentation>
                Collectable
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.container">
            <xs:annotation>
              <xs:documentation>
                Container
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.controllable">
            <xs:annotation>
              <xs:documentation>
                Controllable
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.defensible">
            <xs:annotation>
              <xs:documentation>
                Defensible
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.drop">
            <xs:annotation>
              <xs:documentation>
                Drop
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.explosive">
            <xs:annotation>
              <xs:documentation>
                Explosive
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.gate">
            <xs:annotation>
              <xs:documentation>
                Gate
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.highwayentrygate">
            <xs:annotation>
              <xs:documentation>
                Highway Entry Gate
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.highwayexitgate">
            <xs:annotation>
              <xs:documentation>
                Highway Exit Gate
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.lockbox">
            <xs:annotation>
              <xs:documentation>
                Lockbox
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.mine">
            <xs:annotation>
              <xs:documentation>
                Mine
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.missionboard">
            <xs:annotation>
              <xs:documentation>
                Mission Board
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.missile">
            <xs:annotation>
              <xs:documentation>
                Missile
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.navbeacon">
            <xs:annotation>
              <xs:documentation>
                Nav Beacon
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.nebula">
            <xs:annotation>
              <xs:documentation>
                Nebula
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.object">
            <xs:annotation>
              <xs:documentation>
                Object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.resourceprobe">
            <xs:annotation>
              <xs:documentation>
                Resource Probe
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.satellite">
            <xs:annotation>
              <xs:documentation>
                Satellite
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="shipclasslookup">
    <xs:union memberTypes="shipsizeclasslookup">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.ship">
            <xs:annotation>
              <xs:documentation>
                Ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="shipsizeclasslookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.ship_xs">
            <xs:annotation>
              <xs:documentation>
                XS sized ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.ship_s">
            <xs:annotation>
              <xs:documentation>
                S sized ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.ship_m">
            <xs:annotation>
              <xs:documentation>
                M sized ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.ship_l">
            <xs:annotation>
              <xs:documentation>
                L sized ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.ship_xl">
            <xs:annotation>
              <xs:documentation>
                XL sized ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="stationclasslookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.station">
            <xs:annotation>
              <xs:documentation>
                Station
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="spaceclasslookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.area">
            <xs:annotation>
              <xs:documentation>
                Area
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.cluster">
            <xs:annotation>
              <xs:documentation>
                Cluster
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.galaxy">
            <xs:annotation>
              <xs:documentation>
                Galaxy
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.highway">
            <xs:annotation>
              <xs:documentation>
                Highway
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.sector">
            <xs:annotation>
              <xs:documentation>
                Sector
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.zone">
            <xs:annotation>
              <xs:documentation>
                Zone
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="entityclasslookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.entity">
            <xs:annotation>
              <xs:documentation>
                Entity
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.player">
            <xs:annotation>
              <xs:documentation>
                Player
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.nonplayer">
            <xs:annotation>
              <xs:documentation>
                Non-player
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.computer">
            <xs:annotation>
              <xs:documentation>
                Computer
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.npc">
            <xs:annotation>
              <xs:documentation>
                NPC
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="roomclasslookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="class.room">
            <xs:annotation>
              <xs:documentation>
                Room
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.cockpit">
            <xs:annotation>
              <xs:documentation>
                Cockpit
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.controlroom">
            <xs:annotation>
              <xs:documentation>
                Control Room
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.dockingbay">
            <xs:annotation>
              <xs:documentation>
                Docking bay
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="class.transporterroom">
            <xs:annotation>
              <xs:documentation>
                Transporter room
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="attentionlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="unknown" />
      <xs:enumeration value="ingalaxy" />
      <xs:enumeration value="incluster" />
      <xs:enumeration value="sectorvisible" />
      <xs:enumeration value="insector" />
      <xs:enumeration value="adjacentzone" />
      <xs:enumeration value="visible" />
      <xs:enumeration value="inzone" />
      <xs:enumeration value="nearby" />
      <xs:enumeration value="adjacentroom" />
      <xs:enumeration value="inroom" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="attentionexprlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="attention.unknown" />
          <xs:enumeration value="attention.ingalaxy" />
          <xs:enumeration value="attention.incluster" />
          <xs:enumeration value="attention.sectorvisible" />
          <xs:enumeration value="attention.insector" />
          <xs:enumeration value="attention.adjacentzone" />
          <xs:enumeration value="attention.visible" />
          <xs:enumeration value="attention.inzone" />
          <xs:enumeration value="attention.nearby" />
          <xs:enumeration value="attention.adjacentroom" />
          <xs:enumeration value="attention.inroom" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="componentstatelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="construction" />
      <xs:enumeration value="operational" />
      <xs:enumeration value="wreck" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="componentstateexprlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="componentstate.construction" />
          <xs:enumeration value="componentstate.operational" />
          <xs:enumeration value="componentstate.wreck" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="entitytypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="officer" />
      <xs:enumeration value="trader" />
      <xs:enumeration value="factionrepresentative" />
      <xs:enumeration value="shadyguy" />
      <xs:enumeration value="crowd" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="entitytypeexprlookup">
    <xs:annotation>
      <xs:documentation>
        Actor (entity) type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="entitytype.officer" />
          <xs:enumeration value="entitytype.trader" />
          <xs:enumeration value="entitytype.factionrepresentative" />
          <xs:enumeration value="entitytype.shadyguy" />
          <xs:enumeration value="entitytype.crowd" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="entityroleexprlookup">
    <xs:annotation>
      <xs:documentation>
        Actor (entity) role
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="entityrole.service" />
          <xs:enumeration value="entityrole.marine" />
          <xs:enumeration value="entityrole.passenger" />
          <xs:enumeration value="entityrole.prisoner" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="skilltypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="boarding" />
      <xs:enumeration value="engineering" />
      <xs:enumeration value="management" />
      <xs:enumeration value="morale" />
      <xs:enumeration value="piloting" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="skilltypeexprlookup">
    <xs:annotation>
      <xs:documentation>
        Skill type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="skilltype.boarding" />
          <xs:enumeration value="skilltype.engineering" />
          <xs:enumeration value="skilltype.management" />
          <xs:enumeration value="skilltype.morale" />
          <xs:enumeration value="skilltype.piloting" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="controlpostexprlookup">
    <xs:annotation>
      <xs:documentation>
        Control posting lookup
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="controlpost.aipilot" />
          <xs:enumeration value="controlpost.defence" />
          <xs:enumeration value="controlpost.manager" />
          <xs:enumeration value="controlpost.engineer" />
          <xs:enumeration value="controlpost.shadyguy" />
          <xs:enumeration value="controlpost.shiptrader" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="assignmentexprlookup">
    <xs:annotation>
      <xs:documentation>
        Subordinate assignment
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="assignment.defence" />
          <xs:enumeration value="assignment.mining" />
          <xs:enumeration value="assignment.trade" />
          <xs:enumeration value="assignment.build" />
          <xs:enumeration value="assignment.police" />
          <xs:enumeration value="assignment.watchdog" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="controlpositionexprlookup">
    <xs:annotation>
      <xs:documentation>
        Control position lookup
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="controlposition.comms" />
          <xs:enumeration value="controlposition.coordination" />
          <xs:enumeration value="controlposition.engineering" />
          <xs:enumeration value="controlposition.flight" />
          <xs:enumeration value="controlposition.gunner" />
          <xs:enumeration value="controlposition.navigation" />
          <xs:enumeration value="controlposition.pilot" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="infolibrarytypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="shiptypes_xl" />
      <xs:enumeration value="shiptypes_l" />
      <xs:enumeration value="shiptypes_m" />
      <xs:enumeration value="shiptypes_s" />
      <xs:enumeration value="shiptypes_xs" />
      <xs:enumeration value="stationtypes" />
      <xs:enumeration value="moduletypes_production" />
      <xs:enumeration value="moduletypes_build" />
      <xs:enumeration value="moduletypes_storage" />
      <xs:enumeration value="moduletypes_habitation" />
      <xs:enumeration value="moduletypes_defence" />
      <xs:enumeration value="moduletypes_communication" />
      <xs:enumeration value="moduletypes_dock" />
      <xs:enumeration value="moduletypes_pier" />
      <xs:enumeration value="moduletypes_other" />
      <xs:enumeration value="moduletypes_venture" />
      <xs:enumeration value="weapons_lasers" />
      <xs:enumeration value="weapons_missilelaunchers" />
      <xs:enumeration value="weapons_turrets" />
      <xs:enumeration value="weapons_missileturrets" />
      <xs:enumeration value="shieldgentypes" />
      <xs:enumeration value="enginetypes" />
      <xs:enumeration value="thrustertypes" />
      <xs:enumeration value="marines" />
      <xs:enumeration value="unique_npcs" />
      <xs:enumeration value="wares" />
      <xs:enumeration value="productionmethods" />
      <xs:enumeration value="researchmethods" />
      <xs:enumeration value="researchables" />
      <xs:enumeration value="inventory_wares" />
      <xs:enumeration value="races" />
      <xs:enumeration value="factions" />
      <xs:enumeration value="licences" />
      <xs:enumeration value="entitytypes" />
      <xs:enumeration value="equipmentmods" />
      <xs:enumeration value="paintmods" />
      <xs:enumeration value="clothingmods" />
      <xs:enumeration value="software" />
      <xs:enumeration value="bombs" />
      <xs:enumeration value="lasertowers" />
      <xs:enumeration value="mines" />
      <xs:enumeration value="navbeacons" />
      <xs:enumeration value="resourceprobes" />
      <xs:enumeration value="satellites" />
      <xs:enumeration value="timeline" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="roompopulationtypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="build" />
      <xs:enumeration value="trade" />
      <xs:enumeration value="drones" />
      <xs:enumeration value="ships" />
      <xs:enumeration value="repair" />
      <xs:enumeration value="ammo" />
      <xs:enumeration value="bar" />
      <xs:enumeration value="administrative" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="roompopulationtypeexprlookup">
    <xs:annotation>
      <xs:documentation>
        Room population type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="roompopulationtype.build" />
          <xs:enumeration value="roompopulationtype.trade" />
          <xs:enumeration value="roompopulationtype.drones" />
          <xs:enumeration value="roompopulationtype.ships" />
          <xs:enumeration value="roompopulationtype.repair" />
          <xs:enumeration value="roompopulationtype.ammo" />
          <xs:enumeration value="roompopulationtype.bar" />
          <xs:enumeration value="roompopulationtype.administrative" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="profilelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="flat">
        <xs:annotation>
          <xs:documentation>
            Flat (linear) distribution, default if no profile specified
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="increasing">
        <xs:annotation>
          <xs:documentation>
            Higher numbers are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="decreasing">
        <xs:annotation>
          <xs:documentation>
            Lower numbers are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="bell">
        <xs:annotation>
          <xs:documentation>
            Numbers in the middle of the range are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="inversebell">
        <xs:annotation>
          <xs:documentation>
            Higher and lower numbers are more likely than those in the middle
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="uipositionlookup">
    <xs:annotation>
      <xs:documentation>
        Position in conversation menu (a free position is selected if not supplied). This can be either a fixed named value, or a variable script expression (providing the option number between 1 and 6).
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="top_left" />
          <xs:enumeration value="left" />
          <xs:enumeration value="bottom_left" />
          <xs:enumeration value="top_right" />
          <xs:enumeration value="right" />
          <xs:enumeration value="bottom_right" />
          <xs:enumeration value="close">
            <xs:annotation>
              <xs:documentation>
                Hidden player choice that is selected when the player presses the &quot;close conversation&quot; button
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="helppositionlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="0">
            <xs:annotation>
              <xs:documentation>
                Top left corner (default)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="1">
            <xs:annotation>
              <xs:documentation>
                Middle of screen (targeting)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="2">
            <xs:annotation>
              <xs:documentation>
                Near weapon monitor
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="3">
            <xs:annotation>
              <xs:documentation>
                Near event monitor
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="4">
            <xs:annotation>
              <xs:documentation>
                Near speedbar
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="levellookup">
    <xs:annotation>
      <xs:documentation>
        Difficulty level
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="level.trivial">
            <xs:annotation>
              <xs:documentation>
                Trivial difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.veryeasy">
            <xs:annotation>
              <xs:documentation>
                Very easy difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.easy">
            <xs:annotation>
              <xs:documentation>
                Easy difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.medium">
            <xs:annotation>
              <xs:documentation>
                Medium difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.hard">
            <xs:annotation>
              <xs:documentation>
                Hard difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.veryhard">
            <xs:annotation>
              <xs:documentation>
                Very hard difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="level.impossible">
            <xs:annotation>
              <xs:documentation>
                Impossible difficulty level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="upkeepalertlevellookup">
    <xs:annotation>
      <xs:documentation>
        Upkeep alert level
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="alertlevel.low">
            <xs:annotation>
              <xs:documentation>
                Low upkeep alert level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="alertlevel.medium">
            <xs:annotation>
              <xs:documentation>
                Medium upkeep alert level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="alertlevel.high">
            <xs:annotation>
              <xs:documentation>
                High upkeep alert level
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="logcategorylookup">
    <xs:annotation>
      <xs:documentation>
        Logbook category
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="general" />
      <xs:enumeration value="missions" />
      <xs:enumeration value="squad" />
      <xs:enumeration value="upkeep" />
      <xs:enumeration value="tips" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="loginteractionlookup">
    <xs:annotation>
      <xs:documentation>
        Logbook interaction type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="guidance">
        <xs:annotation>
          <xs:documentation>
            Starts guidance to the object from the logbook UI
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="showonmap">
        <xs:annotation>
          <xs:documentation>
            Opens the map focused on the object from the logbook UI
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="conversationview">
    <xs:annotation>
      <xs:documentation>
        Conversation view type, defining the desired camera direction
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="startcontrol" />
      <xs:enumeration value="stopcontrol" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="relationcomparison">
    <xs:annotation>
      <xs:documentation>
        Behaviour to compare the relation range
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="exact">
        <xs:annotation>
          <xs:documentation>
            Relation is in range (default)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ge">
        <xs:annotation>
          <xs:documentation>
            Relation is greater than or equal
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="gt">
        <xs:annotation>
          <xs:documentation>
            Relation is greater than
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="le">
        <xs:annotation>
          <xs:documentation>
            Relation is less than or equal
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="lt">
        <xs:annotation>
          <xs:documentation>
            Relation is less than
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="not">
        <xs:annotation>
          <xs:documentation>
            Relation is not in range
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="formationshapelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="formationshape.dummy">
            <xs:annotation>
              <xs:documentation>
                unsupported - Dummy, no param
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.circle">
            <xs:annotation>
              <xs:documentation>
                param = radius
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.halfcircle">
            <xs:annotation>
              <xs:documentation>
                param = radius
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.invpointguard">
            <xs:annotation>
              <xs:documentation>
                param = radius
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.pointguard">
            <xs:annotation>
              <xs:documentation>
                param = radius
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.randomshape">
            <xs:annotation>
              <xs:documentation>
                unsupported
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.rotatingcircle">
            <xs:annotation>
              <xs:documentation>
                unsupported
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.singlefile">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.vshape">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.invvshape">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.cross">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.crossback">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.crossforward">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.xshape">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.xshapeforward">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.xshapeback">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.triangle">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.lineabreast">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.lineastern">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.wshape">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.eagle">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.twin">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.vulcan">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.dartvertical">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.darthorizontal">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="formationshape.echelon">
            <xs:annotation>
              <xs:documentation>
                param = distance
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="licencelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="capitalequipment" />
      <xs:enumeration value="capitalship" />
      <xs:enumeration value="ceremonyfriend" />
      <xs:enumeration value="ceremonyally" />
      <xs:enumeration value="generaluseequipment" />
      <xs:enumeration value="generaluseship" />
      <xs:enumeration value="intelligence" />
      <xs:enumeration value="militaryequipment" />
      <xs:enumeration value="militaryship" />
      <xs:enumeration value="police" />
      <xs:enumeration value="station_gen_basic" />
      <xs:enumeration value="station_gen_intermediate" />
      <xs:enumeration value="station_gen_advanced" />
      <xs:enumeration value="station_equip_sm" />
      <xs:enumeration value="station_equip_lxl" />
      <xs:enumeration value="station_illegal" />
      <xs:enumeration value="station_race_basic" />
      <xs:enumeration value="station_race_intermediate" />
      <xs:enumeration value="station_race_advanced" />
      <xs:enumeration value="station_venture" />
      <xs:enumeration value="subgroupfriend" />
      <xs:enumeration value="tradesubscription" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="relationlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="dock" />
      <xs:enumeration value="enemy" />
      <xs:enumeration value="friend" />
      <xs:enumeration value="kill" />
      <xs:enumeration value="killmilitary" />
      <xs:enumeration value="member" />
      <xs:enumeration value="nemesis" />
      <xs:enumeration value="neutral" />
      <xs:enumeration value="self" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="tradesorterlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="amount" />
      <xs:enumeration value="distance" />
      <xs:enumeration value="name" />
      <xs:enumeration value="offeramount" />
      <xs:enumeration value="price" />
      <xs:enumeration value="relativeprice" />
      <xs:enumeration value="stocklevel" />
      <xs:enumeration value="totalprice" />
      <xs:enumeration value="totalvolume" />
      <xs:enumeration value="volume" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="npcsummarysorterlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="template" />
      <xs:enumeration value="name" />
      <xs:enumeration value="role" />
      <xs:enumeration value="skill" />
      <xs:enumeration value="combinedskill" />
      <xs:enumeration value="potentialskillforpost" />
      <xs:enumeration value="potentialskillforrole" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="unitcategorylookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="unitcategory.attack" />
          <xs:enumeration value="unitcategory.build" />
          <xs:enumeration value="unitcategory.defence" />
          <xs:enumeration value="unitcategory.gascollector" />
          <xs:enumeration value="unitcategory.guard" />
          <xs:enumeration value="unitcategory.orecollector" />
          <xs:enumeration value="unitcategory.police" />
          <xs:enumeration value="unitcategory.repair" />
          <xs:enumeration value="unitcategory.transport" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="deployablecategorylookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="deployablecategory.lasertower" />
          <xs:enumeration value="deployablecategory.mine" />
          <xs:enumeration value="deployablecategory.navbeacon" />
          <xs:enumeration value="deployablecategory.resourceprobe" />
          <xs:enumeration value="deployablecategory.satellite" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="entityrolelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="service" />
      <xs:enumeration value="marine" />
      <xs:enumeration value="passenger" />
      <xs:enumeration value="prisoner" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="purposelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="purpose.trade" />
          <xs:enumeration value="purpose.fight" />
          <xs:enumeration value="purpose.build" />
          <xs:enumeration value="purpose.mine" />
          <xs:enumeration value="purpose.hack" />
          <xs:enumeration value="purpose.scan" />
          <xs:enumeration value="purpose.production" />
          <xs:enumeration value="purpose.storage" />
          <xs:enumeration value="purpose.connection" />
          <xs:enumeration value="purpose.habitation" />
          <xs:enumeration value="purpose.defence" />
          <xs:enumeration value="purpose.docking" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="targetpointtypelookup">
    <xs:annotation>
      <xs:documentation>
        Implicitly defines the interactions and the icon this target point should have
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="scan" />
      <xs:enumeration value="hack" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="controlpaneltypelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="controlpaneltype.hack_all_turrets" />
          <xs:enumeration value="controlpaneltype.hack_buildmodules" />
          <xs:enumeration value="controlpaneltype.hack_discount" />
          <xs:enumeration value="controlpaneltype.hack_engineer" />
          <xs:enumeration value="controlpaneltype.hack_production" />
          <xs:enumeration value="controlpaneltype.hack_shieldgenerators" />
          <xs:enumeration value="controlpaneltype.hack_storage" />
          <xs:enumeration value="controlpaneltype.hack_watchdogs" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="signalleaktypelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="signalleaktype.data" />
          <xs:enumeration value="signalleaktype.voice" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="boardingphaselookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="boardingphase.setup" />
          <xs:enumeration value="boardingphase.pre_approach" />
          <xs:enumeration value="boardingphase.approach" />
          <xs:enumeration value="boardingphase.pre_infiltration" />
          <xs:enumeration value="boardingphase.infiltration" />
          <xs:enumeration value="boardingphase.internalfight" />
          <xs:enumeration value="boardingphase.failed" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="boardingbehaviourlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="boardingbehaviour.attackescorts" />
          <xs:enumeration value="boardingbehaviour.targetengines" />
          <xs:enumeration value="boardingbehaviour.targetturrets" />
          <xs:enumeration value="boardingbehaviour.disabletarget" />
          <xs:enumeration value="boardingbehaviour.maintaindistance" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="marinestatuslookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="infiltrating" />
      <xs:enumeration value="fighting" />
      <xs:enumeration value="killed" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="waretransportlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="waretransport.container" />
          <xs:enumeration value="waretransport.solid" />
          <xs:enumeration value="waretransport.liquid" />
          <xs:enumeration value="waretransport.passenger" />
          <xs:enumeration value="waretransport.equipment" />
          <xs:enumeration value="waretransport.inventory" />
          <xs:enumeration value="waretransport.software" />
          <xs:enumeration value="waretransport.ship" />
          <xs:enumeration value="waretransport.workunit" />
          <xs:enumeration value="waretransport.research" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="relationchangereasonlookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="relationchangereason.missioncompleted" />
          <xs:enumeration value="relationchangereason.destroyedfactionenemy" />
          <xs:enumeration value="relationchangereason.smalltalkreward" />
          <xs:enumeration value="relationchangereason.attackedobject" />
          <xs:enumeration value="relationchangereason.boardedobject" />
          <xs:enumeration value="relationchangereason.killedobject" />
          <xs:enumeration value="relationchangereason.hackingdiscovered" />
          <xs:enumeration value="relationchangereason.scanningdiscovered" />
          <xs:enumeration value="relationchangereason.illegalcargo" />
          <xs:enumeration value="relationchangereason.missionfailed" />
          <xs:enumeration value="relationchangereason.tradecompleted" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="moodtypelookup">
    <xs:annotation>
      <xs:documentation>
        Faction mood type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="aggression" />
      <xs:enumeration value="avarice" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="moodlevellookup">
    <xs:annotation>
      <xs:documentation>
        Faction mood level
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="moodlevel.verylow" />
          <xs:enumeration value="moodlevel.low" />
          <xs:enumeration value="moodlevel.normal" />
          <xs:enumeration value="moodlevel.high" />
          <xs:enumeration value="moodlevel.veryhigh" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="orderstatelookup">
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="orderstate.setup">
            <xs:annotation>
              <xs:documentation>
                Order is in the parameter setup process, not all parameters have been provided yet. In this state the order cannot be enabled.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="orderstate.disabled">
            <xs:annotation>
              <xs:documentation>
                Order is disabled (this state is automatically entered when parameter setup is complete)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="orderstate.ready">
            <xs:annotation>
              <xs:documentation>
                Order is enabled but not running yet. In this state, an order in the queue is started when it becomes the current order (which is always the first order, except in order loops).
                A default order is started if no order in the queue is ready.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="orderstate.started">
            <xs:annotation>
              <xs:documentation>
                Order script has started and has not entered the critical state or the finish state.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="orderstate.critical">
            <xs:annotation>
              <xs:documentation>
                Order script has entered its critical state. In this state, the order cannot be cancelled directly any more, and parameters can only be edited if allowed by the order definition.
                Moving or disabling the order is not possible any more. Requests to cancel the order can be made, but they are not necessarily processed immediately; the cancelling behaviour
                is order-specific. To handle a cancel request in the critical state, the order script stack has to listen to &lt;event_object_order_cancelled&gt; with immediate=&quot;false&quot;.
                If not cancelled, the order can optionally leave the critical state by entering the finish state.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="orderstate.finish">
            <xs:annotation>
              <xs:documentation>
                Optional state that can be entered by the order script for finalisation actions. Disabling, moving and editing the order is not possible any more.
                The critical state cannot be entered any more. The order can be cancelled instantly at any time (unlike in the critical state, cancel requests are not passed to the script stack
                and cannot fail). This state could e.g. be useful if the actual order is already completed but the ship should move &quot;out of the way&quot; before continuing with the next order.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <!-- 
          <xs:enumeration value="orderstate.finished">
            <xs:annotation>
              <xs:documentation>
                The order script has finished running and the order is about to be removed (or reset in case of a user-created loop order). This state is not supposed to be encountered by scripts.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
 -->
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="loadoutflaglookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="engines">
        <xs:annotation>
          <xs:documentation>
            Engines.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="weapons">
        <xs:annotation>
          <xs:documentation>
            Weapons.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="shields">
        <xs:annotation>
          <xs:documentation>
            Shields.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="turrets">
        <xs:annotation>
          <xs:documentation>
            Turrets.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="shieldgroups">
        <xs:annotation>
          <xs:documentation>
            Shield groups.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="turretgroups">
        <xs:annotation>
          <xs:documentation>
            Turret groups.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ammo">
        <xs:annotation>
          <xs:documentation>
            Ammunition.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="units">
        <xs:annotation>
          <xs:documentation>
            Units (drones).
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="software">
        <xs:annotation>
          <xs:documentation>
            Software.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="thrusters">
        <xs:annotation>
          <xs:documentation>
            Thrusters.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="drones">
        <xs:annotation>
          <xs:documentation>
            Ability drones.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="add">
        <xs:annotation>
          <xs:documentation>
            Add loadout elements (not used for loadout generation).
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="remove">
        <xs:annotation>
          <xs:documentation>
            Remove loadout elements (not used for loadout generation).
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="loadoutflagbitmask">
    <xs:annotation>
      <xs:documentation>
        Loadout flag bitmask (use as many as required).
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="loadoutflaglookup" />
  </xs:simpleType>

  <xs:simpleType name="propflaglookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="shipyard">
        <xs:annotation>
          <xs:documentation>
            Object has ship production facilities
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="factionrepresentative">
        <xs:annotation>
          <xs:documentation>
            Object has faction leader on board
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="equipmentdock">
        <xs:annotation>
          <xs:documentation>
            Object has ship equipping facilities but no ship production
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="propflagbitmask">
    <xs:annotation>
      <xs:documentation>
        Prop flag bitmask (use as many as required).
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="propflaglookup" />
  </xs:simpleType>

  <xs:simpleType name="animationtriggerlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="abort" />
      <xs:enumeration value="assign_dockingbay" />
      <xs:enumeration value="attacked" />
      <xs:enumeration value="activate" />
      <xs:enumeration value="activate_chair" />
      <xs:enumeration value="activate_chair_holo" />
      <xs:enumeration value="activate_dockguidance" />
      <xs:enumeration value="activate_dockingbay_warning" />
      <xs:enumeration value="activate_landinggears" />
      <xs:enumeration value="battlestate_red" />
      <xs:enumeration value="battlestate_yellow" />
      <xs:enumeration value="battlestate_jumpprep" />
      <xs:enumeration value="chairconfig_default" />
      <xs:enumeration value="chairconfig_paranid" />
      <xs:enumeration value="close_cockpit" />
      <xs:enumeration value="close_dockingbay" />
      <xs:enumeration value="close_dockingbay_fence" />
      <xs:enumeration value="close_hangar" />
      <xs:enumeration value="cockpit_active" />
      <xs:enumeration value="cockpit_inactive" />
      <xs:enumeration value="damage_high" />
      <xs:enumeration value="damage_low" />
      <xs:enumeration value="damage_medium" />
      <xs:enumeration value="damage_none" />
      <xs:enumeration value="deactivate" />
      <xs:enumeration value="deactivate_chair" />
      <xs:enumeration value="deactivate_chair_holo" />
      <xs:enumeration value="deactivate_dockguidance" />
      <xs:enumeration value="deactivate_dockingbay_warning" />
      <xs:enumeration value="deactivate_landinggears" />
      <xs:enumeration value="fire" />
      <xs:enumeration value="open_cockpit" />
      <xs:enumeration value="open_dockingbay" />
      <xs:enumeration value="open_dockingbay_fence" />
      <xs:enumeration value="open_hangar" />
      <xs:enumeration value="quickenter" />
      <xs:enumeration value="retrieve_ship" />
      <xs:enumeration value="retrieve_ship_faster" />
      <xs:enumeration value="retrieve_ship_fastest" />
      <xs:enumeration value="startcontrol" />
      <xs:enumeration value="stopcontrol" />
      <xs:enumeration value="store_ship" />
      <xs:enumeration value="store_ship_faster" />
      <xs:enumeration value="store_ship_fastest" />
      <xs:enumeration value="unassign_dockingbay" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="encountertypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="destruction">
        <xs:annotation>
          <xs:documentation>
            Object has been destroyed.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="damage">
        <xs:annotation>
          <xs:documentation>
            Object has been damaged. Param = string describing the severity: low, medium, high
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="loot">
        <xs:annotation>
          <xs:documentation>
            Object has acquired loot. Param = string describing the value: low, medium, high
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- ===== Attribute groups ==== -->

  <!-- Base attribute group for filters, does not contain class attribute and class-specific attributes. They are added in sub-groups where required. -->
  <xs:attributeGroup name="find">
    <xs:attribute name="macro" type="macro" />
    <xs:attribute name="owner" type="owners" />
    <xs:attribute name="trueowner" type="owners" />
    <xs:attribute name="coverowner" type="owners" />
    <xs:attribute name="tag" type="expression">
      <xs:annotation>
        <xs:documentation>
          Connection tag
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="grouptag" type="expression">
      <xs:annotation>
        <xs:documentation>
          Connection group tag
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="state" type="componentstateexprlookup">
      <xs:annotation>
        <xs:documentation>
          State of component
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="integrated" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is integrated to the parent? (built-in component)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="invulnerable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is either hull or shield invulnerable, i.e it cannot take damage? Note: An object can be vulnerable but still indestructible.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hullinvulnerable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is hull invulnerable, i.e it cannot take take damage?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shieldinvulnerable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is shield invulnerable, i.e it cannot take damage?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="indestructible" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Can the object not be destroyed through damage?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="checkoperational" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Only include operational components? (default true) Otherwise also include construction and wrecked components. Affects attributes class and exactclass.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="functional" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is functional?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="surfaceelement" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is a surface element?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="module" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is a module?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="known" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Known to player?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="knownto" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Known to faction? (Faction or list of factions)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="suspicious" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Suspicious?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="destination" type="expression">
      <xs:annotation>
        <xs:documentation>
          Leads to this destination? (could be space, gate or highway exit gate)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hastradeoffer" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Component contains a trade offer?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tradesknownto" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Does the provided faction have knowledge of trade offers of the container?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canhaveofferlocation" type="expression">
      <xs:annotation>
        <xs:documentation>
          Offer tag
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="freemissionofferslot" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is a free mission offer location available at the container?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="freesignalleakslot" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is a free signal leak location available at the object?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="numfreeactorslots" type="numfreeactorslots" />
    <xs:attribute name="freemissionactorslot" type="freemissionactorslot" />
    <xs:attribute name="masstraffic" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is object from mass traffic?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="roompopulationtype" type="roompopulationtypeexprlookup" />
    <xs:attribute name="building" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is build module currently building
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="busy" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is build module currently busy
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbebuiltby" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can be built by this object?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbebuiltbyany" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can be built by any of these objects? (list or group)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbuildclass" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can build class? If null, filter is not applied.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canequipclass" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can equip class? If null, filter is not applied.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbuildequipment" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can build equipment ware (or list of wares)?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbuildmacro" type="expression">
      <xs:annotation>
        <xs:documentation>
          Can build macro?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="weaponmode" type="weaponmodelookup">
      <xs:annotation>
        <xs:documentation>
          Weapon mode
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="weapontype" type="weapontypelookup">
      <xs:annotation>
        <xs:documentation>
          Weapon type
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="primarypurpose" type="purposelookup">
      <xs:annotation>
        <xs:documentation>
          Primary purpose
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="deployablecategory" type="deployablecategorylookup">
      <xs:annotation>
        <xs:documentation>
          Deployable category
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="mayattack" type="expression">
      <xs:annotation>
        <xs:documentation>
          Does objects relation allow it to attack provided object or faction. True if relation is 'kill' or if relation is 'killmilitary' and provided object has primarypurpose.fight
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maybeattackedby" type="expression">
      <xs:annotation>
        <xs:documentation>
          May object be attacked by provided object or faction, based on their relations. True if relation is 'kill' or if relation is 'killmilitary' and object has primarypurpose.fight
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="canbepickedup" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Can object be picked up by another object?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="commandeerable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the object commandeerable
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="unit" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the object a unit
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hascommander" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Does the object have a commander
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="capturable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the object capturable
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="accelerator" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the gate an accelerator
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="active" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the object 'active'? Applicable for gates.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="signalleaktype" type="signalleaktypelookup">
      <xs:annotation>
        <xs:documentation>
          Signal Leak type
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_entity">
    <xs:attribute name="race" type="race" />
    <xs:attribute name="entitytype" type="entitytypeexprlookup" />
    <xs:attribute name="entityrole" type="entityroleexprlookup" />
    <xs:attribute name="controlpost" type="controlpostexprlookup" />
    <xs:attribute name="controlentity" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the actor a control entity?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="missionactor" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the actor a mission actor?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="representative" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the actor a faction representative?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="temporaryentity" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the actor temporary?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_station">
    <xs:attribute name="hasmasstraffic" type="hasmasstraffic" />
    <xs:attribute name="canclaimownership" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station capable of claiming ownership of a space?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tradestation" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a trade station
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shipyard" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a shipyard
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="equipmentdock" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station an equipment dock
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="defencestation" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a defence station
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="planneddefencestation" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a planned defence station, taking future modules into accounts
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="headquarters" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a headquarters
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="piratebase" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the station a pirate base
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_ship">
    <xs:attribute name="docked" type="docked" />
    <xs:attribute name="shiptype" type="shiptypeexprlookup" />
    <xs:attribute name="job" type="expression">
      <xs:annotation>
        <xs:documentation>
          Job identification string or list of job ID strings
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="validjobship" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the ship and those in its command structure organised correctly, as defined by their jobs?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="jobtags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Tag or list of tags to compare with the defined job category tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="encounterid" type="expression">
      <xs:annotation>
        <xs:documentation>
          Encounter identification string or list of encounter ID strings
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="encountership" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the ship an encounter job ship?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_room">
    <xs:attribute name="roomtype" type="roomtypeexprlookup" />
    <xs:attribute name="hascontrolpanel" type="controlpaneltypelookup">
      <xs:annotation>
        <xs:documentation>
          Room has a control panel of the specified type
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_zone">
    <xs:attribute name="normalzone" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Include only normal zones (not temporary, not gate zone and not highway)?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tempzone" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Include temporary zones?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_sector">
    <xs:attribute name="contested" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the sector contested?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="contestedby" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Is the sector contested by provided faction?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_cluster">
    <xs:attribute name="normalcluster" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Include only normal clusters (not presentation cluster, not venturer cluster)?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findext_damaged">
    <xs:attribute name="restorable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Wrecked components that can be restored (exclusive with 'repairable' and 'needsrepair')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="repairable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Damaged components that can be repaired but may still be functional (exclusive with 'restorable' and 'needsrepair')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="needsrepair" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Damaged components that are no longer functional and can be repaired (exclusive with 'restorable' and 'repairable')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findarbitrary">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_cluster" />
    <xs:attributeGroup ref="findext_damaged" />
    <xs:attributeGroup ref="findext_entity" />
    <xs:attributeGroup ref="findext_room" />
    <xs:attributeGroup ref="findext_sector" />
    <xs:attributeGroup ref="findext_ship" />
    <xs:attributeGroup ref="findext_station" />
    <xs:attributeGroup ref="findext_zone" />
    <xs:attribute name="class" type="classlookup">
      <xs:annotation>
        <xs:documentation>
          Class or list of classes (do not use in conjunction with 'exactclass' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exactclass" type="classlookup">
      <xs:annotation>
        <xs:documentation>
          Exact class or list of exact classes, not taking subclasses into account (do not use in conjunction with 'class' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findentity">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_entity" />
    <xs:attribute name="class" type="entityclasslookup">
      <xs:annotation>
        <xs:documentation>
          Entity class or list of classes (do not use with 'exactclass')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exactclass" type="entityclasslookup">
      <xs:annotation>
        <xs:documentation>
          Entity's exact class (or list of classes), not taking subclasses into account (do not use with 'class')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findobject">
    <xs:attributeGroup ref="find"/>
    <xs:attributeGroup ref="findext_ship" />
    <xs:attributeGroup ref="findext_station" />
    <xs:attribute name="class" type="objectclasslookup">
      <xs:annotation>
        <xs:documentation>
          Object class or list of classes (do not use with 'exactclass')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exactclass" type="objectclasslookup">
      <xs:annotation>
        <xs:documentation>
          Object's exact class (or list of classes), not taking subclasses into account (do not use with 'class')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findstation">
    <xs:attributeGroup ref="find"/>
    <xs:attributeGroup ref="findext_station" />
    <xs:attribute name="class" type="stationclasslookup">
      <xs:annotation>
        <xs:documentation>
          Station class
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findship">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_ship" />
    <xs:attribute name="class" type="shipclasslookup">
      <xs:annotation>
        <xs:documentation>
          Ship class
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findroom">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_room" />
    <xs:attribute name="class" type="roomclasslookup">
      <xs:annotation>
        <xs:documentation>
          Room class or list of classes (do not use in conjunction with 'exactclass' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exactclass" type="roomclasslookup">
      <xs:annotation>
        <xs:documentation>
          Room's exact class or list of exact classes, not taking subclasses into account (do not use in conjunction with 'class' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="findzone">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_zone" />
  </xs:attributeGroup>

  <xs:attributeGroup name="findsector">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_sector" />
  </xs:attributeGroup>

  <xs:attributeGroup name="findcluster">
    <xs:attributeGroup ref="find" />
    <xs:attributeGroup ref="findext_cluster" />
  </xs:attributeGroup>

  <xs:attributeGroup name="createship">
    <xs:attribute name="macro" type="macroname" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Ship group for random macro selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to ShipDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="capturable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the ship capturable? (default is based on class)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="sellable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the ship sellable? (default is true)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createnpc">
    <xs:attribute name="macro" type="macroname" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Character group for random macro selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="actor" type="expression">
      <xs:annotation>
        <xs:documentation>
          Existing actor to be used instead of creating a new NPC (only useful with variable expressions in scripts)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to CharacterDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createmodule">
    <xs:attribute name="macro" type="macroname" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Module group for random macro selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to ModuleDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="moduletypelimits">
    <xs:attribute name="build" type="moduletypelimit"/>
    <xs:attribute name="comm" type="moduletypelimit"/>
    <xs:attribute name="defence" type="moduletypelimit"/>
    <xs:attribute name="dock" type="moduletypelimit"/>
    <xs:attribute name="habitation" type="moduletypelimit"/>
    <xs:attribute name="other" type="moduletypelimit"/>
    <xs:attribute name="pier" type="moduletypelimit"/>
    <xs:attribute name="production" type="moduletypelimit"/>
    <xs:attribute name="storage" type="moduletypelimit"/>
  </xs:attributeGroup>

  <xs:attributeGroup name="createroom">
    <xs:attribute name="macro" type="macroname" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Room group for random macro selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to RoomDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createprop">
    <xs:attribute name="macro" type="macroname" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Prop group for random macro selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to PropDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createstation">
    <xs:attribute name="constructionplan" type="constructionplan" />
    <xs:attribute name="group" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Station group for random construction plan selection
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macro" type="expression">
      <xs:annotation>
        <xs:documentation>
          A station macro (either a plain macro string or a script expression that evaluates to a string or macro) to place instead of a construction plan. This station macro MUST have a moduleset defined for it.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference to StationDB entry (either a plain ID string or a script expression that evaluates to an ID string)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createobject">
    <xs:attribute name="macro" type="expression">
      <xs:annotation>
        <xs:documentation>
          An object macro (either a plain macro string or a script expression that evaluates to a string or macro).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="random">
    <xs:attribute name="exact" type="expression">
      <xs:annotation>
        <xs:documentation>
          Exact value (takes priority over min/max/profile/scale)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="list" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of values (takes priority over min/max/profile/scale, ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="expression">
      <xs:annotation>
        <xs:documentation>
          Minimum random number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="expression">
      <xs:annotation>
        <xs:documentation>
          Maximum random number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="profile" type="profilelookup">
      <xs:annotation>
        <xs:documentation>
          Random number profile (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="scale">
      <xs:annotation>
        <xs:documentation>
          Scale of random number profile (ignored if exact is set or if profile is flat)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="2" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="seed" type="expression">
      <xs:annotation>
        <xs:documentation>
          Optional source for fixed random number seed (must be an object, usually a ship/station, with a job/god spawn source)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="counting">
    <xs:attributeGroup ref="random" />
    <xs:attribute name="counter" type="variablename">
      <xs:annotation>
        <xs:documentation>
          Name of loop counter variable
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="reverse" type="boolean">
      <xs:annotation>
        <xs:documentation>
          If true then loop counter counts from the max value down to 1
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="range">
    <xs:attribute name="exact" type="expression">
      <xs:annotation>
        <xs:documentation>
          Exact number (takes priority over list and min/max)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="list" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of numbers (takes priority over min/max, ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="expression">
      <xs:annotation>
        <xs:documentation>
          Minimum number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="expression">
      <xs:annotation>
        <xs:documentation>
          Maximum number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="objecteventsource">
    <xs:attribute name="object" type="expression">
      <xs:annotation>
        <xs:documentation>
          Event object (required if group attribute not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="groupeventsource" />
    <xs:attribute name="check" type="checkeventsource" />
  </xs:attributeGroup>

  <xs:attributeGroup name="condition">
    <xs:attribute name="chance" type="expression">
      <xs:annotation>
        <xs:documentation>
          Percentage chance of condition being checked (condition fails if not)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:attributeGroup>

  <xs:attributeGroup name="eventcondition">
    <xs:attributeGroup ref="condition" />
  </xs:attributeGroup>

  <xs:attributeGroup name="noneventcondition">
    <xs:attributeGroup ref="condition" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:attributeGroup>

  <xs:attributeGroup name="action">
    <xs:attribute name="chance" type="expression">
      <xs:annotation>
        <xs:documentation>
          Chance percentage of action being performed (action is skipped if not)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="weight" type="expression">
      <xs:annotation>
        <xs:documentation>
          Weight of action which determines its chance of being selected (only evaluated in &lt;do_any&gt; blocks)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:attributeGroup>

  <xs:attributeGroup name="conditionalaction">
    <xs:attribute name="value" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          Value to match (checked for non-zero if no comparison range is specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="range" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:attributeGroup>

  <xs:attributeGroup name="position">
    <xs:attribute name="x" type="expression">
      <xs:annotation>
        <xs:documentation>
          X coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="y" type="expression">
      <xs:annotation>
        <xs:documentation>
          Y coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="z" type="expression">
      <xs:annotation>
        <xs:documentation>
          Z coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="expression">
      <xs:annotation>
        <xs:documentation>
          Position value, used in preference to coordinates if supplied
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="object" type="expression">
      <xs:annotation>
        <xs:documentation>
          An object (or any positional). Requires a space context to which its relative position is calculated. If also coordinates or a position value are supplied, they are interpreted as relative to the object.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="space" type="expression">
      <xs:annotation>
        <xs:documentation>
          Reference space to be used if the object attribute is supplied. Defaults to the space supplied by the parent XML node, if applicable, otherwise to the object's parent space.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="random">
      <xs:annotation>
        <xs:documentation>
          Distance from specified position
        </xs:documentation>
      </xs:annotation>
    </xs:attributeGroup>
  </xs:attributeGroup>

  <xs:attributeGroup name="rotation">
    <xs:attribute name="yaw" type="expression">
      <xs:annotation>
        <xs:documentation>
          Yaw rotation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="pitch" type="expression">
      <xs:annotation>
        <xs:documentation>
          Pitch rotation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="roll" type="expression">
      <xs:annotation>
        <xs:documentation>
          Roll rotation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="expression">
      <xs:annotation>
        <xs:documentation>
          Rotation value, used in preference to angles if supplied
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="boundingbox">
    <xs:attribute name="max" type="expression" use="required" />
    <xs:attribute name="center" type="expression" use="required" />
  </xs:attributeGroup>

  <xs:attributeGroup name="safepos">
    <xs:attribute name="allowyaxis" type="boolean" >
      <xs:annotation>
        <xs:documentation>
          Allow the generated position to also use the up/down axis, defaults to true
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="radius" type="expression">
      <xs:annotation>
        <xs:documentation>
          Radius to indicate necessary space required for a safe position (optional, typically defaults to the radius of the bounding box if an object or macro is supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="angle" type="expression">
      <xs:annotation>
        <xs:documentation>
          Angle tolerance from the specified direction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="direction" type="quadrantlookup">
      <xs:annotation>
        <xs:documentation>
          Direction for safepos checks. Based on the orientation of the 'directionobject' if provided. Can be combined with 'direction2'
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="direction2" type="quadrantlookup">
      <xs:annotation>
        <xs:documentation>
          Direction for safepos checks. Based on the orientation of the 'directionobject' if provided. Can be combined with 'direction' but ignored if opposing
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="directionobject" type="object">
      <xs:annotation>
        <xs:documentation>
          Direction object for safepos checks. If direction is not specified, the direction is considered to be from the base position to this object
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="position" />
    <xs:attribute name="ignored" type="object" />
    <xs:attribute name="includefiringrange" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Avoid the firing range of turrets
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="includeplotbox" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Avoid the plot box of stations
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="createobjectsafepos">
    <xs:attribute name="allowyaxis" type="boolean" >
      <xs:annotation>
        <xs:documentation>
          Allow the generated position to also use the up/down axis, defaults to true
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="radius" type="expression">
      <xs:annotation>
        <xs:documentation>
          Radius to indicate necessary space required for a safe position (defaults to created object radius if null)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="position" />
    <xs:attribute name="ignored" type="object" />
    <xs:attribute name="includefiringrange" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Avoid the firing range of turrets
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="includeplotbox" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Avoid the plot box of stations
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="orientation">
    <xs:attribute name="orientation" type="orientationlookup" use="required" />
    <xs:attribute name="refobject" type="expression" >
      <xs:annotation>
        <xs:documentation>
          Position of this object will be used as refposition, for boundingbox orientations the box of this object will be used.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="refposition" type="expression" >
      <xs:annotation>
        <xs:documentation>
          Position the orientation refers to (e.g. look_at means look from position to refposition), ignored if refobject is set
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="rgbcolour">
    <xs:attribute name="r" type="colour">
      <xs:annotation>
        <xs:documentation>
          Red.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="g" type="colour">
      <xs:annotation>
        <xs:documentation>
          Green.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="b" type="colour">
      <xs:annotation>
        <xs:documentation>
          Blue.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="playerchoice">
    <xs:attribute name="text" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          Choice text
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="position" type="uipositionlookup" />
    <xs:attribute name="highlighted" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Optional, set to true to highlight the option and to indicate that it is mission-related (defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="selectable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Optional, determines whether the option is selectable. Defaults to true if not supplied.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="confidence" type="expression">
      <xs:annotation>
        <xs:documentation>
          Optional, specifies the default confidence of the player option for the smalltalk mini-game (1 to 5, default is 0, i.e. no confidence is displayed)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tooltip" type="expression">
      <xs:annotation>
        <xs:documentation>
          Optional, specifies the tooltip displayed for this option.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="interaction">
    <xs:annotation>
      <xs:documentation>
        Interactive notification data
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="text" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          Text displayed during interactive notification to prompt player to interact
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="param" type="expression">
      <xs:annotation>
        <xs:documentation>
          Interactive notification parameter passed to &lt;event_player_interaction&gt;
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="param2" type="expression">
      <xs:annotation>
        <xs:documentation>
          Secondary interactive notification parameter passed to &lt;event_player_interaction&gt;
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="silent" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Should the flashing effect of the target monitor be suppressed?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="conversationactor">
    <xs:attribute name="actor" type="expression">
      <xs:annotation>
        <xs:documentation>
          Conversation actor entity (use attribute context and template instead to provide an NPC template instead of an entity as conversation actor)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="context" type="expression">
      <xs:annotation>
        <xs:documentation>
          Controllable object context of the provided NPC template (when using template attribute instead of the actor attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="template" type="expression">
      <xs:annotation>
        <xs:documentation>
          Conversation actor NPC template (can be used instead of actor attribute to provide an NPC template, requires context attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="showhelp">
    <xs:attribute name="position" type="expression">
      <xs:annotation>
        <xs:documentation>
          Position of help text (defined in parameters.xml) - defaults to 0
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="duration" type="expression">
      <xs:annotation>
        <xs:documentation>
          Duration of help text display. If not provided, a suitable duration will be calculated.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="log" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Add help text to logbook? Default is false
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="allowpause" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Pause keeps the help text open (default is true)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="dropcargo">
    <xs:attribute name="groupname" type="lvalueexpression">
      <xs:annotation>
        <xs:documentation>
          Name of the group to which all spawned ware containers will be added (optional, group will be created if it does not exist yet)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="wares" type="lvalueexpression">
      <xs:annotation>
        <xs:documentation>
          Name of the value that will receive a list of all spawned ware types (optional)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="amounts" type="lvalueexpression">
      <xs:annotation>
        <xs:documentation>
          Name of the value that will receive a list of ware amounts, corresponding to the wares result list.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="unbundle" type="booleanexpression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Should the ware be unbundled (turn ware into ammo/units) on transfer? (optional, defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="bundle" type="booleanexpression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Do the wares to be dropped come from ammo/unit storage? (optional, defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="resetobjectboost">
    <xs:attribute name="object" type="object" use="required" />
    <xs:attribute name="otherobject" type="expression">
      <xs:annotation>
        <xs:documentation>
          Object the boost is towards (takes preference over 'faction')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction the boost is towards ('otherobject' takes preference if provided)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="objectboost">
    <xs:attributeGroup ref="resetobjectboost" />
    <xs:attribute name="decay" type="expression">
      <xs:annotation>
        <xs:documentation>
          Decay rate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="delay" type="expression">
      <xs:annotation>
        <xs:documentation>
          Decay delay
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="objectrelationboost">
    <xs:attributeGroup ref="objectboost" />
    <xs:attribute name="silent" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the relation boost silent, i.e. without player notification? See &lt;event_player_relation_changed&gt;
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="existingpeoplelist">
    <xs:attribute name="people" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of NPC templates (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="newroles" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of roles to reassign people (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="matchingpeoplelist">
    <xs:attribute name="amounts" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of amounts (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="currentroles" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of roles currently assigned to help identify people (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="newroles" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of roles to reassign people (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="races" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of races to help identify people (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="skills" type="expression">
      <xs:annotation>
        <xs:documentation>
          List of skills to help identify people (size must match with other lists)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exact" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Are the skills exact or used to find a suitable tier (defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="setentityflags">
    <xs:attribute name="skillsvisible" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set skills to visible or invisible. Skills are hidden unless explicitly made visible.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="customhandler" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is there a custom comm handler for player-initiated comm.?
          If so, this suppresses the generic &lt;event_conversation_started&gt; handler to avoid interference.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="intransit" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set whether currently in transit or not? In transit actors do not activly control objects.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="busy" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set whether currently busy or not? Busy actors do not activly control objects.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="missionactor" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set whether the actor is a mission actor or not.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="remote" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set whether the actor is remote commable or not.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="temporary" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set whether the actor is temporary or not.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hidden" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is the actor hidden in their room
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tradesvisible" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Set trades to visible or invisible. Trades are hidden unless explicitly made visible. (e.g. Shady Guy)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="buildexcludewares">
    <xs:attribute name="wares" type="ware">
      <xs:annotation>
        <xs:documentation>
          (optional) single ware or list of wares to set, add or remove, ommitting this will clear the list if append and remove are false
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="append" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Should the specified ware(s) be added to the existing exclusion list? (defaults to false which will replace or remove existing entries)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="remove" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Should the specified ware(s) be removed from the existing exclusion list? (defaults to false which will add or replace existing entries)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="buildincludewares">
    <xs:attribute name="wares" type="ware">
      <xs:annotation>
        <xs:documentation>
          (optional) single ware or list of wares to set, add or remove, ommitting this will clear the list if append and remove are false (default)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="append" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Should the specified ware(s) be added to the existing inclusion list? (defaults to false which will replace or remove existing entries)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="remove" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Should the specified ware(s) be removed from the existing inclusion list? (defaults to false which will add or replace existing entries)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- ===== Complex types ==== -->

  <xs:complexType name="filedoc">
    <xs:sequence>
      <xs:element name="author" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Author details
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="name" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Author name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="alias" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Author alias
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="contact" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Author contact details
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="content" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="reference" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                File reference
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                File name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="description" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                File description
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="version" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="number" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Internal version number
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="date" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Date of current version
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="status" type="versionstatus">
            <xs:annotation>
              <xs:documentation>
                Status of current version
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <!-- Usage note: Use together with one of the attributeGroups "findarbitrary", "findobject", "findstation", or "findship". -->
  <!-- If the class of result components is already determined and is neither ship nor station, you can just use attributeGroup "find". -->
  <xs:complexType name="matchbase">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="match" type="matchsubfilter">
        <xs:annotation>
          <xs:documentation>
            Match filter
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_any" type="matchsubfilter">
        <xs:annotation>
          <xs:documentation>
            Match any of the specified filters (attributes and sub-elements)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_parent" type="matchsubfilter">
        <xs:annotation>
          <xs:documentation>
            Match filter for the parent of the object
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_context" type="matchsubfilter">
        <xs:annotation>
          <xs:documentation>
            Match filter for the context of the object
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_child" type="matchsubfilterrange">
        <xs:annotation>
          <xs:documentation>
            Match filter for the children of the objects
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_content" type="matchsubfilterrange">
        <xs:annotation>
          <xs:documentation>
            Match filter for the contained objects of the objects
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_macro_children" type="matchrange">
        <xs:annotation>
          <xs:documentation>
            Match filter for amount of children defined in the macro of the objects
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_hull" type="matchrange">
        <xs:annotation>
          <xs:documentation>
            Match hull percentage
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_max_hull" type="matchrange">
        <xs:annotation>
          <xs:documentation>
            Match max hull percentage
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_shield" type="matchrange">
        <xs:annotation>
          <xs:documentation>
            Match shield percentage
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_secrecy_level" type="matchrange">
        <xs:annotation>
          <xs:documentation>
            Match object secrecy level
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_attention">
        <xs:annotation>
          <xs:documentation>
            Match attention level
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="attentionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Min attention level (not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="attentionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Max attention level (not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="exact" type="attentionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Exact attention level (not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_revealed_percentage" type="matchrevealedpercentage">
        <xs:annotation>
          <xs:documentation>
            Match by reveal percentage filter
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_pilot">
        <xs:annotation>
          <xs:documentation>
            Match filter for the ship's pilot
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="findentity" />
              <xs:attribute name="negate" type="negatefilter" />
              <xs:attribute name="comment" type="comment" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="match_distance">
        <xs:annotation>
          <xs:documentation>
            Match by distance filter. Distance can be checked either to an object or to a position. The reference space, if supplied, must contain the searched objects. min and/or max must be set.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="x" type="expression">
            <xs:annotation>
              <xs:documentation>
                X coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="y" type="expression">
            <xs:annotation>
              <xs:documentation>
                Y coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="z" type="expression">
            <xs:annotation>
              <xs:documentation>
                Z coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="value" type="expression">
            <xs:annotation>
              <xs:documentation>
                Position value, used in preference to coordinates if supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object, used in preference to coordinates if supplied. If no space context is supplied, the object's sector is used, so the searched objects are required to be in the same sector.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Reference space which has to contain both the reference (object or position) and the searched objects.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="min" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimal distance (min distance is not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximal distance (max distance is not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_gate_distance">
        <xs:annotation>
          <xs:documentation>
            Match by distance by jumpgates. Calculation based on the sectors of the objects. Checking distance of clusters will check between two random sectors within them.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="expression">
            <xs:annotation>
              <xs:documentation>
                Min distance by jumpgates (not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression">
            <xs:annotation>
              <xs:documentation>
                Max distance by jumpgates (not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Origin object for the distance calculation. Passing cluster will base the check on a random sector.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_size">
        <xs:annotation>
          <xs:documentation>
            Match by size filter. Size is based on diameter of the bounding box. min and/or max must be set.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimal size of the bounding box (min size is not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximal size (max size is not compared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_is_in_view_of">
        <xs:annotation>
          <xs:documentation>
            Match by view angle filter. Can be checked either to an object or to a position AND rotation. The reference space, if supplied, must contain the searched objects.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="x" type="expression">
            <xs:annotation>
              <xs:documentation>
                X coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="y" type="expression">
            <xs:annotation>
              <xs:documentation>
                Y coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="z" type="expression">
            <xs:annotation>
              <xs:documentation>
                Z coordinate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pitch" type="expression">
            <xs:annotation>
              <xs:documentation>
                Pitch (rotation around x axis)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="yaw" type="expression">
            <xs:annotation>
              <xs:documentation>
                Yaw (rotation around y axis)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="roll" type="expression">
            <xs:annotation>
              <xs:documentation>
                Roll (rotation around Z axis)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object, used in preference to coordinates if supplied. If no space context is supplied, the object's sector is used, so the searched objects are required to be in the same sector.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Reference space which has to contain both the reference (object or position/rotation) and the searched objects.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="vertical" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The vertical viewing angle (full range from top to bottom)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="horizontal" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The horizontal viewing angle (full range from left to right)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_buyoffer" type="matchtradeoffer">
        <xs:annotation>
          <xs:documentation>
            Match filter for available buy offers
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_selloffer" type="matchtradeoffer">
        <xs:annotation>
          <xs:documentation>
            Match filter for available sell offers
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_build" type="matchbuild">
        <xs:annotation>
          <xs:documentation>
            Match filter for build tasks
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_products" type="matchwarelist">
        <xs:annotation>
          <xs:documentation>
            Match filter for products of a Container or Production Module. The match is valid if the object produces any of the supplied wares, even if there are no current sell offers.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_resources" type="matchwarelist">
        <xs:annotation>
          <xs:documentation>
            Match filter for resources of a Container or Production Module. The match is valid if the object consumes any of the supplied wares, even if there are no current buy offers.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_any_cargo" type="matchwarelist">
        <xs:annotation>
          <xs:documentation>
            Match filter for the cargo wares of a container class object (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_any_wares" type="matchwarelist">
        <xs:annotation>
          <xs:documentation>
            Match filter for the non-cargo wares of an object (e.g. Collectable Ware Drops, Asteroids)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_basket_wares" type="matchwarelist">
        <xs:annotation>
          <xs:documentation>
            Match filter for the basket wares of a job ship
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_relation_of">
        <xs:annotation>
          <xs:documentation>
            Match by relation filter. Relation of 'faction' or 'object' is checked against filtered object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object to reference (takes preference over 'faction')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction to reference ('object' takes preference if provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="relation" type="relationlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation range
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comparison" type="relationcomparison" />
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_relation_to">
        <xs:annotation>
          <xs:documentation>
            Match by relation filter. Relation of filtered object is checked against 'faction' or 'object'.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object to reference (takes preference over 'faction')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction to reference ('object' takes preference if provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="relation" type="relationlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation range
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comparison" type="relationcomparison" />
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_dock">
        <xs:annotation>
          <xs:documentation>
            Match filter for a dock
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="free" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is dock free?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="size" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Dock compatibility size
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="storage" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this docking bay an internal storage bay? (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="building" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Does dock allow building?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="trading" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Does dock allow trading?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowplayeronly" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is dock exclusive for player-controlled ship?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureronly" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is dock exclusive for venturers?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureplatform" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Specific venture platform with which venture dock must be associated (can be null)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="match_units_stored" type="matchunits">
        <xs:annotation>
          <xs:documentation>
            Match filter for stored units on a Defensible object (including both available and unavailable)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_units_available" type="matchunits">
        <xs:annotation>
          <xs:documentation>
            Match filter for available units on a Defensible object
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_units_unavailable" type="matchunits">
        <xs:annotation>
          <xs:documentation>
            Match filter for unavailable units on a Defensible object
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_cargo" type="matchwaresorcargo">
        <xs:annotation>
          <xs:documentation>
            Match filter for the cargo of a storage module or container class objects (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_wares" type="matchwaresorcargo">
        <xs:annotation>
          <xs:documentation>
            Match filter for the non-cargo wares of an object (e.g. Collectable Ware Drops, Asteroids)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_loadout" type="matchloadout">
        <xs:annotation>
          <xs:documentation>
            Match filter for loadout installed on defensible class objects (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_weapon_mod" type="matchweaponmod">
        <xs:annotation>
          <xs:documentation>
            Match filter for weapon mods installed on defensible class objects (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_engine_mod" type="matchenginemod">
        <xs:annotation>
          <xs:documentation>
            Match filter for engine mods installed on objects (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_shield_mod" type="matchshieldmod">
        <xs:annotation>
          <xs:documentation>
            Match filter for shield mods installed on defensible class objects (e.g. Ships, Stations)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_ship_mod" type="matchshipmod">
        <xs:annotation>
          <xs:documentation>
            Match filter for ship mods installed on ships
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_paint_mod" type="matchpaintmod">
        <xs:annotation>
          <xs:documentation>
            Match filter for paint mods installed on ships
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="match_any_equipment_mod">
        <xs:annotation>
          <xs:documentation>
            Match filter for any equipmentmod installed on defensible class objects
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="matchsubfilter">
    <xs:complexContent>
      <xs:extension base="matchbase">
        <xs:attributeGroup ref="findarbitrary" />
        <xs:attribute name="negate" type="negatefilter" />
        <xs:attribute name="comment" type="comment" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="matchsubfilterrange">
    <xs:complexContent>
      <xs:extension base="matchbase">
        <xs:attributeGroup ref="findarbitrary"/>
        <xs:attributeGroup ref="range" />
        <xs:attribute name="negate" type="negatefilter" />
        <xs:attribute name="comment" type="comment" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="matchtradeoffer">
    <xs:complexContent>
      <xs:extension base="matchtrade">
        <xs:attribute name="negate" type="negatefilter" />
        <xs:attribute name="comment" type="comment" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Trade filter -->
  <xs:complexType name="matchbuyer">
    <xs:annotation>
      <xs:documentation>
        Match filter for the buyer of the trade
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="matchbase">
        <xs:attributeGroup ref="findarbitrary" />
        <xs:attribute name="comment" type="comment" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Trade filter -->
  <xs:complexType name="matchseller">
    <xs:annotation>
      <xs:documentation>
        Match filter for the seller of the trade
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="matchbase">
        <xs:attributeGroup ref="findarbitrary" />
        <xs:attribute name="comment" type="comment" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="matchwarelist">
    <xs:attribute name="wares" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          List of wares
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="negate" type="negatefilter" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="matchwaresorcargo">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="ware">
        <xs:complexType>
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Ware or list of wares
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="exact" type="expression">
            <xs:annotation>
              <xs:documentation>
                Exact number (takes priority over min/max)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="min" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimum number (ignored if exact is set)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximum number (ignored if exact is set)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negate" type="negatefilter" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="matchrange">
    <xs:attributeGroup ref="range" />
    <xs:attribute name="negate" type="negatefilter" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="matchrevealedpercentage">
    <xs:attribute name="secrecylevel" type="expression">
      <xs:annotation>
        <xs:documentation>
          Secrecy level (omit for all)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="range" />
    <xs:attribute name="negate" type="negatefilter" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="matchunits">
    <xs:attribute name="category" type="unitcategorylookup" use="required">
      <xs:annotation>
        <xs:documentation>
          Unit Category to match
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="range" />
    <xs:attribute name="negate" type="negatefilter" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="matchtradeoffervalues">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="amount" type="range">
        <xs:annotation>
          <xs:documentation>
            Range for the total amount of the trade offer wares
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="minamount" type="range">
        <xs:annotation>
          <xs:documentation>
            Range for the min amount of the trade offer wares
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="totalprice" type="range">
        <xs:annotation>
          <xs:documentation>
            Range for the total price of the trade offer
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="minprice" type="range">
        <xs:annotation>
          <xs:documentation>
            Range for the min price of the trade offer
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="matchtrade">
    <xs:all>
      <xs:element name="amount" type="rangefilter" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            Filter by the amount in the trade, not including reservations
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="offeramount" minOccurs="0">
        <xs:complexType>
          <xs:annotation>
            <xs:documentation>
              Filter by the amount in the trade in addition to the amount reserved
            </xs:documentation>
          </xs:annotation>
          <xs:complexContent>
            <xs:extension base="rangefilter">
              <xs:attribute name="tradepartner" type="container">
                <xs:annotation>
                  <xs:documentation>
                    (optional) tradepartner that will do the trading. If specified this MUST be the object that does ware reservations.
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="price" type="rangefilter" minOccurs="0" />
      <xs:element name="relativeprice" type="rangefilter" minOccurs="0" />
      <xs:element name="stocklevel" type="rangefilter" minOccurs="0" />
      <xs:element name="totalprice" type="rangefilter" minOccurs="0" />
      <xs:element name="volume" type="rangefilter" minOccurs="0" />
      <xs:element name="totalvolume" type="rangefilter" minOccurs="0" />
      <xs:element name="mintotalvolume" type="rangefilter" minOccurs="0" />
      <xs:element name="match_buyer" type="matchbuyer" minOccurs="0" />
      <xs:element name="match_seller" type="matchseller" minOccurs="0" />
    </xs:all>
    <xs:attribute name="wares" type="ware">
      <xs:annotation>
        <xs:documentation>
          (optional) single ware or list of wares to filter offers for
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="unbundle" type="booleanexpression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Should the ware be unbundled (turn ware into ammo/units) on transfer?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="bundle" type="booleanexpression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Should the ware be bundled (convert ammo/unit -> ware) on transfer?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchbuild">
    <xs:all>
      <xs:element name="price" type="rangefilter" minOccurs="0" />
    </xs:all>
    <xs:attribute name="macro" type="macro" />
    <xs:attribute name="faction" type="faction" />
  </xs:complexType>

  <xs:complexType name="matchloadout">
    <xs:attribute name="wares" type="expression" use="optional">
      <xs:annotation>
        <xs:documentation>
          A list of wares or table of ware amounts that the loadout should contain. List may contain repeats if more than one of an item is required.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macros" type="expression" use="optional">
      <xs:annotation>
        <xs:documentation>
          A list of macros or table of macro amount that the loadout should contain. List may contain repeats if more than one of an item is required.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchweaponmod">
    <xs:attribute name="macro" type="expression">
      <xs:annotation>
        <xs:documentation>
          Weapon macro of weapon on which weapon mod should be installed (any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Weapon mod ware (from equipmentmods.xml, defines a quality level and primary property of weapon mod, any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchenginemod">
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Engine mod ware (from equipmentmods.xml, defines a quality level and primary property of engine mod, any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchshieldmod">
    <xs:attribute name="context" type="expression">
      <xs:annotation>
        <xs:documentation>
          Shield group context on which shield mod should be installed (macro path as string, object's primary shield group if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="expression">
      <xs:annotation>
        <xs:documentation>
          Shield group on which shield mod should be installed (object's primary shield group if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Shield mod ware (from equipmentmods.xml, defines a quality level and primary property of shield mod, any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchshipmod">
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Ship mod ware (from equipmentmods.xml, defines a quality level and primary property of ship mod, any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="matchpaintmod">
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Paint mod ware (from equipmentmods.xml, defines a quality level and primary property of paint mod, any if not specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="range">
    <xs:attributeGroup ref="range" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="selectrange">
    <xs:group ref="selectrange" />
    <xs:attributeGroup ref="range" />
    <xs:attribute name="selection" type="selectionlookup" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="position">
    <xs:annotation>
      <xs:documentation>
        Position relative to a given space or object
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="position" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="rotation">
    <xs:annotation>
      <xs:documentation>
        Rotation in space
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="rotation" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="boundingbox">
    <xs:annotation>
      <xs:documentation>
        Bounding box relative to a given space or object
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="boundingbox" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="safepos">
    <xs:annotation>
      <xs:documentation>
        Safe position relative to a given space or object
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="safepos" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="createobjectsafepos">
    <xs:annotation>
      <xs:documentation>
        Create the object using a safe position
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="createobjectsafepos" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="orientation">
    <xs:annotation>
      <xs:documentation>
        Orientation in space
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="orientation" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="componentoffset">
    <xs:annotation>
      <xs:documentation>
        Component Offset
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="position" type="position" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="object" type="object" use="required" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="rangefilter">
    <xs:attribute name="comment" type="comment" />
    <xs:attribute name="exact" type="expression">
      <xs:annotation>
        <xs:documentation>
          Exact number (takes priority over min/max)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="expression">
      <xs:annotation>
        <xs:documentation>
          Minimum number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="expression">
      <xs:annotation>
        <xs:documentation>
          Maximum number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="shipdbcategory">
    <xs:attribute name="faction" type="rawfactionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="size">
      <xs:annotation>
        <xs:documentation>
          Ship size
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="ship_xs" />
          <xs:enumeration value="ship_s" />
          <xs:enumeration value="ship_m" />
          <xs:enumeration value="ship_l" />
          <xs:enumeration value="ship_xl" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="shipdbcategoryselect">
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="size" type="shipsizeclasslookup">
      <xs:annotation>
        <xs:documentation>
          Ship size
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="required" type="boolean">
      <xs:annotation>
        <xs:documentation>
          If true then an error message will be produced if no matching ship entry is found (default is true). Note that no ship will be created in either case.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="characterdbcategory">
    <xs:attribute name="faction" type="rawfactionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="rawraceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Character race (species)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="characterdbcategoryselect">
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="raceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Character race or list of races
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="required" type="boolean">
      <xs:annotation>
        <xs:documentation>
          If true then an error message will be produced if no matching character entry is found (default is true). Note that no NPC will be created in either case.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="moduledbcategory">
    <xs:attribute name="faction" type="rawfactionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="rawraceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Production ware
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="moduledbcategoryselect">
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="raceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Module race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Production ware
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="required" type="boolean">
      <xs:annotation>
        <xs:documentation>
          If true then an error message will be produced if no matching module entry is found (default is true). Note that no module will be created in either case.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="roomdbcategory">
    <xs:attribute name="race" type="rawraceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="propdbcategory">
    <xs:sequence>
      <xs:element name="security" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Security level (not available from scripts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Minimum security level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Maximum security level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="economy" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Economy level (not available from scripts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Minimum economy level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Maximum economy level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="maintenance" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Maintenance level (not available from scripts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Minimum maintenance level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:float" use="optional">
            <xs:annotation>
              <xs:documentation>
                Maximum maintenance level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="tags" type="expression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macro" type="expression" use="optional">
      <xs:annotation>
        <xs:documentation>
          Macro that props can be attached to
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="flags" type="propflagbitmask" use="optional">
      <xs:annotation>
        <xs:documentation>
          Prop flags (not available from scripts)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="stationdbcategory">
    <xs:attribute name="faction" type="rawfactionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="rawraceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Production ware
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="stationdbcategoryselect">
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction or list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="race" type="raceexprlookup">
      <xs:annotation>
        <xs:documentation>
          Station race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="expression">
      <xs:annotation>
        <xs:documentation>
          Specification tag or list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ware" type="expression">
      <xs:annotation>
        <xs:documentation>
          Production ware
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="required" type="boolean">
      <xs:annotation>
        <xs:documentation>
          If true then an error message will be produced if no matching station entry is found (default is true). Note that no station will be created in either case.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="event_playerpricemodifier">
    <xs:attributeGroup ref="eventcondition" />
    <xs:attribute name="source" type="expression">
      <xs:annotation>
        <xs:documentation>
          Source of discount/commission, can be an object or a faction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type">
      <xs:annotation>
        <xs:documentation>
          Required type of discount/commission source
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="object">
            <xs:annotation>
              <xs:documentation>
                Source is an object (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="faction">
            <xs:annotation>
              <xs:documentation>
                Source is a faction
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadout">
    <xs:attribute name="id" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Loadout id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="textdbref" use="optional">
      <xs:annotation>
        <xs:documentation>
          Loadout name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="icon" type="namestring" use="optional">
      <xs:annotation>
        <xs:documentation>
          Loadout icon name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="build" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Can be used for building?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="job" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Can be used by jobs?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="player" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Can be used by player?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="generated" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Loadout was generated?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutmacro">
    <xs:attribute name="macro" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="path" type="namestring" use="optional">
      <xs:annotation>
        <xs:documentation>
          Macro path
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="optional" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional item?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="debug" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Debug-only item?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutgroup">
    <xs:attribute name="macro" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="path" type="namestring" use="optional">
      <xs:annotation>
        <xs:documentation>
          Macro path
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="namestring" use="optional">
      <xs:annotation>
        <xs:documentation>
          Connection group
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exact" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Exact number/percentage of slots to fill (takes priority over min/max)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Minimum number/percentage of slots to fill (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Maximum number/percentage of slots to fill (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="percent" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Exact/min/max values are percentages?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="optional" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional item?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutammo">
    <xs:attribute name="macro" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="exact" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Exact number of ammunution units (takes priority over min/max)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Minimum number of ammunution units (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Maximum number of ammunution units (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="chance" type="xs:float" use="optional">
      <xs:annotation>
        <xs:documentation>
          Percentage chance of being present
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="optional" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional item?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutsoftware">
    <xs:attribute name="ware" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Ware name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="chance" type="xs:float" use="optional">
      <xs:annotation>
        <xs:documentation>
          Percentage chance of being present
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutvalue">
    <xs:attribute name="min" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Minimum value
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Maximum value
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="chance" type="xs:float" use="optional">
      <xs:annotation>
        <xs:documentation>
          Percentage chance of being set
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="loadoutvirtualmacro">
    <xs:attribute name="macro" type="namestring" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="optional" type="boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional item?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <!-- ===== Generic groups ==== -->

  <xs:group name="selectrange">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="select">
          <xs:annotation>
            <xs:documentation>
              Selection element (used if selection attribute present)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attributeGroup ref="range" />
            <xs:attribute name="weight" type="selectionweight" />
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="equipmentmods">
    <xs:annotation>
      <xs:documentation>
        Equipment mods
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="1">
        <xs:sequence>
          <xs:element name="chance" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
                The percentage chance that an equipment mod may be installed on this ship. Also the chance that additional equipment mods may be installed. Given as a float between 0 and 1.
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attributeGroup ref="random" />
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <xs:sequence>
          <xs:element name="engine" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
                Engine mod specification
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attribute name="ware" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Engine mod ware (from equipmentmods.xml, defines a quality level and primary property of engine mod)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:complexType>
          </xs:element>
          <xs:element name="weapon" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>
                Weapon mod specification
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attribute name="ware" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Weapon mod ware (from equipmentmods.xml, defines a quality level and primary property of weapon mod)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="macro" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Weapon macro of weapon on which weapon mod should be installed
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:complexType>
          </xs:element>
          <xs:element name="shield" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>
                Shield mod specification
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attribute name="ware" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Shield group context on which shield mod should be installed (macro path as string, object itself if not specified)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="context" type="expression">
                <xs:annotation>
                  <xs:documentation>
                    Shield group context (main ship context if not specified)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="group" type="expression">
                <xs:annotation>
                  <xs:documentation>
                    Shield group on which shield mod should be installed (context's null group if not specified)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:complexType>
          </xs:element>
          <xs:element name="ship" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
                Ship mod specification
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attribute name="ware" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Ship mod ware (from equipmentmods.xml, defines a quality level and primary property of ship mod)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="createship">
    <xs:sequence>
      <xs:element name="select" type="shipdbcategoryselect" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Criteria for selecting a suitable ship from the ShipDB.
            If combined with a static ShipDB reference in the ref attribute, the nodes of the referenced type take precedence.
            &lt;select&gt; cannot be combined with a variable ShipDB reference.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="owner">
          <xs:annotation>
            <xs:documentation>
              Owner faction selection (if missing and a pilot node is present, the pilot's faction will be used)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="selectrange" />
            <xs:attributeGroup ref="range" />
            <xs:attribute name="selection" type="selectionlookup" />
            <xs:attribute name="overridenpc" type="booleanexpression">
              <xs:annotation>
                <xs:documentation>
                  Override the owner faction of the generated NPCs to the owner defined in this node (otherwise the owner may be random based on the character reference)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="pilot">
          <xs:annotation>
            <xs:documentation>
              Pilot
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="createnpc" />
            <xs:attributeGroup ref="createnpc" />
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="loadout">
          <xs:annotation>
            <xs:documentation>
              The loadout that the ship should be given. Can be defined as a reference to a loadout definition or as a level to which the ship should be outfitted.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="level" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>
                    The percentage level to which this ship should be fitted out with randomly generated equipment. Given as a float between 0 and 1.
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attributeGroup ref="random" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="ref" type="expression" use="optional">
              <xs:annotation>
                <xs:documentation>
                  A reference to a loadout definition as defined in loadouts.xml
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="loadout" type="expression" use="optional">
              <xs:annotation>
                <xs:documentation>
                  A reference to a loadout created by a script
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="equipmentmods">
          <xs:complexType>
            <xs:group ref="equipmentmods" />
          </xs:complexType>
        </xs:element>
        <xs:element name="paint">
          <xs:annotation>
            <xs:documentation>
              Paint mod specification
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="ware" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Paint mod ware (from paintmods.xml, defines a quality level and visual properties of a paint mod)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="basket">
          <xs:annotation>
            <xs:documentation>
              Default ware basket to select wares to be added from. This basket definition is required when neither basket nor list are defined in a wares element.
              When used in the JobDB or referenced from it, this basket is optional and overrides the job's basket.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="basket" type="namestring" use="required" />
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="ammo">
          <xs:annotation>
            <xs:documentation>
              Ammo the ship is spawned with
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="macro">
                <xs:complexType>
                  <xs:choice>
                    <xs:element name="fillpercent">
                      <xs:annotation>
                        <xs:documentation>
                          Fill percentage
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="range" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="fillamount">
                      <xs:annotation>
                        <xs:documentation>
                          Fill amount
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="range" />
                      </xs:complexType>
                    </xs:element>
                  </xs:choice>
                  <xs:attribute name="ref" type="macroname" />
                  <xs:attributeGroup ref="random" />
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element name="cargo">
          <xs:annotation>
            <xs:documentation>
              Cargo the ship is spawned with
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="wares">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="fillpercent" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Maximum cargo space fill percent of the ware(s) added from this ware node. If specified together with fillvalue, the lower amount is used.
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="random" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="fillvalue" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Maximum credit value of the ware(s) added from this ware node. If specified together with fillpercent, the lower amount is used.
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="random" />
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                  <xs:attribute name="chance" >
                    <xs:annotation>
                      <xs:documentation>
                        Chance that the node will be processed.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:float">
                        <xs:minInclusive value="0" />
                        <xs:maxInclusive value="100" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="basket" type="namestring" >
                    <xs:annotation>
                      <xs:documentation>
                        Ware basket to select wares to be added from. Takes priority over wares defined in list attribute, and over any default basket.
                        If no default basket is provided via the &lt;basket&gt; element or via the job definition, either basket or list attribute must be supplied.
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="list" type="expression">
                    <xs:annotation>
                      <xs:documentation>
                        List of wares to be chosen from ( script-list syntax using [] !)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="multiple" type="xs:boolean" >
                    <xs:annotation>
                      <xs:documentation>
                        If this is set to true, ALL wares in the basket/list will be added, evenly distributred according to fillpercent/fillvalue, otherwise a single ware will be randomly selected.
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="onjobrespawn" type="xs:boolean" >
                    <xs:annotation>
                      <xs:documentation>
                        By default cargo nodes are skipped for ships that are RE-spawned by the Job Engine. If this is set to true, this node will be processed every time this ship is spawned for a job. Wares nodes are always processed for non-job related ship creation.
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element name="inventory">
          <xs:annotation>
            <xs:documentation>
              Inventory the ship is spawned with
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="wares">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="fillamount" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Fill amount
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="random" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="fillvalue" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Fill value
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="random" />
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                  <xs:attribute name="chance" >
                    <xs:annotation>
                      <xs:documentation>
                        Chance that the node will be processed.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:float">
                        <xs:minInclusive value="0" />
                        <xs:maxInclusive value="100" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="basket" type="namestring" >
                    <xs:annotation>
                      <xs:documentation>
                        Ware basket to select wares to be added from. Takes priority over wares defined in list attribute, and over any default basket.
                        If no default basket is provided via the &lt;basket&gt; element or via the job definition, either basket or list attribute must be supplied.
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="list" type="expression">
                    <xs:annotation>
                      <xs:documentation>
                        List of wares to be chosen from ( script-list syntax using [] !)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="multiple" type="xs:boolean" >
                    <xs:annotation>
                      <xs:documentation>
                        If this is set to true, ALL wares in the basket/list will be added, evenly distributred according to fillpercent/fillvalue, otherwise a single ware will be randomly selected.
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element name="drop">
          <xs:annotation>
            <xs:documentation>
              Drop object
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="ref" type="namestring" use="required">
              <xs:annotation>
                <xs:documentation>
                  DropDB reference
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="units">
          <xs:annotation>
            <xs:documentation>
              Drone Units. Currently interferes with loadouts.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="unit">
                <xs:complexType>
                  <xs:attribute name="category" type="unitcategorylookup" use="required" />
                  <xs:attribute name="mk" type="expression" />
                  <xs:attribute name="tags" type="expression" />
                  <xs:attributeGroup ref="random" />
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element name="people">
          <xs:annotation>
            <xs:documentation>
              People on board the ship (as npc templates)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:group ref="people"/>
            <xs:attribute name="ref" type="expression">
              <xs:annotation>
                <xs:documentation>
                  PeopleDB reference (takes precidence over locally defined people)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="createnpc">
    <xs:sequence>
      <xs:element name="select" type="characterdbcategoryselect" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Criteria for selecting a suitable character from the CharacterDB.
            If combined with a static CharacterDB reference in the ref attribute, the nodes of the referenced type take precedence.
            &lt;select&gt; cannot be combined with a variable CharacterDB reference.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="name" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              NPC name (random name will be chosen if not supplied)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="name" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Name string expression
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="owner" type="selectrange">
          <xs:annotation>
            <xs:documentation>
              Owner faction selection (if the NPC is used as pilot it will override the ship's owner)
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="page">
          <xs:annotation>
            <xs:documentation>
              Voice page ID. Instead of directly supplying a page ID, the tags attribute can be used to specify requirements for the random page selection.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attributeGroup ref="random" />
            <xs:attribute name="tags" type="expression">
              <xs:annotation>
                <xs:documentation>
                  Either a single tag or a list of tags which are required for the voice page.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="skills">
          <xs:annotation>
            <xs:documentation>
              Character skills
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
              <xs:element name="skill">
                <xs:annotation>
                  <xs:documentation>
                    Skill (value between 0 and 15, representing steps of 1/3 of a star, up to 5 stars)
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attributeGroup ref="random" />
                  <xs:attribute name="type" type="skilltypelookup" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Skill type
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="comment" type="comment" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="stock">
          <xs:annotation>
            <xs:documentation>
              Stock definition.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="ref" type="expression">
              <xs:annotation>
                <xs:documentation>
                  The ID of the stock entry that the character should use.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
        <xs:element name="clothing" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Clothing mod specification
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="ware" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Clothing mod ware (from clothingmods.xml, defines a quality level and visual properties of a clothing mod)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="createmodule">
    <xs:sequence>
      <xs:element name="compatibilities" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Production compatibilities
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="limits" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Station module limits (defaults to 20)
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="moduletypelimits" />
              </xs:complexType>
            </xs:element>
            <xs:element name="production" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="chance" use="required"/>
                <xs:attribute name="ref">
                  <xs:annotation>
                    <xs:documentation>
                      Module reference
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="ware" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="select" type="moduledbcategoryselect" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Criteria for selecting a suitable module from the ModuleDB.
            If combined with a static ModuleDB reference in the ref attribute, the nodes of the referenced type take precedence.
            &lt;select&gt; cannot be combined with a variable ModuleDB reference.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:group>

  <xs:group name="createstation">
    <xs:sequence>
      <xs:element name="select" type="stationdbcategoryselect" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Criteria for selecting a suitable station from the StationDB.
            If combined with a static StationDB reference in the ref attribute, the nodes of the referenced type take precedence.
            &lt;select&gt; cannot be combined with a variable StationDB reference.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="name" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Station name (default name will be used if not supplied)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="name" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Name string expression
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="owner" type="selectrange" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Owner faction selection
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="loadout">
          <xs:annotation>
            <xs:documentation>
              The loadout that the ship should be given. Can be defined as a reference to a loadout definition or as a level to which the ship should be outfitted.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="level" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>
                    The percentage level to which this ship should be fitted out with randomly generated equipment. Given as a float between 0 and 1.
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attributeGroup ref="random" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="createobject">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="name" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Station name (default name will be used if not supplied)
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="name" type="expression" use="required">
              <xs:annotation>
                <xs:documentation>
                  Name string expression
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="owner" type="selectrange" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Owner faction selection
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:group name="people">
    <xs:sequence>
      <xs:element name="fillpercent" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Fill percentage
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>
      <xs:element name="person" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Person
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="createnpc" />
          <xs:attributeGroup ref="createnpc" />
          <xs:attribute name="role" type="entityrolelookup" use="required" />
          <xs:attribute name="comment" type="comment" />
          <xs:attribute name="weight" type="expression">
            <xs:annotation>
              <xs:documentation>
                Weight of this role selection
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:group>

  <xs:group name="loadoutelements">
    <xs:annotation>
      <xs:documentation>
        Loadout elements cannot contain script expressions
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="macros" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Macro elements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="engine" type="loadoutmacro" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Engines
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="weapon" type="loadoutmacro" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Weapons
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="shield" type="loadoutmacro" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Shields (ungrouped)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="turret" type="loadoutmacro" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Turrets (ungrouped)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="groups" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Group elements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="shields" type="loadoutgroup" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Shield groups
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="turrets" type="loadoutgroup" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Turret groups
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ammunition" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Ammunition elements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ammunition" type="loadoutammo" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Ammunition
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="unit" type="loadoutammo" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Units (drones)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="software" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Software elements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="software" type="loadoutsoftware" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Software
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="values" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Value elements (currently unused)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="virtualmacros" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Virtual macro elements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="thruster" type="loadoutvirtualmacro" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Thrusters
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:group>

  <xs:group name="voicedata">
    <xs:choice>
      <xs:element name="text">
        <xs:annotation>
          <xs:documentation>
            Add a TextDB line to the texts to be spoken. Cannot be combined with attributes 'page' and 'line' in parent element.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="page" type="pagewithdefault" />
          <xs:attribute name="line" type="line" use="required" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="name">
        <xs:annotation>
          <xs:documentation>
            Adds the name of a value to the texts to be spoken. Requires that a name has been defined in the correct format. Cannot be combined with attributes 'page' and 'line' in parent element.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                A component, object, macro, faction, race, or ware
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
      <xs:element name="description">
        <xs:annotation>
          <xs:documentation>
            Adds the description of a value to the texts to be spoken. Requires that a description has been defined in the correct format. Cannot be combined with attributes 'page' and 'line' in parent element.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                A component, object, macro, faction, race, or ware
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:group>

  <!-- ===== Common conditions ===== -->

  <xs:group name="commonconditions_event">
    <xs:choice>

      <xs:element name="event_repair_requested">
        <xs:annotation>
          <xs:documentation>
            Event for when repair of a component has been requested (object = the object containing the damaged component - e.g. a ship or station, param = the damaged component, param2 = whether to make the damaged component a priority for repair)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_ui_triggered">
        <xs:annotation>
          <xs:documentation>
            Event for when a UI control is triggered (param = screen ID, param2 = control ID, param3 = screen parameters)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="screen" type="expression">
            <xs:annotation>
              <xs:documentation>
                Screen ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="control" type="expression">
            <xs:annotation>
              <xs:documentation>
                Control ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_unit_destroyed">
        <xs:annotation>
          <xs:documentation>
            Event for when a unit has been destroyed (object = the object owning the unit, param = the unit's category, param2 = the unit's mk)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="category" type="unitcategorylookup">
            <xs:annotation>
              <xs:documentation>
                The destroyed unit's category
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mk" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_unit_started_building">
        <xs:annotation>
          <xs:documentation>
            Event for when a unit has started building/welding (object = the object on which the unit operates, param = the unit's mk)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="mk" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_unit_stopped_building">
        <xs:annotation>
          <xs:documentation>
            Event for when a unit has stopped building/welding (object = the object on which the unit operates, param = the unit's mk)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="mk" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_unit_started_repairing">
        <xs:annotation>
          <xs:documentation>
            Event for when a unit has started repairing/welding (object = the object on which the unit operates, param = the unit's mk)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="mk" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_unit_stopped_repairing">
        <xs:annotation>
          <xs:documentation>
            Event for when a unit has stopped repairing/welding (object = the object on which the unit operates, param = the unit's mk)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="mk" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_operation_created">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding operation has been created (param = boarding operation id)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_operation_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding operation has been started (param = boarding operation id)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="operation" type="expression">
            <xs:annotation>
              <xs:documentation>
                Operation ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_operation_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding operation has been removed (param = boarding operation id)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="operation" type="expression">
            <xs:annotation>
              <xs:documentation>
                Operation ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_phase_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding operation has had its phase changed (param = boarding operation id, param2 = new boardingphase, param3 = old boardingphase)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="operation" type="expression">
            <xs:annotation>
              <xs:documentation>
                Operation ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="phase" type="boardingphaselookup" />
          <xs:attribute name="previous" type="boardingphaselookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_support_failed">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding support mission was NOT successful (object = boarding commander)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_support_succeeded">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding support mission was successful (object = boarding commander)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boost_charging_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when an object aborts charging boost (object = boosting object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boost_charging_started">
        <xs:annotation>
          <xs:documentation>
            Event for when an object starts charging boost (object = boosting object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boost_started">
        <xs:annotation>
          <xs:documentation>
            Event for when an object starts boosting (object = boosting object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boost_stopped">
        <xs:annotation>
          <xs:documentation>
            Event for when an object stops boosting (object = boosting object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_build_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a build related to the object begins (object = buildmodule/buildingobject/buildingobjectcommander, param = buildmodule, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="buildmodule" type="buildmodule" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_build_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a build related to the object finishes (object = buildmodule/buildingobject/buildingobjectcommander, param = buildmodule, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="buildmodule" type="buildmodule" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_build_finished_components">
        <xs:annotation>
          <xs:documentation>
            Event for when a build related to the object partially finishes construction. List of completed components is provided. (object = buildmodule/buildingobject/buildingobjectcommander, param = buildmodule, param2 = list, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="buildmodule" type="buildmodule" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_build_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a build related to the object is cancelled (object = buildmodule/buildingobject/buildingobjectcommander, param = buildmodule, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="buildmodule" type="buildmodule" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_build_added">
        <xs:annotation>
          <xs:documentation>
            Event for when a build task is added (object = building object, param = build task)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_built_ship">
        <xs:annotation>
          <xs:documentation>
            Event for when a ship is constructed to operational state (object = buildingobject, param = ship, param2 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="ship" type="ship" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_built_station">
        <xs:annotation>
          <xs:documentation>
            Event for when a station is constructed to operational state (object = buildingobject, param = station, param2 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="ship" type="ship" />
          <xs:attribute name="build" type="build"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_control_entity_added">
        <xs:annotation>
          <xs:documentation>
            Event for when a control entity is set on a controllable (object = controllable or entity, param = entity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="entity" type="entity"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_control_entity_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when a control entity is removed from a controllable (object = controllable or entity, param = entity, param2 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="entity" type="entity"/>
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_conversation_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a conversation is finished (object = actor (entity or list containing context and template), param = outcome, param2 = outcome parameter)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="outcome" type="expression">
            <xs:annotation>
              <xs:documentation>
                Conversation outcome (the name of the last section chosen by the player, or the conversation name in case of a non-interactive conversation)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="outcomeparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                The outcome parameter (the last choice parameter as provided by &lt;add_player_choice&gt;, &lt;add_player_choice_sub&gt;, or a menu selection),
                or the conversation parameter in case of a non-interactive conversation (as provided by &lt;start_conversation&gt;)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_conversation_next_section">
        <xs:annotation>
          <xs:documentation>
            Event for when the next section in a conversation is triggered (object = actor (entity or list containing context and template), param = section name, param2 = choice parameter, param3 = minigame score or null)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="section" type="section" />
          <xs:attribute name="sectionprefix" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Prefix of conversation section name that has to be matched
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="choiceparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                The parameter associated with the player choice, as provided by &lt;add_player_choice&gt;, &lt;add_player_choice_sub&gt;, or a menu selection
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_conversation_returned_to_section">
        <xs:annotation>
          <xs:documentation>
            Event for when a sub-conversation returns to the previous section (object = actor (entity or list containing context and template), param = section name, param2 = base parameter, param3 = return parameter)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="section" type="section" />
          <xs:attribute name="sectionprefix" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Prefix of conversation section name that has to be matched
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="baseparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                The value provided by this previous section when it started the sub-conversation (baseparam of &lt;add_player_choice_sub&gt;, &lt;add_player_choice_subconv&gt;, or of the menu selection).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="returnparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                The value provided by the player choice that returned to this previous section (returnparam of &lt;add_player_choice_return&gt; or of the menu selection).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_conversation_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a conversation is started (object = actor (entity or list containing context and template), param = conversation name, param2 = conversation parameter)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="conversation" type="conversation" />
          <xs:attribute name="convprefix" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Prefix of conversation name that has to be matched
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="convparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                The parameter associated with the conversation, as provided by &lt;start_conversation&gt;
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_warning">
        <xs:annotation>
          <xs:documentation>
            Event for when the player shuold be warned, e.g. on station explosion (param = component, param2 = text line)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="component" type="expression">
            <xs:annotation>
              <xs:documentation>
                Component that is the reason for the warning
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="line" type="expression">
            <xs:annotation>
              <xs:documentation>
                Text line
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cutscene_camera_created">
        <xs:annotation>
          <xs:documentation>
            Event for when the camera of a cutscene is created (param = cutscene key string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="key" type="cutscenekey" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cutscene_signal">
        <xs:annotation>
          <xs:documentation>
            Event for when a cutscene sends a signal (param = cutscene key string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Signal ID name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cutscene_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a cutscene starts (param = cutscene key string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="key" type="cutscenekey" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cutscene_stopped">
        <xs:annotation>
          <xs:documentation>
            Event for when a cutscene ends (param = cutscene key string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="key" type="cutscenekey" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_long_range_scan_ping">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is pinged by a long range scan. (object = scanned object, param = true iff the result was 'identified')
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="identified" type="object">
            <xs:annotation>
              <xs:documentation>
                Was the result 'identified'?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_long_range_scan_sent">
        <xs:annotation>
          <xs:documentation>
            Event for when an object sends out a long range scan wave. (object = scanning object or player)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_character_animation_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a character starts an animation. (object = player/npc, param = animation ID)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="id" type="expression">
            <xs:annotation>
              <xs:documentation>
                Animation ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_character_animation_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a character finishes an animation. (object = player/npc, param = animation ID)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="id" type="expression">
            <xs:annotation>
              <xs:documentation>
                Animation ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_npc_walk_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a npc finishes their walk. (object = npc)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_npc_slots_validated">
        <xs:annotation>
          <xs:documentation>
            Event for when npc slots are validated in an interior which could have blocked slots (object = interior or object of interior, param = interior, param2 = was this a recalculation of an already validated interior?)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="interior" type="object" />
          <xs:attribute name="recalculation" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Was this validation a recalculation of a previously validated interior?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_lock_acquired">
        <xs:annotation>
          <xs:documentation>
            Event for when a target lock is acquired (requires attribute attacker and/or target) (object = attacker if supplied, otherwise target object, param = the other object, param2 = locking weapon, param3 = target component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="lockattackerrequired" />
          <xs:attribute name="target" type="locktargetrequired" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="component" type="locktargetcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_lock_initiated">
        <xs:annotation>
          <xs:documentation>
            Event for when a target lock attempt is initiated (requires attribute attacker and/or target) (object = attacker if supplied, otherwise target object, param = the other object, param2 = locking weapon, param3 = target component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="lockattackerrequired" />
          <xs:attribute name="target" type="locktargetrequired" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="component" type="locktargetcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_lock_lost">
        <xs:annotation>
          <xs:documentation>
            Event for when a target lock is lost (requires attribute attacker and/or target) (object = attacker if supplied, otherwise target object, param = the other object, param2 = locking weapon, param3 = target component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="lockattackerrequired" />
          <xs:attribute name="target" type="locktargetrequired" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="component" type="locktargetcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_masstraffic_ship_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when a mass traffic ship is removed from a zone. If zone is provided then it is the event object (object = zone, param = mass traffic ship), otherwise object or group must be provided (object = mass traffic ship)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="zone" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_illegal_activity_detected">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has been caught doing an illegal activity (see &lt;report_illegal_activity&gt;), like hacking or certain types of scanning (param = caught object, param2 = victim of the activity [optional])
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                The object doing the illegal activity (attribute must be present if victim not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="victim" type="expression">
            <xs:annotation>
              <xs:documentation>
                The victim of the activity (attribute must be present if object not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_approaching_waypoint">
        <xs:annotation>
          <xs:documentation>
            Event for when a target waypoint is approached (but not necessarily yet reached) by a flying object (object = approaching object, param = remaining time)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_arrived_at_waypoint">
        <xs:annotation>
          <xs:documentation>
            Event for when a flying object arrives at a target waypoint (object = arriving object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_gravidar_has_scanned">
        <xs:annotation>
          <xs:documentation>
            Event fired when the gravidar of an object has performed a scan (object = object of gravidar)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_attacked">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being attacked (object = attacked object, param = attacker, param2 = kill method, param3 = attacked component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="attacker" type="attacker" />
          <xs:attribute name="method" type="killmethodlookup" />
          <xs:attribute name="component" type="attackedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_attacked_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the specified object attacks an object (object = attacker, param = attacked object, param2 = kill method, param3 = attacked component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="attacked" type="attackedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
          <xs:attribute name="component" type="attackedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_shield_damaged">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object's shield being damaged (object = event source, param = damaged component, param2 = new shield value, param3 = damage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="damaged" type="damagedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_hull_damaged">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object's hull being damaged - includes hulls of children (object = event source, param = damaged component, param2 = new hull value, param3 = damage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="damaged" type="damagedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_hull_repaired">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object's hull being repaired - includes hulls of children (object = event source, param = repaired component, param2 = new hull value, param3 = repaired value)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="repaired" type="repairedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_hull_above_function_threshold">
        <xs:annotation>
          <xs:documentation>
            Event for the specified components's hull climbing above the function threshold, rendering the object functional again - includes hulls of children (object = parent object, param = affected component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="repaired" type="repairedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_hull_below_function_threshold">
        <xs:annotation>
          <xs:documentation>
            Event for the specified components's hull falling below the function threshold, rendering the object non-functional - includes hulls of children (object = parent object, param = affected component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="damaged" type="damagedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_abandoned">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being abandoned by its NPCs (object = abandoned object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_attention">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing attention level (object = attention changing object, param = new attention level, param2 = previous attention level)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="attention" type="attentionexprlookup">
            <xs:annotation>
              <xs:documentation>
                New attention level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="previous" type="attentionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Previous attention level
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_cluster">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing cluster (object = cluster changing object, param = new cluster, param2 = previous cluster)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="cluster" type="cluster" />
          <xs:attribute name="previous" type="cluster" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_object">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing object (object = object changing object, param = new object, param2 = previous object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="newobject" type="object" />
          <xs:attribute name="previous" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_owner">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing owner (object = owner changing object, param = new owner faction, param2 = previous owner faction, param3 = true previous owner faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="owner" type="faction" />
          <xs:attribute name="previous" type="faction" />
          <xs:attribute name="trueprevious" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_sector">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing sector (object = sector changing object, param = new sector, param2 = previous sector)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="sector" type="sector" />
          <xs:attribute name="previous" type="sector" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_room">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing room (object = room changing object, param = new room, param2 = previous room)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="room" type="room" />
          <xs:attribute name="previous" type="room" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_zone">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing zone (object = zone changing object, param = new zone, param2 = previous zone)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="zone" type="zone" />
          <xs:attribute name="previous" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_state">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing state (object = state changing object, param = new state, param2 = previous state)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="state" type="componentstateexprlookup" />
          <xs:attribute name="previous" type="componentstateexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_contained_object_changed_owner">
        <xs:annotation>
          <xs:documentation>
            Event for any object within the specified space changing owner (object = space or container which contains the object, param = object changing ownership, param2 = new owner faction, param3 = previous owner faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which contains the object (i.e. zone, sector or cluster), or direct container context (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
          <xs:attribute name="owner" type="faction" />
          <xs:attribute name="previous" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_contained_entity_changed_owner">
        <xs:annotation>
          <xs:documentation>
            Event for any entity within the specified space changing owner (object = space or container which contains the entity, param = entity changing ownership, param2 = new owner faction, param3 = previous owner faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which is contains the entity (i.e. zone, sector or cluster), or direct container context (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
          <xs:attribute name="owner" type="faction" />
          <xs:attribute name="previous" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_claimed">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is claimed or a NPC claims an object (requires attribute claimed and/or pilot) (do not use with player.entity) (object = claimed if supplied, otherwise pilot, param = the other object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="claimed" type="claimedrequired" />
          <xs:attribute name="pilot" type="claimerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_collected_ammo">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object collecting ammo (object = collecting object, param = weapon macro, param2 = amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ammo amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_collected_powerup">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object collecting a powerup (object = collecting object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_collected_resource">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object collecting a resource (object = collecting object, param = ware, param2 = amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="ware" type="ware" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ware amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_collected_ware">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object collecting a ware drop (object = collecting object, param = ware, param2 = amount, param3 = collected object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="ware" type="ware" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ware amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="collected" type="object" >
            <xs:annotation>
              <xs:documentation>
                The collected object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_collided">
        <xs:annotation>
          <xs:documentation>
            Event for when the specified object collides (object = colliding object, param = other colliding object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="otherobject" type="object" >
            <xs:annotation>
              <xs:documentation>
                The other object involved in the collision
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_construction_sequence_created">
        <xs:annotation>
          <xs:documentation>
            Event for when the construction sequence for a station has been created, e.g. requested via &lt;create_construction_sequence&gt; (object = station, param = constructionsequence if successful, param2 = true if successful)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="success" type="booleanexpression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_triggered">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is triggered (object = trigger object, param = triggerer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="triggerer" type="object" >
            <xs:annotation>
              <xs:documentation>
                The triggering object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_commander_set">
        <xs:annotation>
          <xs:documentation>
            Event for when a subordinate receives a new commander (object = subordinate, param = new commander, param2 = previous commander, param3 = new assignment)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="commander" type="object" />
          <xs:attribute name="previous" type="object">
            <xs:annotation>
              <xs:documentation>
                Previous commander (can be null)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="assignment" type="assignmentexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_changed_assignment">
        <xs:annotation>
          <xs:documentation>
            Event for when a subordinate changes assignments without changing commander (object = source player/entity/subordinate/commander, param = subordinate, param2 = previous assignment, param3 = new assignment)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="subordinate" type="object" />
          <xs:attribute name="previous" type="assignmentexprlookup">
            <xs:annotation>
              <xs:documentation>
                Previous assignment
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="assignment" type="assignmentexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_activated_weapon">
        <xs:annotation>
          <xs:documentation>
            Event for when a Controllable object activates a weapon (object = Controllable, param = Weapon, param2 = ammo type (null if unlimited), param3 = ammo amount (not set if unlimited))
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="ammo" type="macro">
            <xs:annotation>
              <xs:documentation>
                Ammo type
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ammo amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_deactivated_weapon">
        <xs:annotation>
          <xs:documentation>
            Event for when a Controllable object activates a weapon (object = Controllable, param = Weapon)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="weapon" type="weapon" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_activated_weapongroup">
        <xs:annotation>
          <xs:documentation>
            Event for when a Controllable object activates a weapon group (object = Controllable, param = weapongroup index, param2 = true for primary, false for secondary group)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="weapongroup" type="expression" />
          <xs:attribute name="primary" type="booleanexpression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_deactivated_weapongroup">
        <xs:annotation>
          <xs:documentation>
            Event for when a Controllable object deactivates a weapon group (object = Controllable, param = weapongroup index, param2 = true for primary, false for secondary group)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="weapongroup" type="expression" />
          <xs:attribute name="primary" type="booleanexpression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_destroyed">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being destroyed (object = destroyed object, param = killer, param2 = kill method, param3 = was parent killed)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="killer" type="killer" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docked">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object docking (object = docking object, param = dock object, param2 = zone)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="dock" type="container" />
          <xs:attribute name="zone" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docking_started">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object starting to dock (object = docking object, param = dock, param2 = zone)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="dock" type="container" />
          <xs:attribute name="zone" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docked_at">
        <xs:annotation>
          <xs:documentation>
            Event for an object docking at the specified container (object = container object, param = docking object, param2 = new context, param3 = old context)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="container" type="expression">
            <xs:annotation>
              <xs:documentation>
                Container object (station or ship, required if group attribute not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_started_to_dock_at">
        <xs:annotation>
          <xs:documentation>
            Event for an object starting to dock at the specified container (object = container object, param = docking object, param2 = new context, param3 = old context)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="container" type="expression">
            <xs:annotation>
              <xs:documentation>
                Container object (station or ship, required if group attribute not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dock_assigned">
        <xs:annotation>
          <xs:documentation>
            If object is a ship: Event for the specified object getting a free docking bay assigned for docking (object = docking ship)
            If object is a docking bay: Event for the specified object getting a ship assigned to it (object = assigned docking bay)
            If object is the player entity: Event for the player's ship context getting a free docking bay assigned (object = player)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dock_assigned_at">
        <xs:annotation>
          <xs:documentation>
            Event for a ship being assigned to a dock of the specified container (object = container object, param = dock, param2 = assigned ship)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dock_unassigned">
        <xs:annotation>
          <xs:documentation>
            If object is a ship: Event for the specified object getting the dock unassigned for a docking bay (object = ship getting dock unassigned)
            If object is a docking bay: Event for the specified object getting a ship unassigned from it (object = unassigned docking bay)
            If object is the player entity: Event for the player's ship context getting the dock unassigned (object = player)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dock_unassigned_from">
        <xs:annotation>
          <xs:documentation>
            Event for an unassigned dock of an object from the specified container (object = container object, param = dock unassigned object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="container" type="expression">
            <xs:annotation>
              <xs:documentation>
                Container object (station or ship, required if group attribute not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docking_denied">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being denied docking (object = docking object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docking_impossible">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being incapable of docking (object = docking object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dock_too_far">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being too far from the docking target (object = docking object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docking_queued">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being put into the queue for a free docking bay (object = docking object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_docking_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object having aborted a docking process (object = docking object, param = previously assigned docking bay)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_undocking_cleared">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being cleared to undock (object = docked object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_dropped_objects">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object dropping objects (object = dropping object, param = list of dropped objects)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_drops_found">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object finding drops on its Gravidar scanner (object = scanning object, param = list of drops found)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_enemy_found">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object finding an enemy on its Gravidar scanner (object = scanning object, param = enemy)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="enemy" type="container" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_entered_anomaly">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object entering an anomaly (object = entering object, param = entry anomaly, param2 = exit anomaly)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="entry" type="object" />
          <xs:attribute name="exit" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_venture_mission_completed">
        <xs:annotation>
          <xs:documentation>
            Event for a venture mission being completed (param = transaction id, param2 = venture mission name, param3 = number of returned ships)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="transactionid" type="expression" />
          <xs:attribute name="missionrawname" type="expression" />
          <xs:attribute name="numships" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_entered_gate">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object entering a gate (object = entering object, param = entry gate, param2 = exit gate)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="entry" type="object" />
          <xs:attribute name="exit" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_entered_live_view">
        <xs:annotation>
          <xs:documentation>
            Event for when the object becomes visible on the gravidar of any player-owned object (object = entering object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_left_live_view">
        <xs:annotation>
          <xs:documentation>
            Event for when the object is no longer visible on the gravidar of any player-owned object (object = leaving object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_alert_level_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when the alert level of an object changes (object = object changing the alert level, param = new alert level string, param2 = old alert level string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="level">
            <xs:annotation>
              <xs:documentation>
                Alert level string
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:union memberTypes="expression">
                <xs:simpleType>
                  <xs:restriction base="expression">
                    <xs:enumeration value="'green'" />
                    <xs:enumeration value="'yellow'" />
                    <xs:enumeration value="'red'" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="previous">
            <xs:annotation>
              <xs:documentation>
                Previous alert level string
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:union memberTypes="expression">
                <xs:simpleType>
                  <xs:restriction base="expression">
                    <xs:enumeration value="'green'" />
                    <xs:enumeration value="'yellow'" />
                    <xs:enumeration value="'red'" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_traffic_level_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when the traffic level of an object changes (object = object changing the traffic level, param = new traffic level string, param2 = old traffic level string)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="level">
            <xs:annotation>
              <xs:documentation>
                Traffic level string
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:union memberTypes="expression">
                <xs:simpleType>
                  <xs:restriction base="expression">
                    <xs:enumeration value="'normal'" />
                    <xs:enumeration value="'heavy'" />
                    <xs:enumeration value="'gridlock'" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="previous">
            <xs:annotation>
              <xs:documentation>
                Previous traffic level string
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:union memberTypes="expression">
                <xs:simpleType>
                  <xs:restriction base="expression">
                    <xs:enumeration value="'normal'" />
                    <xs:enumeration value="'heavy'" />
                    <xs:enumeration value="'gridlock'" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_incoming_missile">
        <xs:annotation>
          <xs:documentation>
            Event for when a missile is launched at the specified object (object = target object, param = target component, param2 = missile, param3 = missile source)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="target" type="targetcomponent" />
          <xs:attribute name="source" type="source" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_killed_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the specified object kills an object/component (object = killer, param = killed object/component, param2 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="killed" type="killedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_missile">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object launching a missile (object = missile launching object, param = target component, param2 = missile)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="target" type="targetcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_money_updated">
        <xs:annotation>
          <xs:documentation>
            Event for when the entities money gets updated (object = entity of the account, param = oldamount, param2 = newamount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="oldamount" type="expression" />
          <xs:attribute name="newamount" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_order_ready">
        <xs:annotation>
          <xs:documentation>
            Event for when an AI order in an object's order queue gets enabled (entering the ready state), when the default order gets enabled,
            or when there is a new current order that should be started, even if already enabled before (object = the object receiving the order, param = order)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="order" type="order" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_order_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when the a running AI order is cancelled (object = the order's owner object, param = order, param2 = true iff the order is not in the critical state and is cancelled immediately).
            NOTE: If param2 is true then the order (event.param) was already cancelled and was either reset or does not exist any more.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="order" type="order" />
          <xs:attribute name="immediate" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the order cancelled immediately? This is true except for orders in the critical state.
                Orders in the critical state can handle cancel requests by listening to this event with immediate=&quot;false&quot;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_order_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when the running AI order is finished (object = the order's owner object, param = order).
            Note that it is possible that the order no longer exists.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="order" type="order" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_order_param_edited">
        <xs:annotation>
          <xs:documentation>
            Event for when a parameter of a running AI order in the critical state is edited (object = the order's owner object, param = order, param2 = order param name, param3 = order param value)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="order" type="order" />
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Order param name string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="value" type="expression">
            <xs:annotation>
              <xs:documentation>
                New order param value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_order_syncpoint_released">
        <xs:annotation>
          <xs:documentation>
            Event for when the sync point of an infinite AI order in an object's order queue gets released, indicating that the order should finish (object = the order's owner object, param = order)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="order" type="order" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_picked_up">
        <xs:annotation>
          <xs:documentation>
            Event for when the specified object is picked up by another object (object = pickup, param = collector)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="collector" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_picked_up_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the specified object picks up another object (object = collector, param = pickup)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="pickup" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_signalled">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object being signalled (object = signalled object, param = custom, usually to specify type of signal, param2 = custom, param3 = custom)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="param" type="expression" />
          <xs:attribute name="param2" type="expression" />
          <xs:attribute name="param3" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_subordinate_added">
        <xs:annotation>
          <xs:documentation>
            Event for when a new subordinate is added to a commander (object = new commander, param = subordinate, param2 = new assignment)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="subordinate" type="object" />
          <xs:attribute name="assignment" type="assignmentexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_subordinate_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when a subordinate is removed from a commander (object = old commander, param = subordinate, param2 = old commander)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="subordinate" type="object" />
          <xs:attribute name="previous" type="object">
            <xs:annotation>
              <xs:documentation>
                Previous commander
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_target_invalid">
        <xs:annotation>
          <xs:documentation>
            Event for when an object's target is invalid, e.g. went through a jump gate, does not exist any more etc. (object = object with an invalid target, param = invalid target, param2 = true iff the target is actually not reachable)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="target" type="expression">
            <xs:annotation>
              <xs:documentation>
                Invalid target
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unreachable" type="expression">
            <xs:annotation>
              <xs:documentation>
                Is the target unreachable?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_undocked">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object undocking (object = undocking object, param = dock, param2 = zone)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="dock" type="container" />
          <xs:attribute name="zone" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_undocking_started">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object starting to undock (object = undocking object, param = dock, param2 = zone)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="dock" type="container" />
          <xs:attribute name="zone" type="zone" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_undocked_from">
        <xs:annotation>
          <xs:documentation>
            Event for an object undocking from the specified container (object = container object, param = undocking object, param2 = new context, param3 = old context)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="container" type="expression">
            <xs:annotation>
              <xs:documentation>
                Container object (station or ship, required if group attribute not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_started_to_undock_from">
        <xs:annotation>
          <xs:documentation>
            Event for an object starting to undock from the specified container (object = container object, param = undocking object, param2 = new context, param3 = old context)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="container" type="expression">
            <xs:annotation>
              <xs:documentation>
                Container object (station or ship, required if group attribute not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_god_created_station">
        <xs:annotation>
          <xs:documentation>
            Event for god creating a station (object = containing space, param = station)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which contains the created station
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_god_created_factory">
        <xs:annotation>
          <xs:documentation>
            Event for god creating a base factory with the modules to be constructed (object = containing space, param = station, param2 = list of module macros)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which contains the created factory
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_god_created_object">
        <xs:annotation>
          <xs:documentation>
            Event for god creating an object (object = containing space, param = object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which contains the created object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_weaponmode_changed">
        <xs:annotation>
          <xs:documentation>
            Event for the specified object changing a weapon mode (object = object changing the weapon mode, param = weapon, param2 = new weapon mode)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="weapon" type="weapon">
            <xs:annotation>
              <xs:documentation>
                Weapon for which the mode will be changed (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="weaponmode" type="extendedweaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                New weapon mode in which the weapon will be changed (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_entered">
        <xs:annotation>
          <xs:documentation>
            Event on an object or a space, e.g. zone, for when any object enters it or is created in it (object = entered space/container, param = entering object, param2 = new context of entering object, param3 = old context of entering object).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which is entered (i.e. zone, sector or cluster), or direct container context which is entered (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_left">
        <xs:annotation>
          <xs:documentation>
            Event on an object or a space, e.g. zone, for when any object leaves it or is removed (object = left space/container, param = leaving object, param2 = new context of leaving object, param3 = old context of leaving object).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which is left (i.e. zone, sector or cluster), or direct container context which is left (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_entity_entered">
        <xs:annotation>
          <xs:documentation>
            Event on an object or a space, e.g. zone, for when any entity enters it or is created in it (object = entered space/room/container, param = entering entity, param2 = new context of entering entity, param3 = old context of entering entity).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space or room which is entered (i.e. room, zone, sector or cluster), or direct container context which is entered (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_entity_left">
        <xs:annotation>
          <xs:documentation>
            Event on an object or a space, e.g. zone, for when any entity leaves it or is removed (object = left space/room/container, param = leaving entity, param2 = new context of leaving entity, param3 = old context of leaving entity).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space or room which is left (i.e. room, zone, sector or cluster), or direct container context which is left (ship or station)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_attacked_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the player attacks an object from their currently controlled object (param = attacked object, param2 = kill method, param3 = attacked component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacked" type="attackedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
          <xs:attribute name="component" type="attackedcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_boost_charging_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when the player aborts charging boost
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_boost_charging_started">
        <xs:annotation>
          <xs:documentation>
            Event for when the player starts charging boost
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_boost_started">
        <xs:annotation>
          <xs:documentation>
            Event for when the player starts boosting
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_boost_stopped">
        <xs:annotation>
          <xs:documentation>
            Event for when the player stops boosting
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_build_plot_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned station's build plot changes (param = station, param2 = old build plot max, param3 = old build plot center)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="station" type="expression">
            <xs:annotation>
              <xs:documentation>
                Station for which build plot changed
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_paid_build_plot_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned station's paid build plot size changes (param = station, param2 = old paid build plot size)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="station" type="expression">
            <xs:annotation>
              <xs:documentation>
                Station for which build plot changed
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_build_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned build starts (param = buildprocessor, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="buildmodule" type="buildmodule" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_build_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned build finishes (param = buildprocessor, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="buildmodule" type="buildmodule" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_build_finished_components">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned build partially finishes. List of completed components is provided. (param = buildprocessor, param2 = list, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="buildmodule" type="buildmodule" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_build_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned build is cancelled (param = buildprocessor, param2 = constructionsequence, param3 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="buildmodule" type="buildmodule" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_built_ship">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned ship is constructed to operational state (param = ship, param2 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_built_station">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned station is constructed to operational state (param = station, param2 = buildtask)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_production_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned productionmodule has started production of a ware (param = productionmodule, param2 = product ware, param3 = whether this is a research project) (see also event_player_production_finished)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="productionmodule" type="productionmodule" use="optional" />
          <xs:attribute name="ware" type="ware" use="optional" />
          <xs:attribute name="research" type="booleanexpression" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_production_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned productionmodule has finished production of a ware (param = productionmodule, param2 = product ware, param3 = whether this was a research project) (see also event_player_production_started)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="productionmodule" type="productionmodule" use="optional" />
          <xs:attribute name="ware" type="ware" use="optional" />
          <xs:attribute name="research" type="booleanexpression" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_changed_activity">
        <xs:annotation>
          <xs:documentation>
            Event for when the player changes activity (param = new activity, param2 = old activity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="activity" type="activityexprlookup" />
          <xs:attribute name="oldactivity" type="activityexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_changed_target">
        <xs:annotation>
          <xs:documentation>
            Event for when the player changes target (param = new target)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="target" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_interaction">
        <xs:annotation>
          <xs:documentation>
            Event for when a player responds to an interactive notification (param = interaction param, param2 = secondary interaction param)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                Interaction parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param2" type="expression">
            <xs:annotation>
              <xs:documentation>
                Secondary interaction parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_teleport_successful">
        <xs:annotation>
          <xs:documentation>
            Event for when the player successfully teleports. (param = new room, param2 = old room, param3 = is shortcut instead of real teleport)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="room" type="room" />
          <xs:attribute name="previous" type="room" />
          <xs:attribute name="shortcut" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this a shortcut instead of a real teleport?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_teleport_failed">
        <xs:annotation>
          <xs:documentation>
            Event for when the player failed to teleport. (param = destination room, param2 = is shortcut instead of real teleport)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="destination" type="room" />
          <xs:attribute name="shortcut" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this a shortcut instead of a real teleport?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_attacked">
        <xs:annotation>
          <xs:documentation>
            Event for when a player owned object is attacked (object = attacked object, param = attacker, param2 = kill method, param3 = attacked component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="attacker" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_attacked_object">
        <xs:annotation>
          <xs:documentation>
            Event for when a player owned object, including the player, attacks another object (param = attacker, param2 = attacked object, param3 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="attacker" />
          <xs:attribute name="attacked" type="attackedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_claimed_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the player faction claims an object (param = claimed object, param2 = pilot)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="claimed" type="object" />
          <xs:attribute name="pilot" type="entity" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_collected_ammo">
        <xs:annotation>
          <xs:documentation>
            Event for when the player collects ammo (param = weapon macro, param2 = amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ammo amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_crafted_ammo">
        <xs:annotation>
          <xs:documentation>
            Event for when the player crafts ammo from inventory wares (param = weapon macro, param2 = amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ammo amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_collected_powerup">
        <xs:annotation>
          <xs:documentation>
            Event for when the player collects a powerup
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_collected_ware">
        <xs:annotation>
          <xs:documentation>
            Event for when the player collects a ware drop (param = ware, param2 = amount, param3 = collected object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="ware" type="ware" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ware amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="collected" type="object" >
            <xs:annotation>
              <xs:documentation>
                The collected object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_commission_added" type="event_playerpricemodifier">
        <xs:annotation>
          <xs:documentation>
            Event for when a commission for the player is added (object = source object or source faction, param = display name, param2 = commission amount, param3 = end time)
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <xs:element name="event_player_discount_added" type="event_playerpricemodifier">
        <xs:annotation>
          <xs:documentation>
            Event for when a discount for the player is added (object = source object or source faction, param = display name, param2 = discount amount, param3 = end time)
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <xs:element name="event_player_activated_weapon">
        <xs:annotation>
          <xs:documentation>
            Event for when the player ship activates a weapon (param = Weapon, param2 = ammo type (null if unlimited), param3 = ammo amount (not set if unlimited))
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="ammo" type="macro">
            <xs:annotation>
              <xs:documentation>
                Ammo type
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ammo amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_deactivated_weapon">
        <xs:annotation>
          <xs:documentation>
            Event for when the player ship deactivates a weapon (param = Weapon)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="weapon" type="weapon" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_activated_weapongroup">
        <xs:annotation>
          <xs:documentation>
            Event for when the player ship activates a weapon group (param = weapongroup index, param2 = true for primary, false for secondary group)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="weapongroup" type="expression" />
          <xs:attribute name="primary" type="booleanexpression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_deactivated_weapongroup">
        <xs:annotation>
          <xs:documentation>
            Event for when the player ship deactivates a weapon group (param = weapongroup index, param2 = true for primary, false for secondary group)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="weapongroup" type="expression" />
          <xs:attribute name="primary" type="booleanexpression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_created">
        <xs:annotation>
          <xs:documentation>
            Event for when the player is created (no parameters)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_discovered_object">
        <xs:annotation>
          <xs:documentation>
            Event for when an object (station module, station, ship, ...) is discovered or scanned by the player and added to the scan memory (param = object, param2 = scan level)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="level" type="expression">
            <xs:annotation>
              <xs:documentation>
                Scan level (0 if object was discovered, positive if object was actively scanned)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_detected_object">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is detected by the player and added to the long range scan memory (param = object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="object" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_discovered_mission_offer">
        <xs:annotation>
          <xs:documentation>
            Event for when a mission offer is discovered by the player and added to the mission offer memory (param = mission offer cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="expression">
            <xs:annotation>
              <xs:documentation>
                Mission offer MD cue
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_hacked_object">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is hacked by the player (param = hacked, param2 = hacker, param3 = control panel type)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_incoming_missile">
        <xs:annotation>
          <xs:documentation>
            Event for when a missile is launched at the player (param = target component, param2 = missile, param3 = missile source)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="target" type="targetcomponent" />
          <xs:attribute name="source" type="source" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_killed_object">
        <xs:annotation>
          <xs:documentation>
            Event for when the player kills an object from their currently controlled object (param = killed object, param2 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="killed" type="killedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_launched_missile">
        <xs:annotation>
          <xs:documentation>
            Event for when the player launches a missile (param = target component, param2 = missile)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="target" type="targetcomponent" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_licence_added">
        <xs:annotation>
          <xs:documentation>
            Event for when the player is granted a licence for another faction (param = licenceref, use .type or .faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="licence" type="licencelookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_licence_lost">
        <xs:annotation>
          <xs:documentation>
            Event for when the player has lost a licence for another faction (param = licenceref, use .type or .faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="licence" type="licencelookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_money_updated">
        <xs:annotation>
          <xs:documentation>
            Event for when the player money gets updated (param = oldamount, param2 = newamount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="oldamount" type="expression" />
          <xs:attribute name="newamount" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_collected_resource">
        <xs:annotation>
          <xs:documentation>
            Event for when a player owned object has collected a resource (object = collecting object, param = ware, param2 = amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="ware" type="ware" />
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ware amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_destroyed">
        <xs:annotation>
          <xs:documentation>
            Event for when a player owned object was killed (param = killed object, param2 = killer object, param3 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="killed" type="killedobject" />
          <xs:attribute name="killer" type="killer" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_owned_killed_object">
        <xs:annotation>
          <xs:documentation>
            Event for when a player owned object, including player, kills an object (param = killer object, param2 = killed object, param3 = kill method)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="killer" type="killer" />
          <xs:attribute name="killed" type="killedobject" />
          <xs:attribute name="method" type="killmethodlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_opened_crate">
        <xs:annotation>
          <xs:documentation>
            Event for when the player opens a crate and claims all its content (param = crate)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="crate" type="crate" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_out_of_ammo">
        <xs:annotation>
          <xs:documentation>
            Event for when the player's current weapon runs out of ammo (param = weapon macro, param2 = ranout of ammo due to the shot)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="ranout" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                When true, then we fired and ran out of ammo, otherwise we didn't have ammo in the first place.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_relation_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when a faction or an object's control entity changes the relation towards the player (object = entity or null, param = faction or null, param2 = [new relation, old relation], param3 = relationchangereason).
            NOTE: On permanent faction changes, object is null. On relation boosts, object is non-null, and param is either null (silent boost) or faction.player (non-silent boost).
            See &lt;set_relation_boost&gt; and &lt;add_relation_boost&gt;.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="reason" type="relationchangereasonlookup">
            <xs:annotation>
              <xs:documentation>
                The reason for relationship change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_started_control">
        <xs:annotation>
          <xs:documentation>
            Event for when the player starts control
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_stopped_control">
        <xs:annotation>
          <xs:documentation>
            Event for when the player stops control
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_subordinate_added">
        <xs:annotation>
          <xs:documentation>
            Event for when the player adds a new subordinate to squad (param = subordinate)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="subordinate" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_subordinate_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when the player removes a subordinate from squad (param = subordinate)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="subordinate" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_trade_discovered">
        <xs:annotation>
          <xs:documentation>
            Event for when a trade is discovered by the player and added to the trade memory (param = tradeoffer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="trade" type="tradeoffer" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_trade_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a player trade is cancelled (param = tradeoffer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_trade_completed">
        <xs:annotation>
          <xs:documentation>
            Event for when the player completes a trade (param = tradeoffer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_trade_started">
        <xs:annotation>
          <xs:documentation>
            Event for when the player starts a trade (param = tradeoffer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_lost_volatile_wares">
        <xs:annotation>
          <xs:documentation>
            Event for when volatile wares in the player's inventory self-destruct (param = table of lost volatile wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_travelmode_charge_started">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player ship travel mode begins charging (param = time when the mode is fully charged)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_travelmode_charge_aborted">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player ship travel mode aborts an ongoing charging process
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_travelmode_started">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player ship travel mode is done charging
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_signal_unlock_started">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player begins unlocking a signal leak (param = signal leak being unlocked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="signal" type="signalleak" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_signal_unlock_failed">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player fails to unlock a signal leak (param = signal leak being unlocked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="signal" type="signalleak" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_signal_unlock_finished">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player has successfully unlock a signal leak (param = signal leak being unlocked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="signal" type="signalleak" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_signal_unlock_impossible">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player is not currently able to unlock a signal leak (param = signal leak being unlocked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="signal" type="signalleak" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_repaired_signal_leak">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player has repaired a signal leak (param = signal leak that was repaired, param2 = object that the signal leak was attached to)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="signal" type="signalleak" />
          <xs:attribute name="parent" type="signalleak" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_unlocked_platform_trigger">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player has successfully unlocked a platform trigger (e.g. a button, panel, door) that required wares to be consumed in order to activate (param = trigger component, param2 = trigger group tag)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="component" type="object" />
          <xs:attribute name="group" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_bomb_attached">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player or a player-owned object has successfully attached a bomb (param = bomb that was attached)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="bomb" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_blueprint_added">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player has unlocked a blueprint (param = blueprint's module macro, param2 = blueprint's ware)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="ware" type="ware" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_created_signal_leaks">
        <xs:annotation>
          <xs:documentation>
            Event is raised when the player has created signal leaks (param = list of signal leaks)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_player_entered_anomaly">
        <xs:annotation>
          <xs:documentation>
            Event for the player entering an anomaly (param = entry anomaly, param2 = exit anomaly)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="entry" type="object" />
          <xs:attribute name="exit" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_autopilot_target_set">
        <xs:annotation>
          <xs:documentation>
            Event for when the player has engaged the autopilot (param = target, param2 = next target on the way to target which may be identical to target)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="target" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_game_loaded">
        <xs:annotation>
          <xs:documentation>
            Event for when the has completed loading a savegame (param = gameversion, param2 = build number, param3 = original gameversion of savegame)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="version">
            <xs:annotation>
              <xs:documentation>
                Game version number of the loaded save, multiplied by 100. e.g. 251 for version 2.51
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:integer">
                <xs:minInclusive value="1" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="build">
            <xs:annotation>
              <xs:documentation>
                Build number of the loaded save, e.g. 187332
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:integer">
                <xs:minInclusive value="1" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="originalversion">
            <xs:annotation>
              <xs:documentation>
                Game version number this save was started with, multiplied by 100. e.g. 125 for version 1.25
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:integer">
                <xs:minInclusive value="1" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_game_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a new game has been started and the universe populated
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_scan_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when a (deep)scan is aborted (requires attribute scanner and/or scanned) (object = scanner if supplied, otherwise scanned, param = the other object, param2 = true iff object is scanner)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="scanned" type="scannedrequired" />
          <xs:attribute name="scanner" type="scannerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_scan_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a (deep)scan is finished (requires attribute scanner and/or scanned) (object = scanner if supplied, otherwise scanned, param = the other object, param2 = true iff object is scanner)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="scanned" type="scannedrequired" />
          <xs:attribute name="scanner" type="scannerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_scan_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a (deep)scan is started (requires attribute scanner and/or scanned) (object = scanner if supplied, otherwise scanned, param = the other object, param2 = true iff object is scanner)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="scanned" type="scannedrequired" />
          <xs:attribute name="scanner" type="scannerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_hack_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when a hack is aborted (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked, param = the other object, param2 = true iff object is hacker)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacked" type="hackedrequired" />
          <xs:attribute name="hacker" type="hackerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_hack_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a hack is finished (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked, param = the other object, param2 = true iff object is hacker, param3 = the score result of the minigame (0 if no minigame was played))
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacked" type="hackedrequired" />
          <xs:attribute name="hacker" type="hackerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_hack_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a hack is started (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked, param = the other object, param2 = true iff object is hacker)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacked" type="hackedrequired" />
          <xs:attribute name="hacker" type="hackerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_hacked">
        <xs:annotation>
          <xs:documentation>
            Event for when an object is hacked (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked, param = the other object, param2 = true iff object is hacker)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacked" type="hackedrequired" />
          <xs:attribute name="hacker" type="hackerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_controlpanel_hack_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when a hack is aborted (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked object, param = the other object, param2 = true iff object is hacker, param3 = control panel type)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacker" type="hackerrequired" />
          <xs:attribute name="hacked" type="hackedrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_controlpanel_hack_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when a hack is finished (requires attribute hacker and/or hacked) (object = hacker if supplied, otherwise hacked, param = the other object, param2 = true iff object is hacker, param3 = control panel type)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="hacker" type="hackerrequired" />
          <xs:attribute name="hacked" type="hackedrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_observation_started">
        <xs:annotation>
          <xs:documentation>
            Event for when an object starts an observation (requires attribute observer and/or observed) (object = observer or observed, param = observer, param2 = observed, param3 = range length)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="observed" type="observedrequired" />
          <xs:attribute name="observer" type="observerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_observation_stopped">
        <xs:annotation>
          <xs:documentation>
            Event for when an observation is stopped (requires attribute observer and/or observed) (object = observer or observed, param = observer, param2 = observed)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="observed" type="observedrequired" />
          <xs:attribute name="observer" type="observerrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_attack_started">
        <xs:annotation>
          <xs:documentation>
            Event for when an object signals it will attack a target (requires attribute attacker and/or target) (object = attacker or target, param = attacker, param2 = target)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="attackerrequired" />
          <xs:attribute name="target" type="attackedrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_attack_stopped">
        <xs:annotation>
          <xs:documentation>
            Event for when an object signals it will stop an attack (requires attribute attacker and/or target) (object = attacker or target, param = attacker, param2 = target)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="attacker" type="attackerrequired" />
          <xs:attribute name="target" type="attackedrequired" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_speak_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when an actor has finished speaking (object = actor, param = page, param2 = line, param3 = interrupted - 0 if fully finished, 1 if interrupted, 2 if not even started )
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="page" type="page" />
          <xs:attribute name="line" type="line" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_trade_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a trade is cancelled, (object = either buyer or seller - see following documentation, param = tradeoffer) (If tradeoffer is provided, listened object = tradeoffer owner) : (otherwise buyer and/or seller must be provided, listened object = seller if supplied, otherwise buyer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_trade_completed">
        <xs:annotation>
          <xs:documentation>
            Event for when a trade is completed (object = either buyer or seller - see following documentation, param = tradeoffer) (If tradeoffer is provided, listened object = tradeoffer owner) : (otherwise buyer and/or seller must be provided, listened object = seller if supplied, otherwise buyer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_trade_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a trade is started (object = either buyer or seller - see following documentation, param = tradeoffer) (If tradeoffer is provided, listened object = tradeoffer owner) : (otherwise buyer and/or seller must be provided, listened object = seller if supplied, otherwise buyer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtradeoffervalues">
              <xs:attributeGroup ref="eventcondition" />
              <xs:attribute name="buyer" type="buyer" />
              <xs:attribute name="seller" type="seller" />
              <xs:attribute name="tradeoffer" type="eventtradeoffer" />
              <xs:attribute name="ware" type="ware" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_detached_from_masstraffic">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has been detached from all mass traffic networks that restrict its movement (object = detached object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_masstraffic_network_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when a mass traffic network has been removed (object = the zone that owned the network, param = the removed network's ID)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="network" type="masstraffic" />
          <xs:attribute name="check" type="checkeventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_weapon_fired">
        <xs:annotation>
          <xs:documentation>
            Event for the specified weapon firing (object = the weapon, param = fired bullet/missile/bomb)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_countermeasure">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a countermeasure (object = the launching defensible, param = launched countermeasure)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_mine">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a mine (object = the launching defensible, param = launched mine)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_lasertower">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a lasertower (object = the launching defensible, param = launched lasertower)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_lasertower_launched">
        <xs:annotation>
          <xs:documentation>
            Event for lasertower being launched (object = the space which the satellite was launched in, param = the launching defensible, param2 = launched lasertower)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which the lasertower was launched in
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="launcher" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The object which launched the lasertower
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_mine_launched">
        <xs:annotation>
          <xs:documentation>
            Event for mine being launched (object = the space which the mine was launched in, param = the launching defensible, param2 = launched mine)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which the mine was launched in
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="launcher" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The object which launched the mine
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_navbeacon">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a navigation beacon (object = the launching defensible, param = launched navigation beacon)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_navbeacon_launched">
        <xs:annotation>
          <xs:documentation>
            Event for navbeacon being launched (object = the space which the navbeacon was launched in, param = the launching defensible, param2 = launched navbeacon)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which the navbeacon was launched in
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="launcher" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The object which launched the navbeacon
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_satellite">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a satellite (object = the launching defensible, param = launched satellite)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_satellite_launched">
        <xs:annotation>
          <xs:documentation>
            Event for satellite being launched (object = the space which the satellite was launched in, param = the launching defensible, param2 = launched satellite)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which the satellite was launched in
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="launcher" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The object which launched the satellite
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_launched_resourceprobe">
        <xs:annotation>
          <xs:documentation>
            Event for an object launching a resourceprobe (object = the launching defensible, param = launched resourceprobe)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_resourceprobe_launched">
        <xs:annotation>
          <xs:documentation>
            Event for resourceprobe being launched (object = the space which the satellite was launched in, param = the launching defensible, param2 = launched resourceprobe)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space which the resourceprobe was launched in
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="groupeventsource" />
          <xs:attribute name="launcher" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The object which launched the resourceprobe
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_inventory_added">
        <xs:annotation>
          <xs:documentation>
            Event for when inventory wares were added to entity (object = entity, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_inventory_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when inventory wares were removed from entity (object = entity, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_supplies_added">
        <xs:annotation>
          <xs:documentation>
            Event for when supply wares were added to container object (object = container, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_supplies_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when supply wares were removed from container object (object = container, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_supply_orders_added">
        <xs:annotation>
          <xs:documentation>
            Event for when supply orders(as wares) were added to container object (object = container, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_supply_orders_removed">
        <xs:annotation>
          <xs:documentation>
            Event for when supply orders(as wares) were removed from container object (object = container, param = table of wares with corresponding amounts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_production_started">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has started production of a ware (object = container or productionmodule, param = productionmodule, param2 = product ware, param3 = whether this is a research project) (see also event_object_production_finished)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="productionmodule" type="productionmodule" use="optional" />
          <xs:attribute name="ware" type="ware" use="optional" />
          <xs:attribute name="research" type="booleanexpression" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_production_finished">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has finished production of a ware (object = container or productionmodule, param = productionmodule, param2 = product ware, param3 = whether this was a research project) (see also event_object_production_started)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="productionmodule" type="productionmodule" use="optional" />
          <xs:attribute name="ware" type="ware" use="optional" />
          <xs:attribute name="research" type="booleanexpression" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_props_generated">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has had props generated (object = the populated component or its container, param = component which was populated)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="component" type="object" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_props_despawning">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has props about to be despawned (object = the populated component or its container, param = component which was populated)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="component" type="object" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_object_interiors_despawning">
        <xs:annotation>
          <xs:documentation>
            Event for when an object has interiors about to be despawned (object = the populated controllable)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attributeGroup ref="objecteventsource" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_area_discovered">
        <xs:annotation>
          <xs:documentation>
            Event for when a player-owned object has discovered a previously undiscovered area (param = sector, param2 = center position of discovered hex in sector)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="sector" type="sector" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_universe_generated">
        <xs:annotation>
          <xs:documentation>
            Event for when the universe generation process has been completed (all stations have been built) at game start.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_job_ship_activated">
        <xs:annotation>
          <xs:documentation>
            Event for when a job ship has been activated in the galaxy, either spawned directly in space or when being finished at a shipyard (param = jobship)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_faction_headquarters_changed">
        <xs:annotation>
          <xs:documentation>
            Event for when a faction headquarters has been changed (param = faction, param2 = new faction headquarters station)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <xs:group name="commonconditions_nonevent">
    <xs:choice>
      <xs:element name="check_value">
        <xs:annotation>
          <xs:documentation>
            Value is in specified range (both value and range can use expressions)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Value to match (checked for non-zero if no comparison range is specified)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_age">
        <xs:annotation>
          <xs:documentation>
            Game age value is in specified range (both value and range can use time expressions)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attributeGroup ref="range">
            <xs:annotation>
              <xs:documentation>
                Time value range
              </xs:documentation>
            </xs:annotation>
          </xs:attributeGroup>
        </xs:complexType>
      </xs:element>

      <xs:element name="check_object">
        <xs:annotation>
          <xs:documentation>
            Check an object against filters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findarbitrary" />
              <!-- <xs:attribute name="space" type="space" /> -->
              <xs:attribute name="object" type="expression" use="required"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="check_weapon_active">
        <xs:annotation>
          <xs:documentation>
            Check whether the weapon is currently active
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_weapon_installed">
        <xs:annotation>
          <xs:documentation>
            Check whether the weapon is installed/available
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="count_clusters">
        <xs:annotation>
          <xs:documentation>
            Count matching clusters and check if count is in specified range
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findcluster" />
              <!-- <xs:attribute name="space" type="space" /> -->
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of clusters
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of clusters unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_gates">
        <xs:annotation>
          <xs:documentation>
            Count matching gates
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="find" />
              <xs:attribute name="object" type="object" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of gates
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of gates unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_rooms">
        <xs:annotation>
          <xs:documentation>
            Count matching rooms
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findroom" />
              <xs:attribute name="object" type="object" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of rooms
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of rooms unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_dockingbays">
        <xs:annotation>
          <xs:documentation>
            Count matching dockingbays
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="find" />
              <xs:attribute name="object" type="object" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of dockingbays
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of dockingbays unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_gravidar_contacts">
        <xs:annotation>
          <xs:documentation>
            Count matching contacts found via a gravidar
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="object" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Scanning object
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of objects
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of components unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_object_components">
        <xs:annotation>
          <xs:documentation>
            Count matching components contained in an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findarbitrary" />
              <xs:attribute name="object" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Parent object for component search
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attribute name="includeobjects" type="findincludeobjects" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of components
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of components unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_objects">
        <xs:annotation>
          <xs:documentation>
            Count matching objects
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of objects
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of objects unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_sectors">
        <xs:annotation>
          <xs:documentation>
            Count matching sectors
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findsector" />
              <xs:attribute name="space" type="space" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of sectors
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of sectors unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_ships">
        <xs:annotation>
          <xs:documentation>
            Count matching ships
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findship" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of ships
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of ships unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_stations">
        <xs:annotation>
          <xs:documentation>
            Count matching stations
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findstation" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of stations
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of stations unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="count_zones">
        <xs:annotation>
          <xs:documentation>
            Count matching zones
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="find" />
              <xs:attribute name="space" type="space" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attributeGroup ref="range">
                <xs:annotation>
                  <xs:documentation>
                    Number of zones
                  </xs:documentation>
                </xs:annotation>
              </xs:attributeGroup>
              <xs:attribute name="result" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    (Yields a list of zones unless attribute multiple is used)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="debug_text">
        <xs:annotation>
          <xs:documentation>
            Output debug text
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="text" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Text
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="debugchance" type="expression">
            <xs:annotation>
              <xs:documentation>
                Percentage chance of the debug text being displayed (used this instead of the condition chance, so that the condition does not fail)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="source" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Include the source of this debug_text (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="filter">
            <xs:annotation>
              <xs:documentation>
                Debug output filter (optional, default is scripts)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="error" />
                <xs:enumeration value="general" />
                <xs:enumeration value="scripts" />
                <xs:enumeration value="scripts_verbose" />
                <xs:enumeration value="economy_verbose" />
                <xs:enumeration value="combat" />
                <xs:enumeration value="savegame" />
                <xs:enumeration value="none" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="match_object">
        <xs:annotation>
          <xs:documentation>
            check that the object matches the criteria
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="object" type="object" use="required" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="match_any_object">
        <xs:annotation>
          <xs:documentation>
            check that an object in the group matches the criteria
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="group" type="group" use="required" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="match_all_objects">
        <xs:annotation>
          <xs:documentation>
            check that all objects in the group match the criteria (empty group returns true)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="noneventcondition" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="group" type="group" use="required" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_value">
        <xs:annotation>
          <xs:documentation>
            Remove a variable
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_value">
        <xs:annotation>
          <xs:documentation>
            Set a variable value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="operation" type="setoperationlookup" />
          <xs:attributeGroup ref="random"/>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:group>

  <!-- ===== Common actions ===== -->

  <xs:group name="commonactions">
    <xs:choice>

      <!--
      <xs:element name="template">
        <xs:annotation>
          <xs:documentation>
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>
      -->

      <xs:element name="abort_hack">
        <xs:annotation>
          <xs:documentation>
            Abort the current hack for this object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="abort_scan">
        <xs:annotation>
          <xs:documentation>
            Abort the current player scan
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="abort_scripts">
        <xs:annotation>
          <xs:documentation>
            Abort all running AI scripts on an entity.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_alert_level">
        <xs:annotation>
          <xs:documentation>
            Set alert level
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="level" type="alertlevellookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="activate_landinggears">
        <xs:annotation>
          <xs:documentation>
            Activate the ship's landing gears
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="container" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="deactivate_landinggears">
        <xs:annotation>
          <xs:documentation>
            Deactivate the ship's landing gears
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="container" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="animate_chair">
        <xs:annotation>
          <xs:documentation>
            Animate a chair to suit the using NPC
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="slot" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The NPC slot related to the chair
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="actor" type="actor" use="optional">
            <xs:annotation>
              <xs:documentation>
                The NPC using or set to use the chair
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="chairtrigger" use="optional">
            <xs:annotation>
              <xs:documentation>
                Activation state for the chair (defaults to 'invalid')
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="activate_chair">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair animate to its active position
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="deactivate_chair">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair animation to its inactive position
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="invalid">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair remain in its current activation state
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="delay" type="expression">
            <xs:annotation>
              <xs:documentation>
                (optional) delay the animation by the specified amount of time
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="trigger_animation">
        <xs:annotation>
          <xs:documentation>
            Trigger an animation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The component to trigger the animation on
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                The tag list to find specific parts to trigger the animation on (if neither this nor a group is supplied, the animation is triggered on the entire component)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="expression">
            <xs:annotation>
              <xs:documentation>
                The group ID (which may be a string or a tag) used to find specific parts to trigger the animation on (if neither this nor tags are supplied, the animation is triggered on the entire component; has no effect if tags are also specified)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="trigger" type="animationtriggerlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The animation trigger
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="delay" type="expression">
            <xs:annotation>
              <xs:documentation>
                (optional) delay the animation by the specified amount of time
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="activate_weapongroup">
        <xs:annotation>
          <xs:documentation>
            Activate weapon group
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="weapongroup" type="expression" use="required" />
          <xs:attribute name="primary" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Set to true if it's a primary, false if it's a secondary group
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_actor_to_room">
        <xs:annotation>
          <xs:documentation>
            Add NPC actor to a room. This action fails if the actor could not be connected to that room.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="room" type="object" use="optional">
            <xs:annotation>
              <xs:documentation>
                Room to place the actor (Placed without position. Not to be combined with 'slot')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="slot" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The slot to place the actor (Takes precidence over 'room')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="setroomslot" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Set the roomslot of the actor to the provided slot if it is a valid NPC slot (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="triggeranimation" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Trigger the default animations for this room slot on the actor (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="chairtrigger" use="optional">
            <xs:annotation>
              <xs:documentation>
                Activation state for the chair if the slot is a chair slot (defaults to 'activate_chair'. Using 'invalid' will keep the chair in it current activation state)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="activate_chair">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair animate to its active position
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="deactivate_chair">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair animation to its inactive position
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="invalid">
                  <xs:annotation>
                    <xs:documentation>
                      Have the chair remain in its current activation state
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                Whether the actor was successfully added
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_ammo">
        <xs:annotation>
          <xs:documentation>
            Add ammo to a defensible object (see also &lt;remove_ammo&gt; and &lt;deplete_ammo&gt;) NOTE: when used with unit macros storage limits are ignored! Use &lt;add_units&gt; instead!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount to be added (can be negative)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_ammo">
        <xs:annotation>
          <xs:documentation>
            Removes ammo from a defensible object (see also &lt;add_ammo&gt; and &lt;deplete_ammo&gt;)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount to be removed (can be negative)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="deplete_ammo">
        <xs:annotation>
          <xs:documentation>
            Depletes ammo of a defensible object (see also &lt;add_ammo&gt; and &lt;remove_ammo&gt;). If macro is not supplied then ammo will be removed from all weapons.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
        </xs:complexType>
      </xs:element>

      <xs:element name="evaluate_ammo_storage">
        <xs:annotation>
          <xs:documentation>
            Evaluates the ammo storage of the given object. Returns lists containing amounts, wares and macros for the used ammo types. Indices of the lists are in sync. Also returns total ammo capacity from launchers (excludes base object ammo capacity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="type" type="ammotypelookup" use="required" />
          <xs:attribute name="amounts" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of max amounts for the ware/macro types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of macro names for the ammo types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="wares" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of wares for the ammo types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="capacity" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                Total ammo capacity for this type provided by launchers (excludes ammo capacity of base object)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="evaluate_habitation_storage">
        <xs:annotation>
          <xs:documentation>
            Evaluates the habitation storage needed to store workforce resources for the specified amount of workers and time. Returns cargo volume of required container storage.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="race" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The race that the workforce resources are for.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="time" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The time for which to calculate the resource needs. (defaults to the production time of the workunit ware, typically 1h)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="workforce" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The number of workers the resource needs are calculated for. (defaults to the product amount of the workunit ware, typically 300)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="busy" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Whether the workunit_busy ware should be used to calculate necessary resources (workunit_idle applies when station production is dormant and uses considerably fewer resources) (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="includesecondary" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Whether secondary workforce resources(not required to maintain workforce, but increase efficiency if present) should be considered. (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                Volume of container storage required.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="evaluate_unit_storage">
        <xs:annotation>
          <xs:documentation>
            Evaluates the default unit storage of the given object. Returns lists containing unit categories, mks, macros and amounts. Indices of the lists are in sync.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="level" type="expression">
            <xs:annotation>
              <xs:documentation>
                The percentage level to which this object should be fitted out with randomly generated units. Given as a float between 0 and 1. (special value: -1 means stick to whatever was last set with &lt;set_loadout_level /&gt;
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amounts" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of amounts for the unit types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="categories" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of unit categories the unit types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of macro names for the unit types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mks" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of mks for the unit types to be used together with the respective category (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="evaluate_deployable_storage">
        <xs:annotation>
          <xs:documentation>
            Evaluates the default deployable storage of the given object. Returns lists containing deployable categories, mks, macros and amounts. Indices of the lists are in sync.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="level" type="expression">
            <xs:annotation>
              <xs:documentation>
                The percentage level to which this object should be fitted out with randomly generated deployables. Given as a float between 0 and 1. (special value: -1 means stick to whatever was last set with &lt;set_loadout_level /&gt;
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amounts" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of amounts for the deployable types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="categories" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of deployable categories the deployable types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of macro names for the deployable types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mks" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of mks for the deployable types to be used together with the respective category (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="evaluate_missile_storage">
        <xs:annotation>
          <xs:documentation>
            Evaluates the default missile storage of the given object. Returns lists containing missile macros and amounts. Indices of the lists are in sync.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="level" type="expression">
            <xs:annotation>
              <xs:documentation>
                The percentage level to which this object should be fitted out with randomly generated units. Given as a float between 0 and 1. (special value: -1 means stick to whatever was last set with &lt;set_loadout_level /&gt;
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amounts" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of amounts for the missile types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of macro names for the missile types (see other result lists, indices match)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_cargo">
        <xs:annotation>
          <xs:documentation>
            Add cargo to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The amount successfully added
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_cargo">
        <xs:annotation>
          <xs:documentation>
            Remove cargo from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The amount successfully removed
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_commission">
        <xs:annotation>
          <xs:documentation>
            Add price commission for target faction to object/faction(=target gets bonus pay for sales), if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="target" type="faction" use="required" />
          <xs:attribute name="amount" type="pricemodifieramount" use="required" />
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Name of commission, only required if target is faction.player
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="time" type="expression" >
            <xs:annotation>
              <xs:documentation>
                How long this commission lasts. Will last forever if ommitted!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_commission">
        <xs:annotation>
          <xs:documentation>
            Add price commission for player faction to object/faction(=target gets bonus pay for sales), if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="amount" type="pricemodifieramount" use="required" />
          <xs:attribute name="id" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Identifier string for the discount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Name of commission, only required if target is faction.player
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="time" type="expression" >
            <xs:annotation>
              <xs:documentation>
                How long this commission lasts. Will last forever if ommitted!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_commission">
        <xs:annotation>
          <xs:documentation>
            Remove price commission for target faction from object/faction, if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="target" type="faction" use="required" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_player_commission">
        <xs:annotation>
          <xs:documentation>
            Remove price commission for player faction from object/faction, if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="id" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Identifier string for the discount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_default_production_wares">
        <xs:annotation>
          <xs:documentation>
            Add default wares to a ship or station based on its productions and buildmodules
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="lowerlimit" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Minimum percentage of storage filled
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="upperlimit" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Maximum percentage of storage filled
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="extremechance" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Chance per ware that an extreme (0 or max) value will be added (ignoring the lower/upper limits) (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_skill">
        <xs:annotation>
          <xs:documentation>
            Add skill value to either 'entity' or a npctemplate on 'object'
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="optional" />
          <xs:attribute name="object" type="object" use="optional" />
          <xs:attribute name="template" type="expression" use="optional" />
          <xs:attribute name="type" type="skilltypeexprlookup" use="required" />
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_supplies">
        <xs:annotation>
          <xs:documentation>
            Add supplies to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_supplies">
        <xs:annotation>
          <xs:documentation>
            Remove supplies from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_supply_order">
        <xs:annotation>
          <xs:documentation>
            Add supply orders to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_supply_order">
        <xs:annotation>
          <xs:documentation>
            Remove supply order from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_tradeware">
        <xs:annotation>
          <xs:documentation>
            Add trade ware (use only on trading stations)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attribute name="allowbuy" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Allow buying this tradeware (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowsell" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Allow selling this tradeware (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lockavgprice" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Lock price to average price of ware, otherwise price is calculated based on storage amounts (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_tradeware">
        <xs:annotation>
          <xs:documentation>
            Remove trade ware (-> trading stations)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="generate_shortage_reports">
        <xs:annotation>
          <xs:documentation>
            Generate reports of wares which are either in short supply, insufficient or overflowing
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="type" use="required">
            <xs:simpleType>
              <xs:union memberTypes="expression">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:enumeration value="class.buildmodule">
                      <xs:annotation>
                        <xs:documentation>
                          Reports related to build modules
                        </xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="class.habitation">
                      <xs:annotation>
                        <xs:documentation>
                          Reports related to habitation modules and workforce
                        </xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="class.production">
                      <xs:annotation>
                        <xs:documentation>
                          Reports related to production modules
                        </xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="log" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Enable debug logging of the reports (debug, optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="insufficient" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                insufficient ware report table (ware is the key and the value is the amount of time this ware has been insufficient)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="shortage" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                shortage ware report table (ware is the key and the value is the amount of time this ware has been in short supply)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="overflow" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                overflow ware report table (ware is the key and the value is the amount of time this product has been at max capacity)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_research">
        <xs:annotation>
          <xs:documentation>
            Add research for the player
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="ware" type="ware" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_discount">
        <xs:annotation>
          <xs:documentation>
            Add price discount for target faction to object/faction(=target gets stuff cheaper), if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="target" type="faction" use="required" />
          <xs:attribute name="amount" type="pricemodifieramount" use="required" />
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Name of discount, only required if target is faction.player
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="time" type="expression" >
            <xs:annotation>
              <xs:documentation>
                How long this discount lasts. Will last forever if ommitted!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_discount">
        <xs:annotation>
          <xs:documentation>
            Add price discount for player faction to object/faction(=target gets stuff cheaper), if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="amount" type="pricemodifieramount" use="required" />
          <xs:attribute name="id" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Identifier string for the discount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="expression" use="required" >
            <xs:annotation>
              <xs:documentation>
                Name of discount, only required if target is faction.player
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="time" type="expression" >
            <xs:annotation>
              <xs:documentation>
                How long this discount lasts. Will last forever if 0 or ommitted!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_discount">
        <xs:annotation>
          <xs:documentation>
            Remove price discount for target faction from object/faction, if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="target" type="faction" use="required" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_player_discount">
        <xs:annotation>
          <xs:documentation>
            Remove price discount for player faction from object/faction, if object and faction are specified, object takes precedence!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="object" type="object" />
          <xs:attribute name="id" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Identifier string for the discount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_watchdog_units_to_masstraffic">
        <xs:annotation>
          <xs:documentation>
            Add watchdogs units of a station to its zone's masstraffic
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_next_bonus_unlocktime">
        <xs:annotation>
          <xs:documentation>
            Query the earliest time at which this unlock may be triggered again.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="result" type="lvaluename" use="required" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="bonus" type="expression" use="required"/>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_next_bonus_unlocktime">
        <xs:annotation>
          <xs:documentation>
            Set the earliest time at which this unlock may be triggered again.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="bonus" type="expression" use="required"/>
          <xs:attribute name="time" type="expression" use="required" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_conversation_view">
        <xs:annotation>
          <xs:documentation>
            Add a camera view request without NPC voice to the conversation (if not supplied then this is just a dummy action to trigger the conversation manager)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="view" type="conversationview" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_faction_relation">
        <xs:annotation>
          <xs:documentation>
            Add global faction relation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" use="required" />
          <xs:attribute name="otherfaction" type="faction" use="required" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reason" type="relationchangereasonlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The reason for relationship change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_factions_by_relation">
        <xs:annotation>
          <xs:documentation>
            Get factions by matching relation (object or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object to reference (takes preference over 'faction')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction to reference ('object' takes preference if provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="relation" type="relationlookup" use="required" />
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_faction_mood">
        <xs:annotation>
          <xs:documentation>
            Set a faction's mood to a certain level
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup" use="required" />
          <xs:attribute name="type" type="moodtypelookup" use="required" />
          <xs:attribute name="level" type="moodlevellookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_faction_mood">
        <xs:annotation>
          <xs:documentation>
            Reset a faction's mood to its default level
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup" use="required" />
          <xs:attribute name="type" type="moodtypelookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_faction_known">
        <xs:annotation>
          <xs:documentation>
            Set a faction to known/unknown to the player. Does not add encyclopedia entry for faction - see documentation for add_encyclopedia_entry.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                Faction to set known/unknown
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="known" type="booleanexpression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_faction_headquarters">
        <xs:annotation>
          <xs:documentation>
            Set a faction's headquarters to the specified station. Will fail if the station's owner is not the correct faction.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup" use="required" />
          <xs:attribute name="station" type="station" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_known">
        <xs:annotation>
          <xs:documentation>
            Set a component to known/unknown to the player. Does not add encyclopedia entry for component (except for spaces) - see documentation for add_encyclopedia_entry.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Component to set known/unknown
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="known" type="booleanexpression" use="required" />
          <xs:attribute name="updatesnapshot" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Stations only. Update the snapshot of the station's current configuration for use in the map?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_loot_magnet">
        <xs:annotation>
          <xs:documentation>
            (De)Activates the loot magnet of the playership
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="active" type="booleanexpression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_inventory">
        <xs:annotation>
          <xs:documentation>
            Add inventory to an entity (entity defaults to player, amount defaults to 1)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="entity" type="entity" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_inventory">
        <xs:annotation>
          <xs:documentation>
            Remove inventory from an entity (entity defaults to player, amount defaults to 1)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="entity" type="entity" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_licence">
        <xs:annotation>
          <xs:documentation>
            Add licence to a faction (defaults to player faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="licence" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Licence to add (takes precident over 'licencefaction' and 'type' pair)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="licencefaction" type="faction" use="optional">
            <xs:annotation>
              <xs:documentation>
                The licence issuing faction. Ignored if 'licence' is provided
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="licencelookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Type of licence. Ignored if 'licence' is provided
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_licence">
        <xs:annotation>
          <xs:documentation>
            Remove licence from a faction (defaults to player faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="licence" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Licence to remove (takes precident over 'licencefaction' and 'type' pair)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="licencefaction" type="faction" use="optional">
            <xs:annotation>
              <xs:documentation>
                The licence issuing faction. Ignored if 'licence' is provided
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="licencelookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Type of licence. Ignored if 'licence' is provided
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_npc_line">
        <xs:annotation>
          <xs:documentation>
            Add an NPC voice line to the conversation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="voicedata" minOccurs="0" maxOccurs="unbounded" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="speaker">
            <xs:annotation>
              <xs:documentation>
                Speaker (optional, an entity or a list of [controllable_context, npc_template], defaults to the conversation actor if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="page" type="pagewithdefault" />
          <xs:attribute name="line" type="line" />
          <xs:attribute name="view" type="conversationview" />
          <xs:attribute name="delay" type="expression" />
          <xs:attribute name="lookat" type="expression">
            <xs:annotation>
              <xs:documentation>
                Look in the direction of the specified component
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="hidechoices" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Hide the player's conversation choices until after the NPC line has been spoken? Default is false (don't hide).
                This has no effect if the choices were already visible before the start of this line.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="check" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Check for errors resolving an object name or description? Default is true
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_choice">
        <xs:annotation>
          <xs:documentation>
            Add a player choice text to the conversation. When chosen, &lt;event_conversation_next_section&gt; will be triggered but the conversation stack will not be changed.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="playerchoice" />
          <xs:attribute name="section" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of next conversation section
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="choiceparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is passed to &lt;event_conversation_next_section&gt;. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_choice_sub">
        <xs:annotation>
          <xs:documentation>
            Add a player choice text to the conversation. When chosen, &lt;event_conversation_next_section&gt; will be triggered,
            and a sub-conversation will be started which can return to this section (see &lt;add_player_choice_return&gt;).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="playerchoice" />
          <xs:attribute name="section" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of next conversation section
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="choiceparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is passed to &lt;event_conversation_next_section&gt;. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="baseparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is evaluated immediately, but stored until the sub-conversation returns
                and &lt;event_conversation_returned_to_section&gt; is triggered. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_choice_subconv">
        <xs:annotation>
          <xs:documentation>
            Add a player choice text to the conversation. When chosen, &lt;event_conversation_started&gt; will be triggered,
            and a sub-conversation with a different actor will be started which will return to this section when it ends (unless the player aborts the conversation as a whole).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="playerchoice" />
          <xs:attribute name="conversation" type="conversation" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of next conversation section
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="conversationactor" />
          <xs:attribute name="convparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is passed to &lt;event_conversation_started&gt;. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="baseparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is evaluated immediately, but stored until the sub-conversation returns
                and &lt;event_conversation_returned_to_section&gt; is triggered. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_player_choice_return">
        <xs:annotation>
          <xs:documentation>
            Add a player choice text to the conversation. When chosen, the current sub-conversation will return to the previous section that
            started it (see &lt;add_player_choice_sub&gt; and &lt;add_player_choice_subconv&gt;), and &lt;event_conversation_returned_to_section&gt; will be triggered.
            This action also defines the behaviour of the "Back" button.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="playerchoice" />
          <xs:attribute name="returnparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is passed to &lt;event_conversation_returned_to_section&gt;. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_conversation_return_section">
        <xs:annotation>
          <xs:documentation>
            Set the section to which the conversation returns when the player selects an &lt;add_player_choice_return&gt; option without any sub-section active. The default return section is &quot;g_finish&quot;.
            This action can be performed only once per conversation and only if no sub-section is already active.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="section" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of conversation section to return to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="baseparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional value that is passed as param2 to &lt;event_conversation_returned_to_section&gt;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_relation_boost">
        <xs:annotation>
          <xs:documentation>
            Add relation boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objectrelationboost" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reason" type="relationchangereasonlookup">
            <xs:annotation>
              <xs:documentation>
                The reason for relationship change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_to_group">
        <xs:annotation>
          <xs:documentation>
            Add an object or a list/group of objects to a group (the group is created if it does not exist yet)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="groupname" type="groupname" use="required" />
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object to add to the group (cannot be used with attributes list or group)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="list" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of objects to add to the group (cannot be used with attributes object or group)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="expression">
            <xs:annotation>
              <xs:documentation>
                Group of objects to add to the group (cannot be used with attributes object or list)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="check" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Produce an error message if an inserted object or list element is not an existing object? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_tolerance_boost">
        <xs:annotation>
          <xs:documentation>
            Add tolerance boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objectboost" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Tolerance boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="aim_turret">
        <xs:annotation>
          <xs:documentation>
            Aim turret at target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="turret" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Turret
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="targetcomponent" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_units">
        <xs:annotation>
          <xs:documentation>
            Add units to an object (either 'macro' is to be provided or both 'category' and 'mk')
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="category" type="unitcategorylookup" />
          <xs:attribute name="mk" type="expression" />
          <xs:attribute name="tags" type="expression" />
          <xs:attribute name="macro" type="expression" />
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                The faction that made the units - defaults to the owner of the object if not provided
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unavailable" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Add the unit as currently unavailable (default = false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_units">
        <xs:annotation>
          <xs:documentation>
            Remove units from an object (either 'macro' is to be provided or both 'category' and 'mk')
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="category" type="unitcategorylookup" />
          <xs:attribute name="mk" type="expression" />
          <xs:attribute name="tags" type="expression" />
          <xs:attribute name="macro" type="expression" />
          <xs:attribute name="unavailable" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Remove the unit from currently unavailable units (default = false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="request_units">
        <xs:annotation>
          <xs:documentation>
            Request units from an object and make them unavailable (either 'macro' is to be provided or both 'category' and 'mk')
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="category" type="unitcategorylookup" />
          <xs:attribute name="mk" type="expression" />
          <xs:attribute name="tags" type="expression" />
          <xs:attribute name="macro" type="expression" />
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="return_units">
        <xs:annotation>
          <xs:documentation>
            Return units from an object and make them available
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="expression" use="required"/>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="allow_conversation_escape">
        <xs:annotation>
          <xs:documentation>
            Allows or disallows escaping from the current conversation section (e.g. with Esc). Only the current section is affected, default is allow.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="enabled" type="boolean" use="required">
            <xs:annotation>
              <xs:documentation>
                Should Escape be possible in current conversation section?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="append_to_list">
        <xs:annotation>
          <xs:documentation>
            Append an element at the end of a list.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="list" use="required" />
          <xs:attributeGroup ref="random">
            <xs:annotation>
              <xs:documentation>
                Value to be appended to the list
              </xs:documentation>
            </xs:annotation>
          </xs:attributeGroup>
        </xs:complexType>
      </xs:element>

      <xs:element name="apply_construction_sequence">
        <xs:annotation>
          <xs:documentation>
            Appends a construction plan to a station that already exists. The construction plan for the station can be empty.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="station" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The station to which the construction sequence should be attached. This station must already be connected to the gamegraph, otherwise use create_station action.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sequence" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_suitable_storage_modules">
        <xs:annotation>
          <xs:documentation>
            Evaluate needed storage modules based on production requirements
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="production" type="expression">
            <xs:annotation>
              <xs:documentation>
                Macro or list of macros of production modules used to evaluate needed storage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="storage" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Macro or list of macros of storage modules already present
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of storage module macros which can be selected
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Result list of storage module macros
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="apply_attackstrength">
        <xs:annotation>
          <xs:documentation>
            Apply damage from an attack to target, returns if target was killed
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="result" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Result of attack including which component was hit.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="killed" type="lvaluename">
                  <xs:annotation>
                    <xs:documentation>
                      True if the object or module has been destroyed.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="module" type="lvalueexpression">
                  <xs:annotation>
                    <xs:documentation>
                      The module that has been attacked (if one exists). Will match the passed-in module, provided it was a valid module of the object. NOTE: the returned module can already be destroyed!
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="surfaceelement" type="lvalueexpression">
                  <xs:annotation>
                    <xs:documentation>
                      The surface element that has been attacked (if one exists). Will match the passed-in surface element, provided it was a valid surface element of the object. NOTE: the returned surface element can already be destroyed!
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="attacker" type="object" use="required" />
          <xs:attribute name="strength" type="expression" use="required" />
          <xs:attribute name="module" type="expression">
            <xs:annotation>
              <xs:documentation>
                Attack a specific module of the object (optional, defaults to a random operational module, if there are any, or the object as a whole otherwise.)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="surfaceelement" type="expression">
            <xs:annotation>
              <xs:documentation>
                Attack a specific surface element of the object (optional, defaults to a random operational surface element of the module/object, if there are any.)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="assert">
        <xs:annotation>
          <xs:documentation>
            Evaluates the value, and if it does not match, shows a modal message box and prints an error message
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="conditionalaction"/>
          <xs:attribute name="text" type="expression">
            <xs:annotation>
              <xs:documentation>
                Message text to be displayed on assertion failure
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="break">
            <xs:annotation>
              <xs:documentation>
                Determines on how many assertion failures the message box may pop up (default is 1).
                Note that resetting or refreshing the MD resets the counter.
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:union memberTypes="xs:nonNegativeInteger">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:enumeration value="1" />
                    <xs:enumeration value="0" />
                    <xs:enumeration value="always" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:union>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="assign_control_entity">
        <xs:annotation>
          <xs:documentation>
            Assign NPC actor as the control entity for the specified control post of the specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="post" type="controlpostexprlookup" use="required" />
          <xs:attribute name="transfer" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Move the actor to the object's control room instantly. (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="init" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Start the suitable AI scripts on the actor. (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_actor_to_post_location">
        <xs:annotation>
          <xs:documentation>
            Move the NPC actor to its default location for its control post
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="initialise_control_entity">
        <xs:annotation>
          <xs:documentation>
            Start suitable AI scripts on a control entity which has not been initialised yet
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="dismiss_control_entity">
        <xs:annotation>
          <xs:documentation>
            Remove NPC actor the control entity of its type of the specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_control_entities">
        <xs:annotation>
          <xs:documentation>
            Get all control entities of the specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="dismiss_pilot">
        <xs:annotation>
          <xs:documentation>
            Remove the pilot control entity of the specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="attach_object_to_target">
        <xs:annotation>
          <xs:documentation>
            Attach an object to the target using the 'limpet' connection (only supported on ships so far)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required" />
          <xs:attribute name="keepoffset" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the currect offset of object relative to target should be kept, uses target center otherwise (defaults: true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="break">
        <xs:annotation>
          <xs:documentation>
            Abort the most inner &lt;do_while&gt; or (counted) &lt;do_all&gt; loop.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="break_formation">
        <xs:annotation>
          <xs:documentation>
            Break formation as a formation leader. No effect if the object is not a formation leader
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cease_fire">
        <xs:annotation>
          <xs:documentation>
            Cease fire
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="weaponmode" type="weaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Turret in this mode should stop firing, defaults to any.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="change_relation_on_attack">
        <xs:annotation>
          <xs:documentation>
            Change relation of the attacked object towards the attacker
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="attacker" type="object" use="required" />
          <xs:attribute name="attacked" type="object" use="required" />
          <xs:attribute name="method" type="killmethodlookup" use="required" />
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                This value will be set to true if there was an effect on the relation (or at least the relation boost decay), otherwise it is set to false.
                The action can fail in several cases, e.g. if attacker and victim are of the same faction.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="change_relation_on_boarding">
        <xs:annotation>
          <xs:documentation>
            Change relation of the boarded object towards the boarder
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="boarder" type="object" use="required" />
          <xs:attribute name="boarded" type="object" use="required" />
          <xs:attribute name="attempt" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Is this a boarding attempt or the end of a successful boarding operation?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                This value will be set to true if there was an effect on the relation (or at least the relation boost decay), otherwise it is set to false.
                The action can fail in several cases, e.g. if attacker and victim are of the same faction.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="change_relation_on_kill">
        <xs:annotation>
          <xs:documentation>
            Change relation of the killed object towards the killer
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="killer" type="object" use="required" />
          <xs:attribute name="killed" type="object" use="required" />
          <xs:attribute name="method" type="killmethodlookup" use="required" />
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                This value will be set to true if there was an effect on the relation (or at least the relation boost decay), otherwise it is set to false.
                The action can fail in several cases, e.g. if attacker and victim are of the same faction.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="check_line_of_sight">
        <xs:annotation>
          <xs:documentation>
            Check if object has line of sight to the target (uses ray casts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_is_area_obstructed">
        <xs:annotation>
          <xs:documentation>
            Check if a ship is inside the designated area. Ignores mass traffic (as long as it's in the lane) and ships that have collision avoidance currently disabled (due to docking or parking).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:element name="boundingbox" type="boundingbox" minOccurs="1" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="excluded" type="ship" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_is_build_location_free">
        <xs:annotation>
          <xs:documentation>
            Check if a build location is free. Takes highways and objects like stations and gates into account, but ignores ships or asteroids.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="excluded" type="object" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_blocked_area">
        <xs:annotation>
          <xs:documentation>
            Adds a blocked area to a zone. Stationary ships inside the zone will be moved outside it, and current move_to targets inside it are invalidated. Ships that are ignored in check_is_area_obstructed are ignored here as well. Always be sure to remove any blocked areas as soon as they are no longer needed.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:element name="boundingbox" type="boundingbox" minOccurs="1" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="blocker" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Used to associate this area with the user
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_blocked_area">
        <xs:annotation>
          <xs:documentation>
            Removes a blocked area from a zone.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="blocker" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Used to associate this area with the user
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="start_observation">
        <xs:annotation>
          <xs:documentation>
            Notify the game that a target is being observed by this entity now (target: the observed object; range: the distance in which observation is actually happening)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The observer object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The observed object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="range" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The distance in which observation is actually happening
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_observation">
        <xs:annotation>
          <xs:documentation>
            Notify the game that a target is no longer being observed by this entity
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The observer object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The previously observed object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="start_attack">
        <xs:annotation>
          <xs:documentation>
            Notify the game that a target is being attacked by this entity now
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The attacker object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The attacked object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_attack">
        <xs:annotation>
          <xs:documentation>
            Notify the game that a target is no longer being attacked by this entity
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The attacker object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The previously attacked object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="report_illegal_activity">
        <xs:annotation>
          <xs:documentation>
            Report illegal activity
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object doing the illegal activity
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression">
            <xs:annotation>
              <xs:documentation>
                The victim of the activity
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="claim_ship">
        <xs:annotation>
          <xs:documentation>
            Claim the target ship using pilot. ATTENTION: this moves 'this' to $target! All further this.* calls will correspond to $target!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="target" type="expression" use="required" >
            <xs:annotation>
              <xs:documentation>
                Ship that will be claimed. Must be ownerless.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pilot" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Pilot that will do the claiming. Will be moved from its current controllable to target.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction that will take owership of ship. Will default to ownership of pilot controllable if ommitted.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clamp_trade_amount">
        <xs:annotation>
          <xs:documentation>
            Clamp trade amount value based on buyer/seller storage situation (bundle/unbundle states are taken into account and the appropriate storages - cargo, ammo or units - are checked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="trade" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The trade to check
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                Initial amount to clamp based on buyer/seller storage limits (optional, defaults to 2147483647)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buyer" type="expression">
            <xs:annotation>
              <xs:documentation>
                The buyer to look at for free storage limitations (optional, either buyer or seller must be specified)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="seller" type="expression">
            <xs:annotation>
              <xs:documentation>
                The seller to look at for stored item limitations (optional, either buyer or seller must be specified)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="bundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be bundled (convert ammo/unit -> ware) on transfer? (optional, defaults to the trade offer bundle flag)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unbundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be unbundled (turn ware into ammo/units) on transfer? (optional, defaults to the trade offer unbundle flag)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="updatedeal" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Should the passed-in tradedeal amount be updated if the clamp results in a reduction of amount? (optional, defaults to false, DO NOT USE FOR TRADE OFFERS!)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount clamped so it both matches what seller has and what buyer can store.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_collision_filter">
        <xs:annotation>
          <xs:documentation>
            Clear the list of objects for which collisions are disabled
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_group">
        <xs:annotation>
          <xs:documentation>
            Clear a group, i.e. remove all members from it
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="group" type="group" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_list">
        <xs:annotation>
          <xs:documentation>
            Clear a list (equivalent to resizing to 0 elements)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="list" type="list" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_table">
        <xs:annotation>
          <xs:documentation>
            Clear a table, i.e. remove all keys and values from it
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="table" type="table" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_building_position">
        <xs:annotation>
          <xs:documentation>
            Get buildership position outside of the stations boundaries, requires using 'position', 'space' and 'macro' OR an already placed 'construction'
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="construction" type="object" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="space" type="zone" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="assign_construction_vessel">
        <xs:annotation>
          <xs:documentation>
            Assign a construction vessel to work for a build module of a build storage. Construction vessel is not yet deployed to aid in building.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="buildmodule" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="deploy_construction_vessel">
        <xs:annotation>
          <xs:documentation>
            Deploy a construction vessel to begin work for a build module of a build storage.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="buildmodule" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="disengage_construction_vessel">
        <xs:annotation>
          <xs:documentation>
            Disengage a construction vessel from a build module
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Build Module or Construction Vessel
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="connect_to_trade_location">
        <xs:annotation>
          <xs:documentation>
            Connect a ship to a trade location (= reserve parking space)
            If result is null then the operation failed.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="tradedock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Trade Location ComponentSlot (find using &lt;find_tradeoffer_parking_slot&gt;)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="disconnect_from_trade_location">
        <xs:annotation>
          <xs:documentation>
            Disconnect a ship from a trade location (= free up parking space)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="tradedock" type="expression">
            <xs:annotation>
              <xs:documentation>
                (optional) the Trade Location ComponentSlot to disconnect from. (if supplied, additional validation will be performed)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_build_to_construct_ship">
        <xs:annotation>
          <xs:documentation>
            Add a build task to construct a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Container object that has a build module
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="macro" use="optional">
            <xs:annotation>
              <xs:documentation>
                Macro to build (overriden by the macro of buildobject if provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildobject" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Existing object to be built as a new object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="faction" use="optional">
            <xs:annotation>
              <xs:documentation>
                Specific faction to be used (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="loadout" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Loadout ID (must be valid in 'macro' or the macro of 'buildobject')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Price of the constructed object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_build_to_expand_station">
        <xs:annotation>
          <xs:documentation>
            Add a build task to expand a station
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Container object that has a build module
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildobject" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Existing object to be expanded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="constructionplan" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Construction plan ID string or constructionsequence value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Price of the expansion
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_build_to_modify_ship">
        <xs:annotation>
          <xs:documentation>
            Add a build task to upgrade or restock a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="people" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  People definitions
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="add" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:choice maxOccurs="1">
                        <xs:element name="existing_people" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              People to be added to the object from NPC templates existing on the building object
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:attributeGroup ref="existingpeoplelist"/>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="matching_people" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              People to be added to the object from matching people or workforce on the building object (or from nowhere otherwise)
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:attributeGroup ref="matchingpeoplelist"/>
                            <xs:attribute name="force" type="booleanexpression">
                              <xs:annotation>
                                <xs:documentation>
                                  Force the people to be added regardless of available matching NPCs on the providing object (defaults to false)
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                      </xs:choice>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="remove" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:choice maxOccurs="1">
                        <xs:element name="existing_people" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              People to be added to the object from NPC templates existing on the building object
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:attributeGroup ref="existingpeoplelist"/>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="matching_people" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              People to be added to the object from matching people or workforce on the building object (or from nowhere otherwise)
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:attributeGroup ref="matchingpeoplelist"/>
                            <xs:attribute name="force" type="booleanexpression">
                              <xs:annotation>
                                <xs:documentation>
                                  Force the people to be removed, regardless of available free space on the receiving object (defaults to true)
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                      </xs:choice>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Container object that has a build module
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildobject" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Existing object to be upgraded or restocked
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="loadout" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Loadout ID (must be valid in the macro of 'buildobject')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ammo" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Table of ammo types (ware or macro) with assigned amounts
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="units" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Table of unit types (ware or macro) with assigned amounts
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Price of the upgrade
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="optional" />
          <xs:attribute name="immediate" type="immediateorder" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_build_people">
        <xs:annotation>
          <xs:documentation>
            Get build people definitions in the form of a set of lists, either to be removed or added
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="build" type="build" use="required" />
          <xs:attribute name="amounts" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of amounts
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="currentroles" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of roles used to identify people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="newroles" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of roles to reassign people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="races" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of races used to identify people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="skills" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of skills used to identify people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="people" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of people (if 'removed' == true, then these people are currently on the built object, otherwise, the building object)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="remove" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Get the people set to be removed (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="reassign_existing_people">
        <xs:annotation>
          <xs:documentation>
            Reassign people's roles
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="existingpeoplelist"/>
          <xs:attribute name="object" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="reassign_matching_people">
        <xs:annotation>
          <xs:documentation>
            Reassign people's roles
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="matchingpeoplelist"/>
          <xs:attribute name="object" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="transfer_people">
        <xs:annotation>
          <xs:documentation>
            Transfer people as defined in a build order, or by this definition
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:choice maxOccurs="1">
            <xs:element name="existing_people" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  People to be added to the object from NPC templates existing on the building object
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="existingpeoplelist"/>
              </xs:complexType>
            </xs:element>
            <xs:element name="matching_people" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  People to be added to the object from matching people or workforce on the building object (or from nowhere otherwise)
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="matchingpeoplelist"/>
              </xs:complexType>
            </xs:element>
          </xs:choice>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="build" type="build" use="optional">
            <xs:annotation>
              <xs:documentation>
                Build containing the people definition
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object recieving the people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="otherobject" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object providing the people
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                List of people successfully transferred from otherobject to object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_build">
        <xs:annotation>
          <xs:documentation>
            Add a build task to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="build" type="build" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_build">
        <xs:annotation>
          <xs:documentation>
            Remove a build task from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="build" type="build" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="process_build">
        <xs:annotation>
          <xs:documentation>
            Begin processing a build task
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Container object that has a build processor
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildmodule" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specific build module to be used (optional, ignored if build processor is supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildprocessor" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specific build processor to be used (optional, overrides build module if supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="build" type="build" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="reserve_build_plot">
        <xs:annotation>
          <xs:documentation>
            Reserve a build plot, creating the base station and build storage
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:element name="plot" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:annotation>
                  <xs:documentation>
                    Initial build plot dimensions, with the base station in the centre
                  </xs:documentation>
                </xs:annotation>
                <xs:attribute name="x" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Length of the plot on the X axis
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="y" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Length of the plot on the Y axis
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="z" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Length of the plot on the Z axis
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="owner" type="faction" use="optional" />
          <xs:attribute name="result" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Created build storage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_build_plot">
        <xs:annotation>
          <xs:documentation>
            Set the build plot of an object to be a given size.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Station or BuildStorage of which the plot will be extendedm
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="x" type="expression" use="required" />
          <xs:attribute name="y" type="expression" use="required" />
          <xs:attribute name="z" type="expression" use="required" />
          <xs:attribute name="allowreduction" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Should the build plot be allowed to be reduced from its current size? Defaults to false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="paid" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is this plot size paid for (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="extend_build_plot">
        <xs:annotation>
          <xs:documentation>
            Extend the length of a build plot (potentially shifing the BuildStorage's position)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Station or BuildStorage of which the plot will be extended
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negx" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the negative X axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negy" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the negative Y axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="negz" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the negative Z axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="posx" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the positive X axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="posy" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the positive Y axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="posz" type="expression">
            <xs:annotation>
              <xs:documentation>
                Extension of the plot length on the positive Z axis
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowreduction" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the build plot be allowed to reduce in size if necessary. Defaults to false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_build">
        <xs:annotation>
          <xs:documentation>
            Clear a build after a build is finished
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="buildmodule" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Build module to be cleared
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildprocessor" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Build processor to be cleared
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="commandeer_object">
        <xs:annotation>
          <xs:documentation>
            Commandeer an object to be used by faction logic
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="release_commandeered_object">
        <xs:annotation>
          <xs:documentation>
            Release a commandeered object (job ships restart their orders)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="release_job_ship">
        <xs:annotation>
          <xs:documentation>
            Release a ship from its job
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_waiting_job_ship">
        <xs:annotation>
          <xs:documentation>
            Find waiting job ship(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_waiting_subordinate">
        <xs:annotation>
          <xs:documentation>
            Find waiting subordinate(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="commander" type="object" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_subordinate_jobs">
        <xs:annotation>
          <xs:documentation>
            Get the possible subordinate jobs and the number of missing desired ships
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attribute name="commander" type="object" use="required" />
              <xs:attribute name="init" type="booleanexpression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Is the commander initialising (defaults to false)? If false, subordinates flagged to not rebuild are ignored
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="jobs" type="lvalueexpression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Result list of job IDs (paired with amount)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="amount" type="lvalueexpression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Result list of desired ship amounts (paired with jobs)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_subordinate_macro">
        <xs:annotation>
          <xs:documentation>
            Get the possible subordinate macro(s) of a job ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attribute name="commander" type="object" use="required" />
              <xs:attribute name="init" type="booleanexpression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Is the commander initialising (defaults to false)? If false, subordinates flagged to not rebuild are ignored
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="name" type="lvaluename" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="organise_job_ship_subordinates">
        <xs:annotation>
          <xs:documentation>
            Organise a job ship's subordinate hierarchy based on job definitions
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="commander" type="object" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_suitable_job">
        <xs:annotation>
          <xs:documentation>
            Get suitable job(s) by their category and basket data
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="size" type="shipsizeclasslookup">
            <xs:annotation>
              <xs:documentation>
                Ship size
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware">
            <xs:annotation>
              <xs:documentation>
                Ware to be matched to job basket
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="force" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Find suitable jobs even if the Job Engine is deactivated?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result job id or list of job id's
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="request_job_ship">
        <xs:annotation>
          <xs:documentation>
            Request a new job ship for a purpose
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="job" type="expression" use="required"/>
          <xs:attribute name="requester" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object requesting the ship to be created (can also be a space)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to become the ship's main job zone
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware">
            <xs:annotation>
              <xs:documentation>
                Ware requested to be transported by the job ship.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result ship (may not be connected to universe)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_job_ship_request">
        <xs:annotation>
          <xs:documentation>
            Remove the request for a job ship (ship is removed if it does not exist in the universe)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_requested_job_ship_timeout">
        <xs:annotation>
          <xs:documentation>
            Set the time after which a job ship will be unregistered as a requested ship (will not happen at the exact time)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="object" use="required"/>
          <xs:attribute name="timeout" type="expression" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_requested_job_ship">
        <xs:annotation>
          <xs:documentation>
            Find requested job ship(s). Allows specialised filtering by 'requester', 'ware', 'includeexisting' and 'includewaiting'.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
              <xs:attribute name="requester" type="expression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    The object which requested the ship (if null, the ships are not filtered by requester)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="ware" type="expression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    The ware associated with the ship request (if null, the ships are not filtered by ware)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="includeexisting" type="booleanexpression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Include ships which are in the universe (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="includewaiting" type="booleanexpression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Include ships which are waiting to be created in the universe (defaults to true. do not use with groups)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_builds_to_replace_subordinates">
        <xs:annotation>
          <xs:documentation>
            Order the commander's needed subordinates from the buildobject, placing them in its build order queue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="commander" type="object" />
          <xs:attribute name="buildobject" type="object" />
          <xs:attribute name="init" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the commander initialising (defaults to false)? If false, subordinates flagged to not rebuild are ignored
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvalueexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                List containing the resulting build orders
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="activate_job_ship_orders">
        <xs:annotation>
          <xs:documentation>
            Trigger the orders for this ship's job to start
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="activate_waiting_job_ship">
        <xs:annotation>
          <xs:documentation>
            Inform the job engine that a waiting ship is ready for use
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_ship_expiration_time">
        <xs:annotation>
          <xs:documentation>
            Set the time at which a job ship is treated as expired
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="object" use="required" />
          <xs:attribute name="time" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="continue">
        <xs:annotation>
          <xs:documentation>
            Skip the current iteration of the most inner &lt;do_while&gt; or (counted) &lt;do_all&gt; loop, and continue with the next iteration.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_ai_unit">
        <xs:annotation>
          <xs:documentation>
            Create an AI unit from the provided object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_group">
        <xs:annotation>
          <xs:documentation>
            Create an empty group
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="groupname" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of the group to be created
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_list">
        <xs:annotation>
          <xs:documentation>
            Create a list of given element count (default is 0), filled with null values. Use [] syntax instead for lists with fixed size/content.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="random">
            <xs:annotation>
              <xs:documentation>
                Number of elements
              </xs:documentation>
            </xs:annotation>
          </xs:attributeGroup>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_formation">
        <xs:annotation>
          <xs:documentation>
            Create formation on a object. If that object has already a formation, it only changes the shape. Nested formations supported.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object for which this formation should be created (can be any member of an existing formation or a new leader)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="formation" type="formationshapelookup" use="required">
            <xs:annotation>
              <xs:documentation>
                Formation shape
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Parameter for formation shape, see formation shape documentation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="rollformation" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the entire formation shape should roll with the leader (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="rollmembers" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether individual members should mimic the roll orientation of the leader (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxshipsperline" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximum number of ships per line of formation shape (optional, defaults to 20).
                If the amount of ships exceed this number, the formation will split creating lines up to this maximum amount.
                Does not affect the following formation shapes:  wshape, eagle, twin, triangle, dartvertical and darthorizontal.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_crate">
        <xs:annotation>
          <xs:documentation>
            Create a crate in a room
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="slot" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Room slot to place the crate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_lockbox">
        <xs:annotation>
          <xs:documentation>
            Create a Lockbox (wrapped inside its own object)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to create the lockbox in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the lockbox in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="owner" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_mission_board">
        <xs:annotation>
          <xs:documentation>
            Create a mission board object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to create the mission board in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the mission board in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="owner" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_object">
        <xs:annotation>
          <xs:documentation>
            Create an Object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to create the object in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the object in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="owner" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_signal_leak">
        <xs:annotation>
          <xs:documentation>
            Create a signal leak on an object or in space
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:element name="voice" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Specify voice pageID and a text ID or a list of text IDs for this signal leak. A random one will be chosen if multiple are provided. Only valid and required for type signalleaktype.voice!
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="page" type="page" use="required" />
                <xs:attribute name="lines" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      List of line IDs or single line ID in a text page
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="type" type="signalleaktypelookup" use="required"/>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object (or zone) to create the signal leak in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the signal leak in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="slot" type="expression">
            <xs:annotation>
              <xs:documentation>
                Slot to connect the signal leak to (only works for 'info' or 'mission' slots on objects, ignored for zone signal leaks)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="update_signal_leak_voice">
        <xs:annotation>
          <xs:documentation>
            Specify voice pageID and a text ID or a list of text IDs for an existing signal leak. A random one will be chosen if multiple are provided. Only valid and required for type signalleaktype.voice!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="page" type="page" use="required" />
          <xs:attribute name="lines" type="line" use="required">
            <xs:annotation>
              <xs:documentation>
                List of line IDs or single
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                The signal leak to update
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_order">
        <xs:annotation>
          <xs:documentation>
            Creates an AI order and adds it to an object's order queue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  AI order parameter
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="value" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter value
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="id" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Order ID
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="default" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Create as default order of the object? Instead of being added to the order queue, the order will replace the previous default order.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="immediate" type="immediateorder" />
          <xs:attribute name="name" type="lvaluename" />
        </xs:complexType>
        <xs:key name="create_order_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>

      <xs:element name="create_trade_order">
        <xs:annotation>
          <xs:documentation>
            Creates an AI trade order and adds it to an object's order queue. A trade deal is created based on the given trade offer,
            so the trade can be performed in the future even if the trade offer changes or disappears in the meantime.
            The trade order ID is hard-coded. The trade deal is associated with the order (accessible via $order.trade) and is passed
            to the order as the &quot;trade&quot; parameter.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="tradeoffer" type="tradeoffer" use="required" />
          <xs:attribute name="amount" type="expression" use="required" />
          <xs:attribute name="price" type="expression">
            <xs:annotation>
              <xs:documentation>
                Price per piece (defaults to the trade offer price)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="bundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be bundled (convert ammo/unit -> ware) on transfer? (optional, defaults to the trade offer bundle flag)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unbundle" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should the ware be unbundled (turn ware into ammo/units) on transfer? (optional, defaults to the trade offer unbundle flag)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="immediate" type="immediateorder" />
          <xs:attribute name="name" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_orientation">
        <xs:annotation>
          <xs:documentation>
            Create an orientation(rotation) value. refobject takes priority over refposition if both are supplied
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position">
              <xs:annotation>
                <xs:documentation>
                  Position the orientation originates at (e.g. look_at means look from position towards refposition)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="maxpitch" type="xs:positiveInteger">
            <xs:annotation>
              <xs:documentation>
                The maximum pitch angle to be returned, in positive degrees (default: 90, i.e. no restriction)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attributeGroup ref="orientation" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_construction_sequence">
        <xs:annotation>
          <xs:documentation>
            Create a construction sequence for a station randomly, connecting station modules with each other (but not applying the result to the station automatically).
            Since it takes a lot of CPU time to calculate the result, the action is completed instantly and the result will be provided later via &lt;event_object_construction_sequence_created&gt;.
            To retrieve the result immediately as part of the action, use the child element &lt;immediate&gt;, but be aware that it will block the rest of the game until the result is available.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="immediate" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Provide the construction sequence immediately. The action will block the game until the result is available.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="result" type="lvalueexpression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Name of the variable that will receive the resulting construction sequence. In case of failure the result will be null.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="station" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The station for which the construction sequence should be created. Its plot bounding box will be used as a constraint,
                and the station will receive the event &lt;event_object_construction_sequence_created&gt;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of macros of functional modules to be added to the construction sequence
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="connectors" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of macros of connector modules that are allowed in the construction sequence to connect functional modules.
                The algorithm may use a connector macro multiple times; it is not necessary to have duplicates in the list.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="constructionbias" type="expression">
            <xs:annotation>
              <xs:documentation>
                Construction direction bias (omit or set to 0.0 to use default, or use range 0.1 to 10.0 where less than 1.0 prefers vertical connections, 1.0 is balanced, and greater than 1.0 prefers horizontal connections)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="base" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional existing construction sequence that should be extended
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="timeout" type="expression">
            <xs:annotation>
              <xs:documentation>
                Time limit for the computationally intensive part of the generation algorithm (default is no limit). See also the failsafe attribute.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="failsafe" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Prevent failure of the sequence generation (default is true), in case the generator fails to connect all modules. Normally a failure
                only occurs by reaching the timeout (if timeout attribute is present) or if the input to the generator does not allow for enough flexibility
                (e.g. if no connectors are supplied or the plot size is too small). To prevent failure, the remaining unconnected modules will be added in
                free space without any connections. This additional step can only fail if the plot size is too limited to allow adding the missing modules.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_from_construction_sequence">
        <xs:annotation>
          <xs:documentation>
            Remove entries from the construction sequence that use the provided macros, also detaching all descendant entries in the connection tree.
            It is possible that more entries get removed than requested in the macro list.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="result">
              <xs:annotation>
                <xs:documentation>
                  Element for defining variable names that will receive the results
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="sequence" type="lvalueexpression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Resulting construction sequence
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="removed" type="lvalueexpression">
                  <xs:annotation>
                    <xs:documentation>
                      List of existing components that are associated with input sequence entries but are removed in the result sequence (only returned if object is supplied)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="cost" type="lvalueexpression">
                  <xs:annotation>
                    <xs:documentation>
                      Total removal cost
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object that the construction sequence belongs to (if supplied, it affects attribute 'costs' and result attribute 'removed')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sequence" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Existing construction sequence from which entries should be removed
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of macros of functional modules to be removed from the construction sequence.
                In order to remove multiple entries of the same macro, provide the macro multiple times.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="connectors" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of macros of connector modules which may be removed in addition to the functional modules,
                except for the ones that are still required to keep the remaining sequence connected.
                It is not necessary to have duplicates in the list.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="costs" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional table of existing station components, with numeric cost values assigned to them. The action seeks to minimise the total cost of removed functional modules.
                For all sequence entries for which no cost is defined, a cost of 1.0 will be assumed for functional modules, and 0.0 for connectors.
                If object is provided, a cost of 0.0 will be assumed for all functional modules that do not exist in the object (i.e. have not been built yet).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="generate_loadout">
        <xs:annotation>
          <xs:documentation>
            Generate a loadout for a given object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="sequence" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A construction sequence for which loadouts should be generated. Loadouts will be generated an entry at a time.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A macro (ship or station) for which a loadout should be generated. Loadout will be returned as a single entry. Ignored if a sequence is provided.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="module" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A module macro (station module) for which a loadout should be generated. Loadout will be returned as a single entry. Optional, ignored unless macro is provided.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Faction to use for selecting equipment.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="otherfaction" type="factionexprlookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Additional faction to use for selecting equipment, where licences for both selling and buying are required. Ignored if wares or macros are supplied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="wares" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A list of wares or table of ware amounts, from which the loadout should be generated. If neither wares nor macros are provided, default items for faction will be used.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A list of macros or table of macro amounts, from which the loadout should be generated. Ignored if wares are provided. If neither wares nor macros are provided, default items for faction will be used.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="repeat" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                If a list of wares or macros is supplied, use repeated entries to indicate quantity, otherwise quantity is unlimited. Default is false (unlimited). Ignored if wares or macros are specified as a table, or if neither are specified.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="level" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The level of the loadout that should be generated. This should be a value between 0 and 1. If variation is non-zero, it will add variation to this number. Defaults to value defined in parameters.xml.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="variation" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Allows an amount of variation on both the number of slots filled on a given entry in the sequence and what the slots can be filled with. Defaults to value defined in parameters.xml.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="requireblueprints" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                When generating a default loadout with no supplied ware or macro lists, select only items for which the supplied faction has blueprints. Has no effect for non-player factions. Defaults to false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flags" type="loadoutflagbitmask" use="optional">
            <xs:annotation>
              <xs:documentation>
                Loadout flags for elements to generate (add/remove flags not used in this case).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="invertflags" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Invert the loadout flags provided in 'flags' attribute.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                A list of loadouts that have been generated for the given construction sequence. The index of each loadout refers to the index of the construction plan entry in the sequence.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="used" type="lvalueexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Optional variable to receive used items. Contents will follow the format of data supplied, i.e. wares if wares were supplied, macros if macros were supplied, and repeated if repeat parameter is true. Not populated if no ware/macro list is provided at all.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="remaining" type="lvalueexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Optional variable to receive remaining items. Contents will follow the format of data supplied, i.e. wares if wares were supplied, macros if macros were supplied. If repeat is false then the remaining items will be the same as the originally-supplied list because quantities are unlimited. Not populated if no ware/macro list is provided at all.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_loadout">
        <xs:annotation>
          <xs:documentation>
            Get a loadout via an ID
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="loadout" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                ID string of the loadout
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Macro of which the loadout is defined for
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result loadout
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_loadout">
        <xs:annotation>
          <xs:documentation>
            Create a loadout using a fixed loadout definition
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="loadoutelements" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result loadout
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="apply_loadout">
        <xs:annotation>
          <xs:documentation>
            Apply the specified loadout to an object or construction sequence at the specified index.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="loadout" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The loadout that should be applied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object to apply the loadout to. Either a ship, or a station module.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sequence" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                A sequence to which the loadout should be applied. If sequence is given, index must also be given, as a loadout is applied to a specific entry in the sequence.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="index" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                The index of the entry in the sequence to which the loadout that should be applied. Must be supplied if sequence is also supplied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flags" type="loadoutflagbitmask" use="optional">
            <xs:annotation>
              <xs:documentation>
                Loadout flags for elements to apply, and operations (add/remove) to perform.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_equipment_mods">
        <xs:annotation>
          <xs:documentation>
            Add one or more equipment mods to a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="equipmentmods" />
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Ship to add the equipment mods to.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_paint_mod">
        <xs:annotation>
          <xs:documentation>
            Add paint mod to a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Ship to add the paint mod to.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Paint mod ware (from paintmods.xml, defines a quality level and visual properties of a paint mod)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_loadout_level">
        <xs:annotation>
          <xs:documentation>
            Set the specified loadout level for an object. Allowed range: 0.0 to 1.0. This loadout level will be used as the default for subsequent functions working with it (e.g. &lt;evaluate_unit_storage /&gt;)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Object loadout level applies to. Either a ship or station.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="random" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_random_position_in_boundingbox">
        <xs:annotation>
          <xs:documentation>
            Create a random position value within the bounding box of a component (the resulting value is relative to the component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="component" type="object" use="required" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_random_position_outside_boundingbox">
        <xs:annotation>
          <xs:documentation>
            Create a random position value outside the bounding box of a component (the resulting value is relative to the component)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="component" type="object" use="required" />
          <xs:attribute name="mindistance" type="expression">
            <xs:annotation>
              <xs:documentation>
                The minimum distance the generated point will have from the edge of the component's bounding box in each axis.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxdistance" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The maximum distance the generated point will have from the edge of the component's bounding box in each axis.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_trade_offer">
        <xs:annotation>
          <xs:documentation>
            Create a trade offer and if provided, add it to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="seller" type="object" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Setting the seller object makes this a Sell type offer. Also setting buyer negates this.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buyer" type="object" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Setting the buyer object makes this a Buy type offer. Also setting seller negates this.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="object" use="required" >
            <xs:annotation>
              <xs:documentation>
                Object for the offer to be localiased on
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attribute name="price" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The price of a single item
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression" use="required" />
          <xs:attribute name="desiredamount" type="expression">
            <xs:annotation>
              <xs:documentation>
                The real amount we desire if available funds would not matter (optional, defaults to amount)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minamount" type="expression" use="optional" />
          <xs:attribute name="fixedamount" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the ware amount fixed? Ignored if minamount is set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unbundle" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Should the ware be unbundled (turn ware into ammo/units) on transfer? (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="bundle" type="boolean" use="optional">
            <xs:annotation>
              <xs:documentation>
                Should the ware be bundled (convert ammo/unit -> ware) on transfer? (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="playeronly" type="boolean" use="required">
            <xs:annotation>
              <xs:documentation>
                Should this tradeoffer only be available to the player faction? (defaults to true, will allow *all* factions to trade if set to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mission" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the trade for a mission (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_trade_offer">
        <xs:annotation>
          <xs:documentation>
            Remove a trade offer from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="tradeoffer" type="tradeoffer" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_position_outside_boundingbox">
        <xs:annotation>
          <xs:documentation>
            Create a position value just outside the bounding box of a component, in the direction of the given position (the resulting value is relative to the component).
            If the given position is inside the bounding box, it will be used as the result.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="1" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="component" type="object" use="required" />
          <xs:attribute name="distance" type="expression">
            <xs:annotation>
              <xs:documentation>
                The distance the generated point will have from the edge of the component's bounding box.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_is_position_inside_boundingbox">
        <xs:annotation>
          <xs:documentation>
            Check if a position is inside an object's bounding box
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_object_surface">
        <xs:annotation>
          <xs:documentation>
            Create a position value directly on the surface of an object, in the direction of the given position (the resulting value is relative to the space, or the object if no space was supplied).
            The rotation value will be set from the surface normal.
            If no position is supplied, it will be randomized in a sphere around the object.
            If the position return value is null, no raycast was performed. This can happen if the collision mesh was not loaded yet. To handle this case, wait a second or so and retry.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="offsetrotation" type="rotation" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Optional rotation that will be applied to the result in addition to the rotation based on the surface normal.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="component" type="object" >
            <xs:annotation>
              <xs:documentation>
                Sub component of object to aim the raycast at (otherwise object center) (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="space" />
          <xs:attribute name="height" type="expression">
            <xs:annotation>
              <xs:documentation>
                If specified, the result will be moved by this distance along the surface normal. Can also be negative.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="posname" type="lvaluename" use="required" />
          <xs:attribute name="rotname" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_position">
        <xs:annotation>
          <xs:documentation>
            Create a position value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="position" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="transform_position">
        <xs:annotation>
          <xs:documentation>
            Create a position value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="refposition" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Reference position
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="refrotation" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Rotation at the reference position
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_rotation">
        <xs:annotation>
          <xs:documentation>
            Create a rotation value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="rotation" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_ship">
        <xs:annotation>
          <xs:documentation>
            Create a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="createship" />
            <xs:element name="orientation" type="orientation" minOccurs="0" maxOccurs="1" />
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attributeGroup ref="createship"/>
          <xs:attribute name="dock" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a Dockslot, DockingBay component or Container component to spawn in (takes precedence from zone or sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mission" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the ship for a mission (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commandeerable" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the ship commandeerable by faction logic (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to spawn in (used if dock is omitted or invalid, take precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the ship in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="defaultscript" type="expression">
            <xs:annotation>
              <xs:documentation>
                Default script name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_station">
        <xs:annotation>
          <xs:documentation>
            Create a station
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="constructionplan" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Construction plan ID string or constructionsequence value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to create the station in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the station in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="owner" type="faction" />
          <xs:attribute name="state" type="componentstateexprlookup">
            <xs:annotation>
              <xs:documentation>
                State of the new station. Defaults to construction
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_factory">
        <xs:annotation>
          <xs:documentation>
            Create a factory
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="createmodule"/>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="modules" type="lvaluename" />
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to create the station in. (takes precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to create the station in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="owner" type="faction" use="required"/>
          <xs:attribute name="race" type="race">
            <xs:annotation>
              <xs:documentation>
                Race of the factory, used to get a valid set (overridden by 'set')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="set" type="expression">
            <xs:annotation>
              <xs:documentation>
                Module set ID used to construct this factory
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_module">
        <xs:annotation>
          <xs:documentation>
            Create and add a module to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="createobjectsafepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="macro" type="macro" use="required"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to add the module to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_dynamic_interior">
        <xs:annotation>
          <xs:documentation>
            Create and add a dynamic interior to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="interiorname" type="lvaluename" />
          <xs:attribute name="corridorname" type="lvaluename" />
          <xs:attribute name="roomname" type="lvaluename" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to add the interior to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="module" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional module within the object where the interior should be added
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="corridor" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Corridor macro
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="door" type="expression">
            <xs:annotation>
              <xs:documentation>
                Door macro slot or connection name withing corridor (random door is selected if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="room" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Room macro
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Name to be applied to new interior
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="roomtype" type="roomtypeexprlookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_dynamic_interior">
        <xs:annotation>
          <xs:documentation>
            Remove a dynamic interior from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to remove the interior from (any one of interior, corridor or room component can be supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="interior" type="expression">
            <xs:annotation>
              <xs:documentation>
                Interior to remove
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="corridor" type="expression">
            <xs:annotation>
              <xs:documentation>
                Corridor to remove (ignored if interior provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="room" type="expression">
            <xs:annotation>
              <xs:documentation>
                Room to remove (ignored if interior or corridor provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_dynamic_interior_private">
        <xs:annotation>
          <xs:documentation>
            Set the rooms of a dynamic interior to private so contained NPC slots and waypoints can only be found by querying the rooms specifically, not via their contexts
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object containing the interior (any one of interior, corridor or room component can be supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="interior" type="expression">
            <xs:annotation>
              <xs:documentation>
                Interior to set privacy for
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="corridor" type="expression">
            <xs:annotation>
              <xs:documentation>
                Corridor used to find interior to set privacy for (ignored if interior provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="room" type="expression">
            <xs:annotation>
              <xs:documentation>
                Room used to find interior to set privacy for (ignored if interior or corridor provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="private" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Are the dynamic interior rooms private? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_control_entity">
        <xs:annotation>
          <xs:documentation>
            Create a control entity for the specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="createnpc" />
          <xs:attributeGroup ref="createnpc" />
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="post" type="controlpostexprlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_npc_from_template">
        <xs:annotation>
          <xs:documentation>
            Create a NPC from a NPC template on an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" use="optional" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Object containing the NPC template. If 'slot' not provided, NPC will attempt to be placed on 'object'
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="template" type="expression" use="required" />
          <xs:attribute name="owner" type="faction" use="required" />
          <xs:attribute name="slot" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Room slot
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="required" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Is the npc required to be successfully created and placed in a room? (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_npc_template">
        <xs:annotation>
          <xs:documentation>
            Create a NPC template and place it on an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" use="optional" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="otherobject" type="object" use="optional">
            <xs:annotation>
              <xs:documentation>
                Other object to contain an existing template if 'template' is prodived. If 'otherobject' is not provided, default to 'object'
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="entity" type="object" use="optional">
            <xs:annotation>
              <xs:documentation>
                NPC to use as a base when creating the template - Must be provided if 'template' or 'macro' is not
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="template" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Existing NPC template to base when creating the template (taken from either 'object' or 'otherobject' if provided) - Must be provided if 'entity' or 'macro' is not
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Macro of the new NPC template - Must be provided if 'entity' or 'template' is not
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="role" type="entityroleexprlookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Entity role this template will be set to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_npc_template">
        <xs:annotation>
          <xs:documentation>
            Remove a NPC template from an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="template" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cutscene_event">
        <xs:annotation>
          <xs:documentation>
            Send an event to a running cutscene
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="key" type="cutscenekey" use="required" />
          <xs:attribute name="event" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Event string that is sent to the cutscene
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="debug_text">
        <xs:annotation>
          <xs:documentation>
            Output debug text
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="text" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Text
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="context" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Include the context of this debug_text (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="filter">
            <xs:annotation>
              <xs:documentation>
                Debug output filter (optional, default is scripts)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="error" />
                <xs:enumeration value="general" />
                <xs:enumeration value="scripts" />
                <xs:enumeration value="scripts_verbose" />
                <xs:enumeration value="economy_verbose" />
                <xs:enumeration value="combat" />
                <xs:enumeration value="savegame" />
                <xs:enumeration value="none" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="debug_to_file">
        <xs:annotation>
          <xs:documentation>
            Output debug text to logfile in game\logs folder under My Documents\Egosoft. Text will only be logged to a file if the game has been started with parameter -scriptlogfiles !
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="text" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Text
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Filename (required, allowed extensions: .txt, .csv, .log and .xml - otherwise .txt is appended automatically.)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="directory" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sub-Directory of logs folder (optional, defaults to blank)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="append" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Controls whether the text should be appended to an existing logfile of the same name or overwrite and create a new file (optional, defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="output" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Controls whether the text should also be written to the regular 'scripts' debug output (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="deplete_yield">
        <xs:annotation>
          <xs:documentation>
            Deplete yield for a certain ware in a zone of a specific region. If container is provided, attempt to add the wares to it (which may affect the deleted amount)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="1" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="sector" type="object" use="required" />
          <xs:attribute name="container" type="object">
            <xs:annotation>
              <xs:documentation>
                If provided, the wares will attempt to be added to the container object. The wares successfully transferred will then be depleted from the region
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="object" use="required" />
          <xs:attribute name="amount" type="lvaluename" use="required" >
            <xs:annotation>
              <xs:documentation>
                Amount to be drained from the region, this value will contain the actual amount that was drained after the command has been executed
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_highest_resource_yield">
        <xs:annotation>
          <xs:documentation>
            Get the highest local resource yield in a sector
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The ware for which to get the highest yield
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="yieldname" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The name of the yield definition (see libraries/regionyields.xml for valid values)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="sector" use="required">
            <xs:annotation>
              <xs:documentation>
                Where to look for the resource in.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                The highest yield value (total amount in a box with 32km long edges)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_resource_gatherrate">
        <xs:annotation>
          <xs:documentation>
            Determine rate at which the refobject can drain resources from the supplied region in the specified zone (averaged using available colletector drones)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="1" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="sector" type="object" use="required" />
          <xs:attribute name="ware" type="object" use="required" />
          <xs:attribute name="refobject" type="object" use="required" />
          <xs:attribute name="name" type="lvaluename" use="required" >
            <xs:annotation>
              <xs:documentation>
                Rate at which the specified resource can be drained from the region by the refobject (float)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_anomaly_destination">
        <xs:annotation>
          <xs:documentation>
            Add an anomaly as a set destination of another. The destination will be picked at random on transition.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="anomaly" type="object" use="required" />
          <xs:attribute name="destination" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="destroy_object">
        <xs:annotation>
          <xs:documentation>
            Destroy specified object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="explosion" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Show explosion effect? Default is false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="destroy_group">
        <xs:annotation>
          <xs:documentation>
            Destroy specified group
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="group" type="group" use="required" />
          <xs:attribute name="explosion" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Show explosion effect? Default is false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="restore_object">
        <xs:annotation>
          <xs:documentation>
            Restore specified object from the wreck state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="hull" type="expression">
            <xs:annotation>
              <xs:documentation>
                The hull value to set after restoring the object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="recursive" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Recursivly repair contained components (default = false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="disable_collisions_between">
        <xs:annotation>
          <xs:documentation>
            Disable collisions between the object and the target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="targetcomponent" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="disable_collision_response">
        <xs:annotation>
          <xs:documentation>
            Does all collision checks but disables all reaction to the checks = no collision. Only works for objects in visible attention.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="dock">
        <xs:annotation>
          <xs:documentation>
            Dock ship instantly at the pre-selected docking bay (&lt;request_docking&gt; must have been performed successfully before!)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="drop_cargo">
        <xs:annotation>
          <xs:documentation>
            Drop ware from cargo bay (if possible)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="random" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="dropcargo" />
        </xs:complexType>
      </xs:element>

      <xs:element name="drop_illegal_cargo">
        <xs:annotation>
          <xs:documentation>
            Drop all illegal cargo from cargo bay
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="faction" type="faction">
            <xs:annotation>
              <xs:documentation>
                Faction to check ware legality against (optional, if ommitted only wares that are globally illegal will be dropped)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="dropcargo" />
        </xs:complexType>
      </xs:element>

      <xs:element name="drop_illegal_inventory">
        <xs:annotation>
          <xs:documentation>
            Drop all illegal wares from entity inventory
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="faction" type="faction">
            <xs:annotation>
              <xs:documentation>
                Faction to check ware legality against (optional, if ommitted only wares that are globally illegal will be dropped)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="dropcargo" />
        </xs:complexType>
      </xs:element>

      <xs:element name="drop_inventory">
        <xs:annotation>
          <xs:documentation>
            Drop ware from inventory (if possible)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="random" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attributeGroup ref="dropcargo" />
        </xs:complexType>
      </xs:element>

      <xs:element name="eject_npcs">
        <xs:annotation>
          <xs:documentation>
            Eject all NPCs from the object (they will use escape pods. Cannot be used for ship_xs!)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="eject_people">
        <xs:annotation>
          <xs:documentation>
            Eject all people (passengers) from the object (they will use escape pods. Cannot be used for ship_xs!)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="max" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Maximum number of people to eject (eject all if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="enable_collisions_between">
        <xs:annotation>
          <xs:documentation>
            Disable collisions between the object and the target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="targetcomponent" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_asteroid_in_cluster">
        <xs:annotation>
          <xs:documentation>
            Find asteroid in cluster near specified position
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cluster" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Cluster
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="refobject" type="expression">
            <xs:annotation>
              <xs:documentation>
                Reference object or space (defaults to cluster if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="canpickup" type="boolean" >
            <xs:annotation>
              <xs:documentation>
                Whether this should return a rock that can be collected or an asteroid that needs to be broken up first
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean" >
            <xs:annotation>
              <xs:documentation>
                If true the command will return a list of asteroids and will automatically do a view check, see viewangle and maxdistance attributes!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="viewangle" type="expression" >
            <xs:annotation>
              <xs:documentation>
                If multiple is true this controls the forward angle to see if asteroids are in range (defaults to 30Â°)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxdistance" type="expression" >
            <xs:annotation>
              <xs:documentation>
                If multiple is true this controls the maximum distance at which asteroids can be found (defaults to 3000m)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Only include asteroids that contain the specified ware as resource (ignored by default)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_buy_offer">
        <xs:annotation>
          <xs:documentation>
            Find matching buy offer(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtrade">
              <xs:attributeGroup ref="action" />
              <xs:attribute name="result" type="lvaluename" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="tradepartner" type="container">
                <xs:annotation>
                  <xs:documentation>
                    object that will do the trading (usually a trade ship)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="buyer" type="container">
                <xs:annotation>
                  <xs:documentation>
                    (optional) only find buy offers on this buyer
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="seller" type="container">
                <xs:annotation>
                  <xs:documentation>
                    (optional) filter for wares that the seller produces (and does not need itself)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="space" type="space">
                <xs:annotation>
                  <xs:documentation>
                    (optional) zone or sector in which to look for offers, defaults to zone of tradepartner
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="excludeempty" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) exclude empty trade offers (amount = 0, desired amount > 0)? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="excludemissions" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) exclude mission trade offers? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="usereservations" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) take reservations into account when checking if a trade is empty? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_closest_octree_object">
        <xs:annotation>
          <xs:documentation>
            Find closest object that has an octree
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="name" type="lvaluename" use="required" />
              <xs:attribute name="refobject" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Reference object for distance check
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_closest_resource">
        <xs:annotation>
          <xs:documentation>
            Find closest resource
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="refposition" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  After evaluation this position will be treated as relative to refobject.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                a single ware or list of wares that needs to be available as a resource in the region
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minamount" type="expression" >
            <xs:annotation>
              <xs:documentation>
                (optional) minimum resource yield that the region/zone needs to provide
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="refobject" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Reference object for distance check
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="wares" type="expression" >
            <xs:annotation>
              <xs:documentation>
                (optional, resultvalue) list of all the resources that can be gathered in the found zone
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the zone where the requested resource can be found (mutually exclusive with sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the sector where the requested resource can be found (mutually exclusive with zone)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="distance" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) distance from the refposition to to the result position
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the position relative to the returned space (sector or zone) where the requested resource can be found
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_closest_station_part">
        <xs:annotation>
          <xs:documentation>
            Find closest part of a station
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findarbitrary" />
              <xs:attribute name="station" type="object" use="required" />
              <xs:attribute name="name" type="lvaluename" use="required" />
              <xs:attribute name="refobject" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Reference object for distance check
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_closest_undiscovered_position">
        <xs:annotation>
          <xs:documentation>
            Find the closest position in a sector that the player hasn't uncovered yet. May return null if none exists.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="1" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  The reference position in sector coordinates.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="rangecenter" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  The center of the valid range in sector coordinates. Required if and only if range is valid.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="sector" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The sector in which to look for undiscovered areas.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="range" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                (optional) The range in which to look for undiscovered hexes. Also requires rangecenter to be valid.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                The center of the nearest undiscovered hex in sector coordinates if there is one within range, null if there is none.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_cluster">
        <xs:annotation>
          <xs:documentation>
            Find matching cluster(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findcluster" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_cluster_in_range">
        <xs:annotation>
          <xs:documentation>
            Find matching cluster(s) within 'maxdistance' jumps of 'object'
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findcluster" />
              <xs:attribute name="append" type="findclusterappend">
                <xs:annotation>
                  <xs:documentation>
                    If true then the found clusters are appended to 'name' list and 'distances' table. Should the values 'name' or 'distances' not be a list or table respectively, they will become one, losing their previous value (default false)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="mindistance" type="expression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Minimum number of Jump Gates or Orbital Accelerators to 'object'
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="maxdistance" type="expression" use="optional">
                <xs:annotation>
                  <xs:documentation>
                    Maximum number of Jump Gates or Orbital Accelerators to 'object' (omit to have no jump distance limit)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="object" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Object or Cluster to check jump distances to
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="distances" type="lvaluename">
                <xs:annotation>
                  <xs:documentation>
                    Table of clusters and distances. Key = cluster, value = jump distance
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_connected_macro">
        <xs:annotation>
          <xs:documentation>
            Search a macro for a connected macro or macros, optionally of a certain type.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The name of the variable where the result should be saved.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="expression" use="required" />
          <xs:attribute name="class" type="expression">
            <xs:annotation>
              <xs:documentation>
                Add a class filter to the search so that only children of a certain class are returned. If not provided, all children will be returned.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="findmultiple" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_room">
        <xs:annotation>
          <xs:documentation>
            Find matching room(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findroom" />
              <xs:attribute name="object" type="object" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_dockingbay">
        <xs:annotation>
          <xs:documentation>
            Find matching dock(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="find" />
              <xs:attribute name="object" type="object" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_dockingbay_for_trade">
        <xs:annotation>
          <xs:documentation>
            Find dockingbay for trade
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="tradepartner" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Trader ship
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tradeoffer" type="tradeoffer" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_gravidar_contact">
        <xs:annotation>
          <xs:documentation>
            Find gravidar contact(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="object" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Scanning object
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_signalleak_location">
        <xs:annotation>
          <xs:documentation>
            Find signal leak locations at an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="append" type="findappend" />
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="required" type="findrequired" />
          <xs:attribute name="container" type="object" use="required" />
          <xs:attribute name="excludefilled" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Do not include slots currently filled by a signal leak (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_npc_slot">
        <xs:annotation>
          <xs:documentation>
            Find npc slot in an object, walkable module or room
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="append" type="findappend" />
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Container or room
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="post" type="controlpostexprlookup" use="optional" />
          <xs:attribute name="role" type="entityroleexprlookup" use="optional" />
          <xs:attribute name="tags" type="expression" use="optional" />
          <xs:attribute name="excludefilled" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Do not include slots currently reserved by a NPC (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="excludeblocked" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Do not include slots which are blocked by obstacles such as props (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_npc_waypoint">
        <xs:annotation>
          <xs:documentation>
            Find npc waypoint in an object, walkable module or room
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="append" type="findappend" />
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Container or room
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression" use="optional" />
          <xs:attribute name="excludeblocked" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Do not include slots which are blocked by obstacles such as props (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_crate_slot">
        <xs:annotation>
          <xs:documentation>
            Find a crate slot in a walkable module or room
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="append" type="findappend" />
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Container or room
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression" use="optional" />
          <xs:attribute name="excludefilled" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Do not include slots currently taken by a crate (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_object_component">
        <xs:annotation>
          <xs:documentation>
            Find matching component(s) contained in an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findarbitrary" />
              <xs:attribute name="object" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Parent object for component search
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attribute name="includeobjects" type="findincludeobjects" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_resource">
        <xs:annotation>
          <xs:documentation>
            Find resource (random location in cluster)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                a single ware or list of wares that needs to be available as a resource in the region
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minamount" type="expression" >
            <xs:annotation>
              <xs:documentation>
                (optional) minimum resource yield that the region/zone needs to provide
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="refobject" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Reference object for distance check or a cluster for all contained regions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="snap" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                (optional) snap result position to the size of a region grid (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="wares" type="expression" >
            <xs:annotation>
              <xs:documentation>
                (optional, resultvalue) list of all the resources that can be gathered in the found zone. If used with multiple="true", gives a list of lists of resources synchronized with the zone list from $zone.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the zone where the requested resource can be found (mutually exclusive with sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the sector where the requested resource can be found (mutually exclusive with zone)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                (resultvalue) the position relative to the returned space (sector or zone) where the requested resource can be found
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="check_object">
        <xs:annotation>
          <xs:documentation>
            Check an object against filters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findarbitrary" />
              <!-- <xs:attribute name="space" type="space" /> -->
              <xs:attribute name="object" type="expression" use="required"/>
              <xs:attribute name="result" type="lvaluename" use="required"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="end_repair_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Ends all repair mass traffic networks for an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time the network should end (defaults to 'as soon as possible' if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_active_repair_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Find a repair mass traffic network for an object that doesn't have an end time set already
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The ID of the mass traffic network - IMPORTANT: this will become invalid if a savegame is loaded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_pos_in_mass_traffic_at_time">
        <xs:annotation>
          <xs:documentation>
            Find position in mass traffic network where the object would be at the specified time (only works for ships originating from mass traffic!)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="object" type="ship" use="required" />
          <xs:attribute name="time" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_random_pos_in_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Find random position in mass traffic network
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="start" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimal time after beginning of path
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="end" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimal time until end of path
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_object">
        <xs:annotation>
          <xs:documentation>
            Find matching object(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_sector">
        <xs:annotation>
          <xs:documentation>
            Find matching sector(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findsector" />
              <xs:attribute name="space" type="space" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_sell_offer">
        <xs:annotation>
          <xs:documentation>
            Find matching sell offer(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchtrade">
              <xs:attributeGroup ref="action" />
              <xs:attribute name="result" type="lvaluename" use="required" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="tradepartner" type="container">
                <xs:annotation>
                  <xs:documentation>
                    object that will do the trading (usually a trade ship)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="buyer" type="container">
                <xs:annotation>
                  <xs:documentation>
                    (optional) filter for wares that the buyer can use(and does not produce itself)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="seller" type="container">
                <xs:annotation>
                  <xs:documentation>
                    (optional) only find sell offers on this seller
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="space" type="space">
                <xs:annotation>
                  <xs:documentation>
                    (optional) zone or sector in which to look for offers, defaults to zone of tradepartner
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="excludeempty" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) exclude empty trade offers (amount = 0, desired amount > 0)? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="excludemissions" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) exclude mission trade offers? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="usereservations" type="boolean">
                <xs:annotation>
                  <xs:documentation>
                    (optional) take reservations into account when checking if a trade is empty? (defaults to true)
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_ship">
        <xs:annotation>
          <xs:documentation>
            Find matching ship(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findship" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="recursive" type="findrecursive" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_station">
        <xs:annotation>
          <xs:documentation>
            Find matching station(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findstation" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_gate">
        <xs:annotation>
          <xs:documentation>
            Find matching gate(s)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="find" />
              <xs:attribute name="space" type="space" use="required" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="find_tradeoffer_parking_slot">
        <xs:annotation>
          <xs:documentation>
            Find tradeoffer location parking ComponentSlot
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" >
            <xs:annotation>
              <xs:documentation>
                Object (container) that has the tradeoffer locations.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="refobject" type="object" >
            <xs:annotation>
              <xs:documentation>
                (optional) If supplied the list of slots will be sorted by distance to refobject.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="trade" type="tradeoffer" >
            <xs:annotation>
              <xs:documentation>
                (optional) If supplied the slot for this trade will be preferred.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="includeoccupied" type="boolean" >
            <xs:annotation>
              <xs:documentation>
                Include slots that are marked as occupied (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_zone">
        <xs:annotation>
          <xs:documentation>
            Find matching zone(s) - includes highways by default
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findzone" />
              <xs:attribute name="space" type="space" />
              <xs:attribute name="append" type="findappend" />
              <xs:attribute name="multiple" type="findmultiple" />
              <xs:attribute name="required" type="findrequired" />
              <xs:attribute name="name" type="lvaluename" />
              <xs:attribute name="groupname" type="groupname" />
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="fire_turret">
        <xs:annotation>
          <xs:documentation>
            Fire turret
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="turret" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Turret
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_attackstrength">
        <xs:annotation>
          <xs:documentation>
            Get attack strength against target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required" />
          <xs:attribute name="usedrones" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Include damage of defence drones (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_character_definition">
        <xs:annotation>
          <xs:documentation>
            Get character macro or reference by filtering via category parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="race" type="raceexprlookup">
            <xs:annotation>
              <xs:documentation>
                Race
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result macro (list if 'multiple' is true. Less performant than 'reference')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reference" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result character reference (list if 'multiple' is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_docking_approach_pos">
        <xs:annotation>
          <xs:documentation>
            Get docking approach pos
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="dock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Docking bay component slot (find using &lt;find_dockingbay&gt;)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="lvaluename" use="required" />
          <xs:attribute name="rotation" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_gate_approach_pos">
        <xs:annotation>
          <xs:documentation>
            Get gate approach pos
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="gate" type="expression" use="required" >
            <xs:annotation>
              <xs:documentation>
                Jumpgate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="lvaluename" use="required" />
          <xs:attribute name="rotation" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_global_path">
        <xs:annotation>
          <xs:documentation>
            Get global path from start to end (multiple=0 returns first value. multiple=1 returns whole path as lists)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="start" type="componentoffset" />
            <xs:element name="end" type="componentoffset" />
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="component" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                (Yields a list of components when attribute multiple is used, otherwise first value)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="offset" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                (Yields a list of positions when attribute multiple is used, otherwise first value)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Return the whole path or the first pair of Component and offset?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="uselocalhighways" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the path should include local highway entrance/exit points or not (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_jump_path">
        <xs:annotation>
          <xs:documentation>
            Get jump path from start to end (multiple=0 returns first value. multiple=1 returns whole path as lists)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="start" type="sector" use="required" />
          <xs:attribute name="end" type="sector" use="required" />
          <xs:attribute name="component" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                (Yields a list of components when attribute multiple is used, otherwise first value)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Return the whole path or the first component?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_closest_highway_offset">
        <xs:annotation>
          <xs:documentation>
            Get the internal highway offset which is closest to this position
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="highway" type="zone" use="required" />
          <xs:attribute name="space" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Co-ordinate space for the position (can be a space or object)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_safe_pos">
        <xs:annotation>
          <xs:documentation>
            Get a safe position in a zone or sector
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="zone" type="zone">
            <xs:annotation>
              <xs:documentation>
                Required if using zone coordinates (takes precedence over sector if both are specified), result will be in zone coordinates relative to this zone.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="sector">
            <xs:annotation>
              <xs:documentation>
                Required if using sector coordinates (ignored if zone is specified), result will be in sector coordinates relative to this sector.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="safepos" />
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_satellite_coverage">
        <xs:annotation>
          <xs:documentation>
            Get the percentage of hexes in an area that are being covered by player-owned satellites
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="1" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  The center of the target area.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="radius" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The radius of the target area
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="sector" use="required">
            <xs:annotation>
              <xs:documentation>
                The sector the position is relative to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_ship_definition">
        <xs:annotation>
          <xs:documentation>
            Get ship macro or reference by filtering via category parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="size" type="shipsizeclasslookup">
            <xs:annotation>
              <xs:documentation>
                Ship size or list of sizes
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result macro (list if 'multiple' is true. Less performant than 'reference')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reference" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result ship reference (list if 'multiple' is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_module_definition">
        <xs:annotation>
          <xs:documentation>
            Get module macro or reference by filtering via category parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="race" type="raceexprlookup">
            <xs:annotation>
              <xs:documentation>
                Race
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression">
            <xs:annotation>
              <xs:documentation>
                Production ware
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="set" type="expression">
            <xs:annotation>
              <xs:documentation>
                The set from which the module should be taken. If used with reference (as opposed to macro), this attribute will have no effect.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result macro (list if 'multiple' is true. Less performant than 'reference')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reference" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result module reference (list if 'multiple' is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_module_set_macro">
        <xs:annotation>
          <xs:documentation>
            Get station macro of a module set
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="race" type="raceexprlookup">
            <xs:annotation>
              <xs:documentation>
                Module set race
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="expression">
            <xs:annotation>
              <xs:documentation>
                Module set type string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="set" type="expression">
            <xs:annotation>
              <xs:documentation>
                Module set ID (takes preference over 'race' or 'type')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                Result macro
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_construction_plan">
        <xs:annotation>
          <xs:documentation>
            Get construction plan by filtering via category parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="race" type="raceexprlookup">
            <xs:annotation>
              <xs:documentation>
                Race
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                Result construction plan (list if 'multiple' is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_room_definition">
        <xs:annotation>
          <xs:documentation>
            Get room macro or reference by filtering via category parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="race" type="raceexprlookup">
            <xs:annotation>
              <xs:documentation>
                Race
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="multiple" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Find multiple definitions? If true, the result values return a list. If false (default), the results returns a single value.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result macro (list if 'multiple' is true. Less performant than 'reference')
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="doors" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result doors (list of macroslots for a single macro, a list of lists of macroslots for multiple macros, nothing if only references are returned)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reference" type="lvaluename" use="optional">
            <xs:annotation>
              <xs:documentation>
                Result module reference (list if 'multiple' is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_target_points">
        <xs:annotation>
          <xs:documentation>
            Get position list of matching target points from a macro
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the target points
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_waypoint_path">
        <xs:annotation>
          <xs:documentation>
            Get position list of matching waypoints from a component, starting from a start waypoint and progressing along the links until the end is reached
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="space" type="expression" use="required" />
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the waypoints
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="start_tags" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the start waypoint (matched in addition to the other required tags, if they are defined)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="posname" type="lvaluename" use="required" />
          <xs:attribute name="rotname" type="lvaluename" />
          <xs:attribute name="radiusname" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_text_ids_in_range">
        <xs:annotation>
          <xs:documentation>
            Get list of text IDs in given range on a TextDB page
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="page" type="page" use="required" />
          <xs:attribute name="start" type="expression">
            <xs:annotation>
              <xs:documentation>
                Lower bound of text ID range (default is 0)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="end" type="expression">
            <xs:annotation>
              <xs:documentation>
                Upper bound of text ID range (default is no upper bound). Note that text IDs outside the signed integer range cannot be found.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="factor" type="expression">
            <xs:annotation>
              <xs:documentation>
                Factor used as a filter for found text IDs. The list will contain only text IDs that are multiples of this factor. Default is no factor.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_trade_parking_pos">
        <xs:annotation>
          <xs:documentation>
            Get trade parking position (for L and XL trade ships that cannot dock directly), optionally gets the quadrant of the ship where the traffic lanes are.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="tradedock" type="expression">
            <xs:annotation>
              <xs:documentation>
                Trade dock component slot (find using &lt;find_tradeoffer_parking_slot&gt;)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="approach" type="boolean" >
            <xs:annotation>
              <xs:documentation>
                Return "approach" position (defaults to false). If false, this is the position at which masstraffic lanes snap to the tradeoffer location for optimal connection.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space that the resulting position and rotation should be relative to (optional, defaults to the tradeoffercomponent)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="lvaluename" use="required" />
          <xs:attribute name="rotation" type="lvaluename" />
          <xs:attribute name="quadrant" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_ware_definition">
        <xs:annotation>
          <xs:documentation>
            Get a single or multiple definitions for wares from the WareDB.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="factionexprlookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The faction or factions for which the wares should be defined - this will filter the result down to what this faction can produce.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                A filtered list of wares.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_ware_reservation">
        <xs:annotation>
          <xs:documentation>
            Get reserved space for ware (optionally object specific) on an object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="container" use="required">
            <xs:annotation>
              <xs:documentation>
                The container to query for reserved amounts of the specified ware.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" use="required">
            <xs:annotation>
              <xs:documentation>
                Reservation type
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="buy">
                  <xs:annotation>
                    <xs:documentation>
                      Buy reservations only.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="sell">
                  <xs:annotation>
                    <xs:documentation>
                      Sell reservations only.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="reserver" type="object">
            <xs:annotation>
              <xs:documentation>
                Only count reservations for a specific object. If 'mission' is true, the object must be player owned and will return all player owned mission reservations (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mission" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the reservation is for a mission trade (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="supplies" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the reservation is for a supply trade (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="virtual" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether to look at the "real" or the "virtual" dataset - virtual reservations are IGNORED for trades. (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="ware" use="required" />
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The amount that is reserved for this reserver (or all reservers).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_zone_exit_pos">
        <xs:annotation>
          <xs:documentation>
            Get a safe position for leaving a zone towards a destination (destination must be in same sector!)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="destination" type="object" use="required" />
          <xs:attribute name="radius" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Radius to indicate necessary space required for a safe position
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="position" type="lvaluename" use="required" />
          <xs:attribute name="rotation" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_zone_at_position">
        <xs:annotation>
          <xs:documentation>
            Get the zone at this sector position (may return null if none exists)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="position" />
          <xs:attribute name="sector" type="sector" use="required" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="precache_hint">
        <xs:annotation>
          <xs:documentation>
            Hint an object / zone ( precaching of assets )
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object">
            <xs:annotation>
              <xs:documentation>
                Object to prehint
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="zone">
            <xs:annotation>
              <xs:documentation>
                Zone to prehint
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="precache_actor_animation_hint">
        <xs:annotation>
          <xs:documentation>
            Hint an actor's animation sequence ( precaching of assets )
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="type" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Animation sequence type
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="behavior" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Animation sequence behavior
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="is_in_quadrant">
        <xs:annotation>
          <xs:documentation>
            Check if target object is in all specified quadrants of object, returns false if target is not detected at all
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Scanning object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object to look for
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
          <xs:attribute name="up" type="boolean" />
          <xs:attribute name="down" type="boolean" />
          <xs:attribute name="left" type="boolean" />
          <xs:attribute name="right" type="boolean" />
          <xs:attribute name="front" type="boolean" />
          <xs:attribute name="back" type="boolean" />
        </xs:complexType>
      </xs:element>

      <xs:element name="join_formation">
        <xs:annotation>
          <xs:documentation>
            Join formation. No effect if there is no formation in the object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object joining the formation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="leader" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Formation leader
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_countermeasures">
        <xs:annotation>
          <xs:documentation>
            Launch countermeasures against enemy missile locks or incoming missiles
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="result" type="lvalueexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Whether a new batch of countermeasures has been queued for launch
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_lasertower">
        <xs:annotation>
          <xs:documentation>
            Launch laser tower
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="deployablecategorylookup">
            <xs:annotation>
              <xs:documentation>
                Deployable category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_mine">
        <xs:annotation>
          <xs:documentation>
            Launch mine
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="deployablecategorylookup">
            <xs:annotation>
              <xs:documentation>
                Deployable category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_navbeacon">
        <xs:annotation>
          <xs:documentation>
            Launch navigation beacon
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="deployablecategorylookup">
            <xs:annotation>
              <xs:documentation>
                Deployable category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_resourceprobe">
        <xs:annotation>
          <xs:documentation>
            Launch resource probe
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="deployablecategorylookup">
            <xs:annotation>
              <xs:documentation>
                Deployable category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_satellite">
        <xs:annotation>
          <xs:documentation>
            Launch satellite
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="deployablecategorylookup">
            <xs:annotation>
              <xs:documentation>
                Deployable category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_drone">
        <xs:annotation>
          <xs:documentation>
            Launch drone
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="category" type="unitcategorylookup">
            <xs:annotation>
              <xs:documentation>
                Unit category from which macro will be selected if not supplied
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="random"/>
          <xs:attribute name="name" type="lvaluename" />
          <xs:attribute name="groupname" type="groupname" />
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_masstraffic_drone">
        <xs:annotation>
          <xs:documentation>
            Launch a ship of the specified ship group from masstraffic docks. Will attempt to avoid docks that are in use (e.g. while trading)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The drone that was launched (if any)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object launching the drone.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="category" type="unitcategorylookup" use="required" >
            <xs:annotation>
              <xs:documentation>
                Unit category from which the used macro will be selected
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression">
            <xs:annotation>
              <xs:documentation>
                The target which is to be picked up by the drone (optional, used to determine ideal launch direction)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression">
            <xs:annotation>
              <xs:documentation>
                Ware to be transported, used to find best matching macro from shipgroup (optional, ignored if pickup=true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pickup" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Is this a pickup run? If true, an empty transport ship will be launched (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_war_drones">
        <xs:annotation>
          <xs:documentation>
            Launch war drones. This uses mass traffic, so both objects need to be stationary for the whole duration.
            Ensure that you kill the resulting mass traffic network when you're done with it, and wait until it's finished before moving away.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The newly created mass traffic network.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object launching the drones.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The target which is to be attacked by drones. Must have a nav mesh.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                The amount of drones to be launched. If undefined, all available units will be used.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="launch_repair_drones">
        <xs:annotation>
          <xs:documentation>
            Launch repair drones. This uses mass traffic, so both objects need to be stationary for the whole duration.
            Ensure that you kill the resulting mass traffic network when you're done with it, and wait until it's finished before moving away.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The ID of the newly created mass traffic network - IMPORTANT: this will become invalid if a savegame is loaded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The object launching the drones.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The target which is to be repaired by repair drones. Must have a nav mesh.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="components" type="list" use="required">
            <xs:annotation>
              <xs:documentation>
                List of components that need to be repaired
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                The amount of drones to be launched. If undefined, all available units will be used.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="leave_formation">
        <xs:annotation>
          <xs:documentation>
            Leave formation as a formation WingMan. No effect if the object is not a formation WingMan
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="open_conversation_menu">
        <xs:annotation>
          <xs:documentation>
            Open a menu as part of a conversation, which will be suspended until the menu is closed
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="menu" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of menu to be opened as part of the conversation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                First menu parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param2" type="expression">
            <xs:annotation>
              <xs:documentation>
                Second menu parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="open_menu">
        <xs:annotation>
          <xs:documentation>
            Open a menu
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="menu" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of menu to be opened
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                First menu parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param2" type="expression">
            <xs:annotation>
              <xs:documentation>
                Second menu parameter
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="pickup_target">
        <xs:annotation>
          <xs:documentation>
            Pick up a target object (connect it to the ship)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ship" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Ship to which the picked up object will be connected
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="targetobject" use="required" />
          <xs:attribute name="prepare" type="boolean" >
            <xs:annotation>
              <xs:documentation>
                Prepare the pickup process, this makes sure the target stops rotating and is properly aligned for pickup (optional, defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="sort_collectables_by_value">
        <xs:annotation>
          <xs:documentation>
            Sort a list of collectables by price value. Note: Sorting collectables with identical price values will retain their relative order from the input list. Consider shuffling the collectables list first.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Collecting object, used to filter out collectables which can't be stored
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="collectables" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of collectables
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Result list of sorted collectables
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="play_cutscene">
        <xs:annotation>
          <xs:documentation>
            Start playing a cutscene
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="interaction" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Player interaction event
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="interaction" />
              </xs:complexType>
            </xs:element>
            <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Parameter referenced by the cutscene, must have either object or number attribute
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="namestring" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="object" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Reference object
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="number" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Numeric value
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="key" type="cutscenekey" use="required" />
          <xs:attribute name="targetmonitor" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Show cutscene in target monitor?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sound" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Sound ID name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="caption" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional caption text string. Requires targetmonitor=&quot;true&quot;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="timeout" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximal duration of target monitor cutscene. If supplied, the cutscene will end after the timeout. Requires targetmonitor=&quot;true&quot;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="rendertarget" type="expression">
            <xs:annotation>
              <xs:documentation>
                Name of render target on which the cutscene should be played (ignored for target monitor cutscenes)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Name of the value that will receive the cutscene ID as result. This can be used as cutscene argument in &lt;stop_cutscene&gt;. If &lt;play_cutscene&gt; fails the result may be null in some cases.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="raise_lua_event">
        <xs:annotation>
          <xs:documentation>
            Raise an event to a registered callback in a lua script.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of the event
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter. Has to be a string, number or component.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_object_account">
        <xs:annotation>
          <xs:documentation>
            Removes an account from the object if any, so the object will use the faction's account instead. Optionally the remaining money can be transferred to the faction account.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="transfer" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Transfer remaining money to faction account? Defaults to false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_actor_from_room">
        <xs:annotation>
          <xs:documentation>
            Remove NPC actor from the room it is in (e.g. landing platform)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_from_group">
        <xs:annotation>
          <xs:documentation>
            Remove an object from a group
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="group" type="group" use="required" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_object_commander">
        <xs:annotation>
          <xs:documentation>
            Remove the commander of an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_representative">
        <xs:annotation>
          <xs:documentation>
            Remove faction representative
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_value">
        <xs:annotation>
          <xs:documentation>
            Remove a variable
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_walk_path">
        <xs:annotation>
          <xs:documentation>
            Check whether a NPC can walk do a destination
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="start" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Addional offset to the start position, either the 'start' slot/component or the NPCs position if 'start' was not provided
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="end" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Addional offset to the end slot/component position
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="start" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object or component slot to start from. Combined with 'start' position. (optional, NPC uses current position if not provided)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="end" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object or component slot destination. Combined with 'end' position.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="checkstate" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Check if the NPC is currently able to move. NPCs can not move if in low attention or are hidden. (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_weapon_active">
        <xs:annotation>
          <xs:documentation>
            Check whether the weapon is currently active
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="check_weapon_installed">
        <xs:annotation>
          <xs:documentation>
            Check whether the weapon is installed/available
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="request_docking">
        <xs:annotation>
          <xs:documentation>
            Request docking procedure for ship, result is true if the request was queued. Check this.ship.assigneddock to see if the request was granted.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="container" type="container" use="required" />
          <xs:attribute name="highpriority" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the ship should be using a high priority dock, defaults to false (will fall back to the other kind of dock if no matching ones exist)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="requirebuilding" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship must use a dock that supports building, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="requiretrading" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship must use a dock that supports trading, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowplayeronly" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship may also use a dock that only allows the player to dock, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureronly" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship must use a dock that is only meant for venturing, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureplatform" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Specific venture platform with which venture dock must be associated (can be null)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="queuedresult" type="lvaluename" use="required" />
          <xs:attribute name="grantedresult" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="request_undocking">
        <xs:annotation>
          <xs:documentation>
            Request undocking procedure for ship, result is true if the request was queued. If the ship is docked, this is always either granted or queued.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="highpriority" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the ship should be using a high priority dock, defaults to false (will fall back to the other kind of dock if no matching ones exist)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowplayeronly" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship may also use a dock that only allows the player to dock, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureronly" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the ship must use a dock that is exclusively meant for venturing (only applies when ship is coming out of storage), defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureplatform" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Specific venture platform with which venture dock must be associated (can be null)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="queuedresult" type="lvaluename" use="required" />
          <xs:attribute name="grantedresult" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="request_retrieval">
        <xs:annotation>
          <xs:documentation>
            Request this ship to be taken out of internal ship storage, result is true if the request was queued. If the ship is docked, this is always either granted or queued.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="highpriority" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the ship should be using a high priority dock, defaults to false (will fall back to the other kind of dock if no matching ones exist)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="allowplayeronly" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Whether the ship may also use a dock that only allows the player to dock, defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureronly" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the ship must use a dock that is exclusively meant for venturing (only applies when ship is coming out of storage), defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ventureplatform" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Specific venture platform with which venture dock must be associated (can be null)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="queuedresult" type="lvaluename" use="required" />
          <xs:attribute name="grantedresult" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_docking_request">
        <xs:annotation>
          <xs:documentation>
            Remove assigned dock or docking request for ship (the latter only works if the container is specified)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="container" type="container" />
          <xs:attribute name="immediate" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether the request should be processed immediately (defaults to false). If not instant the assignment will be removed as soon as the ship is at a safe distance, which is defined in the dockingbay macro.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_undocking_request">
        <xs:annotation>
          <xs:documentation>
            Remove undocking request for ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_retrieval_request">
        <xs:annotation>
          <xs:documentation>
            Remove retrieval request for ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_mass_traffic_quota">
        <xs:annotation>
          <xs:documentation>
            Add a quota to a zone's main mass traffic network. Must supply either a macro or ship group. If no end time is supplied you need to store it and stop the quota when you no longer need it.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="quota" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The ID of the created quota
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="start" type="expression">
            <xs:annotation>
              <xs:documentation>
                The station where the mass traffic ships should start
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="end" type="expression">
            <xs:annotation>
              <xs:documentation>
                The station where the mass traffic ships should end
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="starttime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time the quota should start (defaults to now if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time the quota should end (defaults to never if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macro" type="macro" />
          <xs:attribute name="group" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Ship group for random macro selection
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_mass_traffic_quota">
        <xs:annotation>
          <xs:documentation>
            Make a mass traffic quota stop
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="quota" type="expression" use="required" />
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time the quota should end at the earliest (defaults to now if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_macros_in_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Get all macros currently active in a zone's main mass traffic network
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="macros" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                The list of macros in the network
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amounts" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The amount of ships with each macro in the network
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="get_units_in_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Get all units of a category currently active in a mass traffic network
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="masstraffic" type="masstraffic" use="required" />
          <xs:attribute name="category" type="unitcategorylookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The category of units to get
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amounts" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                (A list with the index being the 'mk' of the unit)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="request_mass_traffic_ship">
        <xs:annotation>
          <xs:documentation>
            Request a ship to be spawned in a zone's mass traffic network
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="zone" type="zone" use="required" />
          <xs:attribute name="start" type="expression">
            <xs:annotation>
              <xs:documentation>
                The station where the mass traffic ship should start
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="end" type="expression">
            <xs:annotation>
              <xs:documentation>
                The station where the mass traffic ship should end
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="mintime" type="expression">
            <xs:annotation>
              <xs:documentation>
                Minimum flight time
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="group" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Ship group for random macro selection (taken from zone's master quota if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="request_boarding_support">
        <xs:annotation>
          <xs:documentation>
            Request boarding support by the player (triggers an MD cue to select a mission)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="boarder" type="entity" use="required" />
          <xs:attribute name="boarded" type="object" use="required" />
          <xs:attribute name="forcedmission" type="expression">
            <xs:annotation>
              <xs:documentation>
                Forced mission type, prevents random selection (see md/BoardingSupport.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="request_gate">
        <xs:annotation>
          <xs:documentation>
            Request from a ship to lock the Gate for going through (Use 'unlock' true to unlock)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" >
            <xs:annotation>
              <xs:documentation>
                Ship requesting the Gate
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="gate" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Gate to lock (or unlock if 'unlock' = true) for the ship
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unlock" type="expression" >
            <xs:annotation>
              <xs:documentation>
                Unlock the Gate for this ship. Safe to call if not requested befor (Optional, Default: false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" >
            <xs:annotation>
              <xs:documentation>
                Whether or not the Gate request is successful
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="notify_boarding_support_failed">
        <xs:annotation>
          <xs:documentation>
            Notify the boarder that boarding support by the player failed
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="boarder" type="entity" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="notify_boarding_support_succeeded">
        <xs:annotation>
          <xs:documentation>
            Notify the boarder that boarding support by the player was successful
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="boarder" type="entity" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="notify_universe_generated">
        <xs:annotation>
          <xs:documentation>
            Notify interested parties that universe generation is complete
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_boarding_operation">
        <xs:annotation>
          <xs:documentation>
            Create a boarding operation and add it as an inbound operation on the target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="target" type="object" use="required" />
          <xs:attribute name="faction" type="faction" use="required" />
          <xs:attribute name="approach" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Threshold value to launch boarding pods (0 - 100) - Actual behaviour of this value depends on the boarding handler
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="insertion" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Threshold value to begin insertion into the hull (0 - 100) - Actual behaviour of this value depends on the boarding handler
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required">
            <xs:annotation>
              <xs:documentation>
                Result operation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_boarding_attacker">
        <xs:annotation>
          <xs:documentation>
            Add an attacker to the boarding operation and configure their behaviour and use of marines
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="marines" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Amount of marines by skill level to match against role tiers
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="amounts" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      List of amounts (size must match with other lists)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="skills" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      List of skills to help identify people (size must match with other lists)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="attacker" type="object" use="required" />
          <xs:attribute name="behavior" type="boardingbehaviourlookup" use="required" />
          <xs:attribute name="operation" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="dispatch_marines">
        <xs:annotation>
          <xs:documentation>
            Inform the boarding operation that an attacker has dispatched a number of marines to board the target (the creation of marines and activation of their AI behaviour is not handled by this action)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="marines" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Amount of marines by skill level to match against role tiers
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="amounts" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      List of amounts (size must match with other lists)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="skills" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      List of skills to help identify people (size must match with other lists)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="attacker" type="object" use="required" />
          <xs:attribute name="operation" type="expression" use="required" />
          <xs:attribute name="marines" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of marine npc templates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Object which currently contains the marines
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="transfer_marines_from_operation">
        <xs:annotation>
          <xs:documentation>
            Transfer a list of marines from a boarding operation to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to transfer the marines to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="marines" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of NPC templates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="operation" type="expression" use="required" />
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                List of people successfully transferred from otherobject to object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="transfer_marine_to_operation">
        <xs:annotation>
          <xs:documentation>
            Transfer a marine from an object to the internals of a boarding operation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Object containing the marine to transfer
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="template" type="expression" use="required" />
          <xs:attribute name="status" type="marinestatuslookup" use="required" />
          <xs:attribute name="operation" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_marine_status">
        <xs:annotation>
          <xs:documentation>
            Set the status of a marine taking part in a boarding operation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="template" type="expression" use="required" />
          <xs:attribute name="status" type="marinestatuslookup" use="required" />
          <xs:attribute name="operation" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="start_boarding_operation">
        <xs:annotation>
          <xs:documentation>
            Trigger the boarding operation to start, adding AI orders to related ships and firing the 'event_boarding_operation_started' event
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="operation" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="end_boarding_operation">
        <xs:annotation>
          <xs:documentation>
            Force the boarding operation to end, removing it from the target's list of inbound boarding operations
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="operation" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_boarding_phase">
        <xs:annotation>
          <xs:documentation>
            Set the phase of the boarding operation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="operation" type="expression" use="required" />
          <xs:attribute name="phase" type="boardingphaselookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="request_repair">
        <xs:annotation>
          <xs:documentation>
            Request a component to be repaired (only listened to from scripts)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The component to be repaired
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="makepriority" type="boolean" use="required">
            <xs:annotation>
              <xs:documentation>
                Whether repairing another component should wait and this one should start immediately
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_relation_boost">
        <xs:annotation>
          <xs:documentation>
            Reset relation boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="resetobjectboost" />
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_tolerance_boost">
        <xs:annotation>
          <xs:documentation>
            Reset tolerance boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="resetobjectboost" />
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_turret">
        <xs:annotation>
          <xs:documentation>
            Reset turret
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="turret" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Turret
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="resize_list">
        <xs:annotation>
          <xs:documentation>
            Resize a list (if the list grows, it will contain new null values at the end)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="list" type="list" use="required" />
          <xs:attribute name="count" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                New number of elements
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="reward_player">
        <xs:annotation>
          <xs:documentation>
            Reward the player
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <!-- TODO: Remove the "required" if there are alternative reward types -->
          <xs:attribute name="money" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Money reward
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="save_ai_action_state">
        <xs:annotation>
          <xs:documentation>
            Save the state of the current AI script blocking action on the blackboard of an entity that is going to take over control when restarting a script (can be the same entity).
            The AI script actions &lt;wait_for_prev_script&gt; and &lt;finalize_prev_script&gt; will process the information to make sure that the current AI action (e.g. trade) ends in a clean way.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Entity that will receive the AI action state information. To be used when a new script is supposed to start on the entity, aborting the previous entity's script.
                The new script should perform &lt;wait_for_prev_script&gt; and &lt;finalize_prev_script&gt;.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="previous" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Entity from which the AI action state information is retrieved, basically immediately before the entity's script is aborted.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_account">
        <xs:annotation>
          <xs:documentation>
            Assigns an account to the object if the object does not have an own account yet.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="share_object_account">
        <xs:annotation>
          <xs:documentation>
            Tells this object to use the account of otherobject. Optionally can transfer the money in the account to the object supplied as transferto (may be the same as otherobject).
            If otherobject and transferto are invalid / omitted this behaves like &lt;remove_object_account /&gt;
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="otherobject" type="object">
            <xs:annotation>
              <xs:documentation>
                (optional) The object whose account to share, will default to faction account of transferto object if omitted!
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="transferto" type="object">
            <xs:annotation>
              <xs:documentation>
                (optional) The object to which any money in the actors account should be transferred. (money will be lost if omitted)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_max_budget">
        <xs:annotation>
          <xs:documentation>
            Assigns a max budget to an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount max budget is set to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_min_budget">
        <xs:annotation>
          <xs:documentation>
            Assigns a min budget
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount min budget is set to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_roomslot">
        <xs:annotation>
          <xs:documentation>
            Reserve the roomslot for this actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="roomslot" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Component slot to reserve as the ultimate destination
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_roomslot">
        <xs:annotation>
          <xs:documentation>
            Clear the current roomslot of this actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_current_chair">
        <xs:annotation>
          <xs:documentation>
            Set a chair slot as the current chair for this actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="roomslot" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Component slot to set as the chair slot
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_current_chair">
        <xs:annotation>
          <xs:documentation>
            Clear the current chair of this actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="start_actor_walk">
        <xs:annotation>
          <xs:documentation>
            Lets the actor walk to the target (as long as the player can watch it)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="speed" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Speed of the character in m/s
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Component slot to walk to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="roomslot" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Component slot to reserve as the ultimate destination (NPC's current roomslot cleared if invalid)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="start_actor_sequence">
        <xs:annotation>
          <xs:documentation>
            Start an actor's animation sequence
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="type" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Animation sequence type
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="behavior" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Animation sequence behavior (if omitted, uses roomslot tags to decide behaviour)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="transition" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Perform a transition to the next sequence (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="immediate" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Perform an immediate transition to the next sequence (blending from the current one, default is false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_emotion">
        <xs:annotation>
          <xs:documentation>
            Set an actor's emotion morph target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="emotion" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Emotion name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_emotion">
        <xs:annotation>
          <xs:documentation>
            Clear an actor's emotion morph target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_lookat">
        <xs:annotation>
          <xs:documentation>
            Set an actor's lookat target component
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="component" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Target component
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_lookat">
        <xs:annotation>
          <xs:documentation>
            Clear an actor's lookat target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_touch">
        <xs:annotation>
          <xs:documentation>
            Have an actor touch something with hand
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="tags" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lefthand" type="boolean">
            <xs:annotation>
              <xs:documentation>
                false to use right hand (default), true to use left hand
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_touch">
        <xs:annotation>
          <xs:documentation>
            Have an actor untouch something
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="lefthand" type="boolean">
            <xs:annotation>
              <xs:documentation>
                false to use right hand (default), true to use left hand
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_actor_tool">
        <xs:annotation>
          <xs:documentation>
            Attach a tool to an actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Tool Name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lefthand" type="boolean">
            <xs:annotation>
              <xs:documentation>
                false to use right hand (default), true to use left hand
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_actor_tool">
        <xs:annotation>
          <xs:documentation>
            Remove a currently held tool from the actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="lefthand" type="boolean">
            <xs:annotation>
              <xs:documentation>
                false to use right hand (default), true to use left hand
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="transfer_money">
        <xs:annotation>
          <xs:documentation>
            Transfers amount from one entity to another, if possible
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="from" type="entity" use="required" />
          <xs:attribute name="to" type="entity" use="required" />
          <xs:attribute name="amount" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Amount to be transferred
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                Actually transferred amount
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_buildanchor">
        <xs:annotation>
          <xs:documentation>
            Set a buildanchor to the specified buildmodule
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="buildmodule" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Build module to be used (ignored if build processor is supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="buildprocessor" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Build processor to be used (overrides build module if supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Build anchor to be used
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_cockpit_tint">
        <xs:annotation>
          <xs:documentation>
            Sets the cockpit boarder tint for use in certain activities
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="rgbcolour" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_active">
        <xs:annotation>
          <xs:documentation>
            Set the object to activated or deactivated
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="activate" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Activate object? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_capturable">
        <xs:annotation>
          <xs:documentation>
            Set the object to be capturable or not
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="capturable" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the object capturable? (default is based on class)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_docking_enabled">
        <xs:annotation>
          <xs:documentation>
            Set docking at the object to be enabled or not
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="enabled" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Are any ships allowed to dock at the object? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_boarder">
        <xs:annotation>
          <xs:documentation>
            Set the boarder of the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The object to be boarded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="boarder" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The object performing the boarding operation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_object_boarder">
        <xs:annotation>
          <xs:documentation>
            Remove the association between the object and its boarder
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_friend_list">
        <xs:annotation>
          <xs:documentation>
            Set friend list of a mine that supports this (mine will treat everyone else as foe, regardless of faction relations)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The mine whose friend list should be set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="factions" type="faction" use="required">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions to be set as friends
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_foe_list">
        <xs:annotation>
          <xs:documentation>
            Set foe list of a mine that supports this (mine will treat everyone else as friend, regardless of faction relations)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The mine whose foe list should be set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="factions" type="faction" use="required">
            <xs:annotation>
              <xs:documentation>
                Faction or list of factions to be set as foes
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_object_friend_foe_list">
        <xs:annotation>
          <xs:documentation>
            Clea friend/foe list of a mine that supports this (mine will revert to using faction relations)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                The mine whose foe list should be cleared
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_radar_visible">
        <xs:annotation>
          <xs:documentation>
            Set the object to be visible in the map or in the UI or not
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="visible" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the object visible? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_sellable">
        <xs:annotation>
          <xs:documentation>
            Set the object to be sellable
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="sellable" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the object sellable? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_commander">
        <xs:annotation>
          <xs:documentation>
            Set the commander of an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="commander" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to be the commander
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="assignment" type="assignmentexprlookup" use="optional">
            <xs:annotation>
              <xs:documentation>
                Assignment for this subordinate on the commander
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_order_state">
        <xs:annotation>
          <xs:documentation>
            Set the state of a running AI order to the specified state, if the state transition is supported.
            Explicit state changes with this action are optional. See orderstate documentation in scriptproperties.html.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="order" type="order" use="required" />
          <xs:attribute name="state">
            <xs:annotation>
              <xs:documentation>
                Order state
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="expression">
                <xs:enumeration value="orderstate.critical">
                  <xs:annotation>
                    <xs:documentation>
                      Enter critical state of order script. This requires the order to be in the active state.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="orderstate.finish">
                  <xs:annotation>
                    <xs:documentation>
                      Enter finish state of order script. This requires the order to be in the active or critical state.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_order_syncpoint_reached">
        <xs:annotation>
          <xs:documentation>
            Mark the sync point of a running AI order as reached. This action is a requirement for all infinite orders.
            Once the sync point of such an order is reached, the sync point is ready to be released by a signal, which will terminate the
            order (&lt;event_object_order_syncpoint_released&gt;). For player orders, the signal behaviour can be controlled in the UI.
            On queued infinite orders that do not use the sync point signalling system, the sync point is released (the order ends) as soon as the next order is ready in the queue.
            On default orders, this action only affects the UI display. There is no effect on finite orders.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="order" type="order" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="edit_order_param">
        <xs:annotation>
          <xs:documentation>
            Changes an order parameter, as if edited by the player in the UI. Note that this has side effects for already running orders and can fail in some cases.
            If the order is in the started state (non-critical), it will be reset and start over. If in the critical state, any &lt;editable&gt; actions will be performed
            and &lt;event_order_param_edited&gt; will be triggered. You can check with &quot;$order.isparameditable.&lt;param&gt;&quot; whether a param is currently editable.
            Editing a param fails if:
            (1) the order is in the critical state and the param has no &lt;editable&gt; node that allows editing, or
            (2) the order is the default order or in a critical state and the param decides whether the order is infinite (i.e. it has an infinitevalue), or
            (3) the order is in the finish state.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="order" type="order" use="required" />
          <xs:attribute name="param" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Parameter name as string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                New parameter value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_min_hull">
        <xs:annotation>
          <xs:documentation>
            Set an object's minimum hull value (percentage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_min_shield">
        <xs:annotation>
          <xs:documentation>
            Set an object's minimum shield value (percentage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_hull">
        <xs:annotation>
          <xs:documentation>
            Set an object's hull value (percentage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_name">
        <xs:annotation>
          <xs:documentation>
            Set an object's name
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                New object name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_object_name">
        <xs:annotation>
          <xs:documentation>
            Clear an object's name and revert to default
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_description">
        <xs:annotation>
          <xs:documentation>
            Set an object's description
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="description" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                New object description
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="clear_object_description">
        <xs:annotation>
          <xs:documentation>
            Clear an object's description and revert to default
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_wing_name">
        <xs:annotation>
          <xs:documentation>
            Set a controllable object's wing name
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                New wing name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_relation_behaviour">
        <xs:annotation>
          <xs:documentation>
            Set relation change behaviour for an object when attacked or killed
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="disable" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Disable relation change? (true = disabled; false = default behaviour)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_shield">
        <xs:annotation>
          <xs:documentation>
            Set an object's shield value (percentage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_scanned">
        <xs:annotation>
          <xs:documentation>
            Sets the scanned level of an object to the maximum level of the player's scanner
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_object_hacked">
        <xs:annotation>
          <xs:documentation>
            Sets an object as hacked
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                If this is a ship or station, all content in the given build stage is set as hacked. If this is a subcomponent, it and *all* content is set as hacked.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="duration" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Duration of the hack
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="hacker" type="object">
            <xs:annotation>
              <xs:documentation>
                The object performing the hacking
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Name of the value that will receive the list of hacked components
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dropresult" type="lvalueexpression">
            <xs:annotation>
              <xs:documentation>
                Name of the value that will receive the list of ejected drops
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="hack_via_control_panel">
        <xs:annotation>
          <xs:documentation>
            Hack an object via a control panel type
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="hacker" type="entity" use="optional">
            <xs:annotation>
              <xs:documentation>
                The hacking entity (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="controlpaneltypelookup" use="required"/>
          <xs:attribute name="score" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Hacking score (0-5)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_room_locked">
        <xs:annotation>
          <xs:documentation>
            Set the room to be locked or not
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="room" type="object" use="required" />
          <xs:attribute name="locked" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the room locked? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_doors_locked">
        <xs:annotation>
          <xs:documentation>
            Set doors with optional matching group or tags in the room to be locked or not
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="room" type="object" use="required" />
          <xs:attribute name="group" type="expression">
            <xs:annotation>
              <xs:documentation>
                Group tag
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="locked" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Are the doors locked? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_trigger_activation_wares">
        <xs:annotation>
          <xs:documentation>
            Set platform triggers with optional matching group or tags in the room to require certain inventory wares for activation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="room" type="object" use="required" />
          <xs:attribute name="group" type="expression">
            <xs:annotation>
              <xs:documentation>
                Group tag
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specification tag or list of tags
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The required inventory ware
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                The required inventory ware amount (default is 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="consumeonuse" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Are the wares consumed on use? If true, there is also an event when the trigger was "unlocked" by the player. (default is false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_allow_drop">
        <xs:annotation>
          <xs:documentation>
            Whether the object (which can be any destructible subcomponent of an object!) can drop something
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="allow" type="boolean" use="required" />
          <xs:attribute name="recursive" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Whether this setting should be propagated to all child destructibles
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_drop_object">
        <xs:annotation>
          <xs:documentation>
            Sets the drop for the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="drop" type="expression">
            <xs:annotation>
              <xs:documentation>
                Drop string identifier (drop is cleared if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="spawn_docked">
        <xs:annotation>
          <xs:documentation>
            Attempt to spawn an existing ship in a dock (bypassing dock request checks)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
          <xs:attribute name="dock" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="spawn_drop">
        <xs:annotation>
          <xs:documentation>
            Spawn the drop defined for the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="drop" type="expression">
            <xs:annotation>
              <xs:documentation>
                Drop string identifier (will drop whatever is currently defined in the object if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="collect_drop">
        <xs:annotation>
          <xs:documentation>
            Have a drop be instantly collected by an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="drop" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="collect_asteroid">
        <xs:annotation>
          <xs:documentation>
            Have an asteroid be instantly collected by a ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="ship" use="required" />
          <xs:attribute name="asteroid" type="asteroid" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_entity_page">
        <xs:annotation>
          <xs:documentation>
            Sets/changes the page of an actor (entity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="required" />
          <xs:attribute name="page" type="page" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_entity_type">
        <xs:annotation>
          <xs:documentation>
            Sets/changes the type of an actor (entity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="required" />
          <xs:attribute name="type" type="entitytypeexprlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_entity_role">
        <xs:annotation>
          <xs:documentation>
            Sets/changes the role of an actor (entity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="required" />
          <xs:attribute name="role" type="entityroleexprlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_npc_template_role">
        <xs:annotation>
          <xs:documentation>
            Sets/changes the role of a npc template
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required"/>
          <xs:attribute name="template" type="expression" use="required"/>
          <xs:attribute name="role" type="entityroleexprlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_faction_relation">
        <xs:annotation>
          <xs:documentation>
            Set global faction relation
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" use="required" />
          <xs:attribute name="otherfaction" type="faction" use="required" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reason" type="relationchangereasonlookup">
            <xs:annotation>
              <xs:documentation>
                The reason for relationship change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_faction_relation">
        <xs:annotation>
          <xs:documentation>
            Reset faction relation to base value in factions.xml
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" use="required" />
          <xs:attribute name="otherfaction" type="faction" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_faction_relation_locked">
        <xs:annotation>
          <xs:documentation>
            Set faction relations to be locked
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" use="required" />
          <xs:attribute name="locked" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Should the factions relations towards others not change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_mass_traffic_object_persistence">
        <xs:annotation>
          <xs:documentation>
            Set this mass traffic objects persistance in the game
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="persistent" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Should object be persistent? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_region_object_persistence">
        <xs:annotation>
          <xs:documentation>
            Set this region objects persistance in the game
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="persistent" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Should object be persistent? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="end_mass_traffic">
        <xs:annotation>
          <xs:documentation>
            Set this mass traffic network's end time. Note that the time will be adjusted so that no ships are underway when the network is removed.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="network" type="masstraffic" use="required" />
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The end time (default is the current time)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_owner">
        <xs:annotation>
          <xs:documentation>
            Sets the owner faction of an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="faction" type="owner" use="required">
            <xs:annotation>
              <xs:documentation>
                (No owner is set if null or not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="overridenpc" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Set the owner faction of the control entities (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_cover_owner">
        <xs:annotation>
          <xs:documentation>
            Sets the cover owner faction of an object (cover owner is cleared if faction is null or not supplied)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="faction" type="owner"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_player_activity">
        <xs:annotation>
          <xs:documentation>
            Set player activity (mode mission)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="activity" type="activityexprlookup" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_player_entity_position">
        <xs:annotation>
          <xs:documentation>
            Set player position in room
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
          </xs:choice>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="teleport_player">
        <xs:annotation>
          <xs:documentation>
            Trigger a teleport to a object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="control" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Have the player take control if it is free (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="instant" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Instant teleportation (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="force" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Allow the teleportation, even if the research criteria is not fulfilled (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_relation_boost">
        <xs:annotation>
          <xs:documentation>
            Set relation boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objectrelationboost" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Relation boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="reason" type="relationchangereasonlookup">
            <xs:annotation>
              <xs:documentation>
                The reason for relationship change
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_representative">
        <xs:annotation>
          <xs:documentation>
            Set faction representative
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="faction" type="faction" />
          <xs:attribute name="representative" type="expression">
            <xs:annotation>
              <xs:documentation>
                Entity to be assigned to the sector as faction representative
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_hack_target">
        <xs:annotation>
          <xs:documentation>
            Set the objects current hack target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_scan_target">
        <xs:annotation>
          <xs:documentation>
            Set the player's current scan target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="target" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_skill">
        <xs:annotation>
          <xs:documentation>
            Set skill value to either 'entity' or a npctemplate on 'object'
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="optional" />
          <xs:attribute name="object" type="object" use="optional" />
          <xs:attribute name="template" type="expression" use="optional" />
          <xs:attribute name="type" type="skilltypeexprlookup" use="required" />
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="apply_experience">
        <xs:annotation>
          <xs:documentation>
            Apply experience to either individual 'entity' or crew aboard 'object' (identified by npctemplate for an individual crew member or role for a group )
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="entity" use="optional" />
          <xs:attribute name="object" type="object" use="optional" />
          <xs:attribute name="template" type="expression" use="optional" />
          <xs:attribute name="role" type="entityroleexprlookup" use="optional" />
          <xs:attribute name="experience" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Experience (from libraries/experiences.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="factor" type="expression" use="optional" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_entity_traits">
        <xs:annotation>
          <xs:documentation>
            Set the traits of an entity
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="setentityflags"/>
          <xs:attribute name="entity" type="object" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_npc_template_traits">
        <xs:annotation>
          <xs:documentation>
            Set the traits of a npc template
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="setentityflags"/>
          <xs:attribute name="object" type="object" use="required"/>
          <xs:attribute name="template" type="expression" use="required"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_tolerance_boost">
        <xs:annotation>
          <xs:documentation>
            Set tolerance boost (otherobject or faction attribute required)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objectboost" />
          <xs:attribute name="value" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Tolerance boost value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_allowed_weapon_systems">
        <xs:annotation>
          <xs:documentation>
            Set allowed weapon systems (weapon system not listed will keep current state)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="allow">
            <xs:annotation>
              <xs:documentation>
                Specifically allow the use of certain weapon types (separated by space)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:list itemType="weaponsystemlookup" />
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="disallow">
            <xs:annotation>
              <xs:documentation>
                Specifically disallow the use of certain weapon types (separated by space)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:list itemType="weaponsystemlookup" />
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="immediate" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Optional, set to true to make disallowed weapon systems stop firing immediately (defaults to false, weapons will shoot until they lose their current target)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_trade_restrictions">
        <xs:annotation>
          <xs:documentation>
            Set trade restrictions for the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="override" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Define an override for the trade restrictions per ware
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="ware" type="ware" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Affected ware
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="restricted" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Restriction for this ware
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Object for which the restrictions will be set.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="restricted" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Global restriction to only trade with the own faction
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_turret_targets">
        <xs:annotation>
          <xs:documentation>
            Set turret targets
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="preferredtarget" type="expression">
            <xs:annotation>
              <xs:documentation>
                Priority target for each turret. If it can't attack, it will choose from the target list
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="clearpreferred" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                If preferredtarget is not provided, clear the existing preferred target (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression">
            <xs:annotation>
              <xs:documentation>
                List of target objects for turrets
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="stopshootingold" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Stop shooting old targets which are not provided in the new target list (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="weaponmode" type="weaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Turrets in the specified mode will choose from these targets (defaults to any)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_value">
        <xs:annotation>
          <xs:documentation>
            Set a variable value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="operation" type="setoperationlookup" />
          <xs:attributeGroup ref="random"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_weapon_mode">
        <xs:annotation>
          <xs:documentation>
            Set the weapon mode of a weapon or group of weapons. When weaponmode is omitted, it is reset to default.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="weapon" type="weapon" />
          <xs:attribute name="group" type="group" />
          <xs:attribute name="weaponmode" type="extendedweaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Weapon mode, or null to reset to default
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="setup_conversation_minigame">
        <xs:annotation>
          <xs:documentation>
            Set up parameters for a conversation mini-game. It will be started when the player selects an option with a positive default confidence.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="count" type="expression">
            <xs:annotation>
              <xs:documentation>
                Number of repetitions of the mini-game with the same parameters (default is 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="difficulty" type="expression">
            <xs:annotation>
              <xs:documentation>
                Mini-game difficulty level (1-5), which influences the choice of mini-game curve (default is 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="text" type="expression">
            <xs:annotation>
              <xs:documentation>
                Mini-game caption text (default is no text)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="passes" type="expression">
            <xs:annotation>
              <xs:documentation>
                Number of passes over the curve, i.e. number of tries (default is 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="speed" type="expression">
            <xs:annotation>
              <xs:documentation>
                Cursor speed in passes per second (default is 1.0)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="scale" type="expression">
            <xs:annotation>
              <xs:documentation>
                Curve scale, not implemented, do not use (default is 1.0)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="show_help">
        <xs:annotation>
          <xs:documentation>
            Show text from help text page if it was not shown before (when using line attribute), or show custom text (when using custom attribute)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="line" type="expression">
            <xs:annotation>
              <xs:documentation>
                Line (text ID) on help text page. Text will be shown if not shown before, or if force attribute value is true
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="force" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Always show help text? If true, the help is shown even if the help text ID was already used before (ignored when using custom attribute)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="custom" type="expression">
            <xs:annotation>
              <xs:documentation>
                Custom help text, takes precedence over line attribute
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="silent" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Suppress sound effect?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="showhelp" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_help">
        <xs:annotation>
          <xs:documentation>
            Remove display of a help text
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="all" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Set to true to remove all help texts from display queue. Takes precedence over line attribute.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="line" type="expression">
            <xs:annotation>
              <xs:documentation>
                Specific line (text ID) to be removed from display queue (removing custom texts specifically is not supported). If attribute is not supplied, the currently displayed hint is removed.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="show_input_help">
        <xs:annotation>
          <xs:documentation>
            Show help text for input function (e.g. INPUT_ACTION_QUICKSAVE or INPUT_STATE_ROLL_LEFT). Keyboard/controller use is detected automatically.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="expression">
            <xs:annotation>
              <xs:documentation>
                Input function name (see inputmap.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="showhelp" />
        </xs:complexType>
      </xs:element>

      <xs:element name="show_notification">
        <xs:annotation>
          <xs:documentation>
            Show a non-interactive notification in the message ticker
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="text" type="notificationtext" use="required" />
          <xs:attribute name="timeout" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximal duration of notification. If not supplied, the notification will end after a default timeout (currently 5s).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="priority" type="expression">
            <xs:annotation>
              <xs:documentation>
                The priority, an integer between 0 and 9 (default is 1).
                Unqueued notifications can only be aborted and replaced by unqueued notifications of same or higher priority, or by cutscenes. The queue for queued notifications is also sorted by priority.
                NOTE: Non-silent interactive events (notifications and cutscenes with flashing target monitor) are generally treated as having a higher priority than any non-interactive events.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="prioritydelay" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional value to delay the display of this ticker message if a message with a higher priority can be displayed before.
                The message will be displayed after all queued ticker messages with higher priorities have started being displayed and subsequently the specified delay has passed.
                In case there is no message with a higher priority in the ticker and no such message is added in the same frame, the message will be displayed without delay.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sound" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Sound ID name (default is &quot;notification_generic&quot; if omitted)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="show_interactive_notification">
        <xs:annotation>
          <xs:documentation>
            Show an interactive notification in the target monitor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="interaction">
              <xs:annotation>
                <xs:documentation>
                  Player interaction event
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="interaction" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="caption" type="expression">
            <xs:annotation>
              <xs:documentation>
                Caption text string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="text" type="notificationtext" use="required" />
          <xs:attribute name="timeout" type="expression">
            <xs:annotation>
              <xs:documentation>
                Maximal duration of notification. If not supplied, the notification will end after a default timeout (currently 5s).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="priority" type="expression">
            <xs:annotation>
              <xs:documentation>
                The priority, an integer between 0 and 9 (default is 1).
                Unqueued notifications can only be aborted and replaced by unqueued notifications of same or higher priority, or by cutscenes. The queue for queued notifications is also sorted by priority.
                NOTE: Non-silent interactive events (notifications and cutscenes with flashing target monitor) are generally treated as having a higher priority than any non-interactive events.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sound" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Sound ID name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                The faction for which the notoriety ladder should be displayed (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                The object for which the notoriety ladder should be displayed (optional). Takes precedence if both faction and object are supplied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="relationeffect" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                true iff a relation effect (blinking effect in faction bar) should be shown
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                (optional) ID of resulting notification object
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="shuffle_list">
        <xs:annotation>
          <xs:documentation>
            Shuffle elements of a list randomly
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="list" type="list" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="signal_objects">
        <xs:annotation>
          <xs:documentation>
            Signal an object and/or a group of objects using param and param2, each object will receive this signal as if it were an event
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objecteventsource" />
          <xs:attribute name="param" type="expression" />
          <xs:attribute name="param2" type="expression" />
          <xs:attribute name="param3" type="expression" />
          <xs:attribute name="delay" type="expression">
            <xs:annotation>
              <xs:documentation>
                (optional) delay this signal by the specified amount of time
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="speak">
        <xs:annotation>
          <xs:documentation>
            Play (speak) text
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="voicedata" minOccurs="0" maxOccurs="unbounded" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="actor" type="actor" use="required" />
          <xs:attribute name="page" type="pagewithdefault" />
          <xs:attribute name="line" type="line" />
          <xs:attribute name="priority" type="expression">
            <xs:annotation>
              <xs:documentation>
                Speech priority. Speeches of lower priority will be interrupted. Default is 0.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="caninterrupt" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Allow interrupting a speech of the same priority? Default is true.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="recipient" type="expression">
            <xs:annotation>
              <xs:documentation>
                Speech recipient, i.e. the character being spoken to (optional). Pass an NPC if this is a background speech between two NPCs, which affects the voice style of the speech. Default is the player (if omitted or null).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="backgroundcomm" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this a background speech and is the player able to hear this over comm? Note that a speech in background and a speech over comm are two separate properties,
                and this flag only indicates a preference, which can be partially or fully ignored.
                - If the player is the speaker or this is a broadcast, the speech is always in foreground.
                - If a recipient is specified, the speech is in background depending on whether the recipient is an NPC or the player.
                - If the speech is in background and the recipient is in hearing range of the speaker, the speech will be over comm only if backgroundcomm is enabled and the player is not within hearing range.
                (Otherwise it is assumed that the player is required to be close to the speaker to hear the speech.)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="broadcast" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is this a broadcast speech of an entity to a group of people over comm? This implies background speech, but may cause a different comm filter to be applied. Default is false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="check" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Check for errors resolving an object name or description? Default is true
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="start_boost">
        <xs:annotation>
          <xs:documentation>
            Start engine booster
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="start_conversation">
        <xs:annotation>
          <xs:documentation>
            Start a conversation on this actor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="conversationactor" />
          <xs:attribute name="conversation" type="conversation" use="required" />
          <xs:attribute name="convparam" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional parameter that is passed to &lt;event_conversation_started&gt;. Can be of any data type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type">
            <xs:annotation>
              <xs:documentation>
                Type that affects how the conversation is started
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="normal">
                  <xs:annotation>
                    <xs:documentation>
                      Default conversation type
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="unqueued">
                  <xs:annotation>
                    <xs:documentation>
                      Unqueued conversation (start conversation only if there is no conversation already running)
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="takeover">
                  <xs:annotation>
                    <xs:documentation>
                      Take over a previous conversation. When using this type, the player does not automatically return to the default position when the previous conversation ends.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="priority">
            <xs:annotation>
              <xs:documentation>
                Priority of conversation for the case of multiple simultaneous requests (min=0, max=100, default=0)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:nonNegativeInteger">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="100" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="cancel_conversation">
        <xs:annotation>
          <xs:documentation>
            Cancel an active conversation (if providing a conversation actor, the conversation is only cancelled if the actor matches)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="conversationactor" />
          <xs:attribute name="conversation" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Optional conversation name. If supplied then the conversation is only aborted if the conversation name matches.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="force" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Should conversation be aborted even if Escape was explicitly disabled via &lt;allow_conversation_escape&gt;?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="cancel_all_orders">
        <xs:annotation>
          <xs:documentation>
            Cancels all existing AI orders in the object's order queue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cancel_order">
        <xs:annotation>
          <xs:documentation>
            Cancels an AI order and removes it from the owner object's order queue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="order" type="order" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="start_long_range_scan">
        <xs:annotation>
          <xs:documentation>
            Starts a long range scan for the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_long_range_scan">
        <xs:annotation>
          <xs:documentation>
            Stops a long range scan for the object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="start_script">
        <xs:annotation>
          <xs:documentation>
            Start an AI script, aborting previously running scripts
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  AI script parameter
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="value" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter value
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="name" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Script name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
        <xs:key name="start_script_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>

      <xs:element name="stop_boost">
        <xs:annotation>
          <xs:documentation>
            Stop engine booster
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_cutscene">
        <xs:annotation>
          <xs:documentation>
            Stop a running cutscene
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="key" type="expression">
            <xs:annotation>
              <xs:documentation>
                Key name of the cutscene to be aborted (ignored if cutscene attribute is supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="cutscene" type="expression">
            <xs:annotation>
              <xs:documentation>
                Cutscene identifier as returned by &lt;play_cutscene&gt; (takes precedence over key attribute)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_firing_at_target">
        <xs:annotation>
          <xs:documentation>
            Stop firing at a specific target
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required"/>
          <xs:attribute name="weaponmode" type="weaponmodelookup">
            <xs:annotation>
              <xs:documentation>
                Turret in the specified mode will stop shooting at the target(s), defaults to any.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="substitute_text">
        <xs:annotation>
          <xs:documentation>
            Search in a text for sub-strings and substitutes them
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="replace" minOccurs="1" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Definition of a sub-string in the text and a replacement string. All occurrences of the sub-string will be replaced.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="string" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Sub-string which is expected to occur in the text
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="with" type="expression" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      New text which will replace the occurrences of the sub-string
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="text" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of the value that will receive the result text. If source is not supplied then this value is also used as text source.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="source" type="expression">
            <xs:annotation>
              <xs:documentation>
                Source text. If not supplied, the text attribute is used instead.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="trigger_autosave">
        <xs:annotation>
          <xs:documentation>
            Trigger an autosave
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="trigger_boarding">
        <xs:annotation>
          <xs:documentation>
            Trigger a boarding process via an MD cue, including mission guidance for the player
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="boarder" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The marine commander that controls the boarding operation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The target object to be boarded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup">
            <xs:annotation>
              <xs:documentation>
                The boarder faction, which is trying to take ownership of the target (default is the player faction)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="undock">
        <xs:annotation>
          <xs:documentation>
            Undock ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_ship_undocking">
        <xs:annotation>
          <xs:documentation>
            Sets the state of the ship's dockingbay to 'undocking'
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="ship" type="ship" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="unlock_achievement">
        <xs:annotation>
          <xs:documentation>
            Unlock an achievement (no effect if it was already unlocked)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Achievement name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="indicate_achievement_progress">
        <xs:annotation>
          <xs:documentation>
            Indicate achievement progress (no effect if it was already unlocked). This does not unlock the achievement when max progress is reached (100%), use &lt;unlock_achievement&gt; instead in this case.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="namestring" use="required">
            <xs:annotation>
              <xs:documentation>
                Achievement name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="progress" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Integer value of current progress
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Integer value of maximal progress
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="initiate_player_trade">
        <xs:annotation>
          <xs:documentation>
            Initiate a trade between an object and the player's primary ship.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Returns true if the trade was successfully initiated, otherwise false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="trade" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The trade to be initiated.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Optionally, override the amount of the ware to be traded (This could have changed since the deal was made).
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="update_trade">
        <xs:annotation>
          <xs:documentation>
            Update certain parameters of a trade
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="trade" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The trade to update
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="amount" type="expression">
            <xs:annotation>
              <xs:documentation>
                New amount for the trade (optional, should already be adjusted to be the amount we can afford)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="desiredamount" type="expression">
            <xs:annotation>
              <xs:documentation>
                New desiredamount for the trade (optional, how much we *really* want, ignoring financial constraints)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="expression">
            <xs:annotation>
              <xs:documentation>
                New price (per unit) for the trade (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="upgrade_object_by_macro">
        <xs:annotation>
          <xs:documentation>
            Upgrade an object by using a macro and percentage ($object.hasmultimacroupgrades must be true)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="upgrade_object_by_tag">
        <xs:annotation>
          <xs:documentation>
            Upgrade an object by using a tag and percentage ($object.hasmultimacroupgrades must be false)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="tag" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Upgrade tag
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_build_slot_price">
        <xs:annotation>
          <xs:documentation>
            Get price estimate for the buildslot (macro, sequence, stage), if wares are purchased by object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="buildmodule" type="expression" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attribute name="sequence" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Build Sequence
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="stage" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Build Stage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="price" type="lvaluename" use="required" />
          <xs:attribute name="buildplan" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_object_value">
        <xs:annotation>
          <xs:documentation>
            Get the credit value of an object
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="priceobject" type="object">
            <xs:annotation>
              <xs:documentation>
                Object of which to base resource prices
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sellprice" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Calculate the sell price of the object? Default is false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="get_pilot_dockslot">
        <xs:annotation>
          <xs:documentation>
            Retrieve the dockslot that a pilot entity is currently using for docking.
            NOTE: This action is not supposed to be used normally, it only exists for fixing a bug that appears in early game versions.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="pilot" use="required">
            <xs:annotation>
              <xs:documentation>
                Pilot
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvaluename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="warp">
        <xs:annotation>
          <xs:documentation>
            Warp object to different location
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:all>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
            <xs:element name="safepos" type="safepos" minOccurs="0" maxOccurs="1" />
            <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="1" />
            <xs:element name="orientation" type="orientation" minOccurs="0" maxOccurs="1" />
          </xs:all>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="zone" type="expression">
            <xs:annotation>
              <xs:documentation>
                Zone to warp to (take precedence from sector)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sector" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sector to warp the object in using position in the sector space. Creates a tempzone if a zone does not exist at the coordinates
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="sort_trades">
        <xs:annotation>
          <xs:documentation>
            Sort trade list. Note: Sorting trades with identical sort values will retain their relative order from the input list. Consider shuffling the trade list first.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="tradelist" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of trades to sort
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sorter" type="tradesorterlookup" use="required" />
          <xs:attribute name="min" type="boolean" use="optional" />
          <xs:attribute name="refobject" type="object" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Reference object to sort trades by distances or offeramounts (required for sorter="distance", optional for sorter="offeramount")
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="sort_people">
        <xs:annotation>
          <xs:documentation>
            Sort people list. Note: Sorting people with identical sort values will retain their relative order from the input list. Consider shuffling the templatelist first.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="templatelist" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                List of NPC templates to sort
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sorter" type="npcsummarysorterlookup" use="required" />
          <xs:attribute name="skill" type="skilltypeexprlookup" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Skill to sort by (required for sorter="skill", ignored otherwise)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="post" type="controlpostexprlookup" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Post to sort for potential skill by (required for sorter="potentialskillforpost", ignored otherwise)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="role" type="entityroleexprlookup" use="optional" >
            <xs:annotation>
              <xs:documentation>
                Role to sort for potential skill by (required for sorter="potentialskillforrole", ignored otherwise)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_experience_progress">
        <xs:annotation>
          <xs:documentation>
            Add experience progress points
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="random" />
          <xs:attribute name="entity" type="entity" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_experience_progress">
        <xs:annotation>
          <xs:documentation>
            Set experience progress points
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="random" />
          <xs:attribute name="entity" type="entity" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_effect">
        <xs:annotation>
          <xs:documentation>
            Add an effect object. If the effect's duration is infinite (value of -1), you need to remove it yourself with remove_effect.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object">
            <xs:annotation>
              <xs:documentation>
                Object to attach the effect to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="effect" type="expression">
            <xs:annotation>
              <xs:documentation>
                Effect definition (from libraries/effects.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_effect">
        <xs:annotation>
          <xs:documentation>
            Remove an existing effect object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object">
            <xs:annotation>
              <xs:documentation>
                Object the effect is attached to
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="effect" type="expression">
            <xs:annotation>
              <xs:documentation>
                Effect definition (from libraries/effects.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="play_sound">
        <xs:annotation>
          <xs:documentation>
            Play a sound. Does not support looping sounds yet.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required">
            <xs:annotation>
              <xs:documentation>
                Object to act as the sound source.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sound" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sound ID (from libraries/sound_library.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="play_music">
        <xs:annotation>
          <xs:documentation>
            Play music
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="music" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sound ID of music track (from libraries/sound_library.xml)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lockscenemusic" type="boolean">
            <xs:annotation>
              <xs:documentation>
                True to prevent automatic scene music change, false (default) to allow automatic change and to disable any existing lock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lockfightmusic" type="boolean">
            <xs:annotation>
              <xs:documentation>
                True to prevent automatic fight music change, false (default) to allow automatic change and to disable any existing lock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_music">
        <xs:annotation>
          <xs:documentation>
            Stop music
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="lockscenemusic" type="boolean">
            <xs:annotation>
              <xs:documentation>
                True to prevent automatic re-enabling of scene music, false (default) to allow re-enabling and to disable any existing lock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lockfightmusic" type="boolean">
            <xs:annotation>
              <xs:documentation>
                True to prevent automatic re-enabling of fight music, false (default) to allow re-enabling and to disable any existing lock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="write_to_logbook">
        <xs:annotation>
          <xs:documentation>
            Write an entry into the logbook
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="category" type="logcategorylookup" use="required" />
          <xs:attribute name="text" type="expression">
            <xs:annotation>
              <xs:documentation>
                Logbook entry text, either a single string with possible line breaks, or a list of strings in notification format (see &lt;show_notification&gt;).
                When using the notification format and both left and right columns of a row contain text, the texts will be concatenated with a single space as separator.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="separator" type="expression">
            <xs:annotation>
              <xs:documentation>
                Separator to be used between left and right texts of a notification row, in case the notification format is used in the text attribute (default is a single space)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="interaction" type="loginteractionlookup" />
          <xs:attribute name="object" type="expression">
            <xs:annotation>
              <xs:documentation>
                Interaction object, depending on the interaction type
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="title" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Logbook entry title
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="entity" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional source entity for logbook entry (either a real entity, in which case the entity name will be used, or an arbitrary name as text)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional source faction logbook entry (either a real faction, in which case the faction name will be used, or an arbitrary name as text)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="money" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional amount of money associated with the logbook entry (if not supplied, or 0, then will not be shown in the logbook)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="bonus" type="expression">
            <xs:annotation>
              <xs:documentation>
                Optional bonus amount of money associated with the logbook entry (if not supplied, or 0, then will not be shown in the logbook)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_trade_subscription">
        <xs:annotation>
          <xs:documentation>
            Add permanent player subscription to trade offer updates of the specified object. This also immediately adds the current trade offers to the trade memory.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                How long this subscription is valid for. Unlimited duration if ommitted. (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_trade_subscription">
        <xs:annotation>
          <xs:documentation>
            Remove permanent player subscription to trade offer updates of the specified object. Offers remain known as long as live view coverage exists.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="forget" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Forget that there ever was information about trade offers at the specified object (defaults to false)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="store_trade_offer_snapshot">
        <xs:annotation>
          <xs:documentation>
            Store a snapshot of the current trade offers on the specified object in the player trade memory.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_encyclopedia_entry">
        <xs:annotation>
          <xs:documentation>
            Add an entry of an item id into the library of type
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="type" type="infolibrarytypelookup" use="required" />
          <xs:attribute name="item" type="expression" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_blueprints">
        <xs:annotation>
          <xs:documentation>
            Add blueprints to player's blueprint library
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="wares" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Ware or list of wares for which to add blueprints (can be combined with macros and object in a single call)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="macros" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Macro or list of macros for which to add blueprints (can be combined with wares and object in a single call)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="object" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Object (station or ship) for which to add blueprints (can be combined with wares and macros in a single call)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="method" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Production method for blueprint(s) (will be the same for all added blueprints, uses default method if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="cycle" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Cycle efficiency for blueprint(s) (will be the same for all added blueprints, uses 1.0 if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="resource" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Resource efficiency for blueprint(s) (will be the same for all added blueprints, uses 1.0 if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="product" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Product efficiency for blueprint(s) (will be the same for all added blueprints, uses 1.0 if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="modules" type="booleanexpression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Include blueprints for modules (used only with object attribute, default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="flags" type="loadoutflagbitmask" use="optional">
            <xs:annotation>
              <xs:documentation>
                Include blueprints for equipment in specific loadout elements (used only with object attribute, default is all loadout elements)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="start_player_autopilot">
        <xs:annotation>
          <xs:documentation>
            Start playership autopilot to the selected destination (follow for moving targets)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="destination" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="stop_player_autopilot">
        <xs:annotation>
          <xs:documentation>
            Stop playership autopilot
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="toggle_timewarp">
        <xs:annotation>
          <xs:documentation>
            Toggle time warp (SETA). NOTE: Activation requires that SETA is in the player's inventory and the activation conditions are met. For example, SETA is not possible during a conversation.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="patch_macro">
        <xs:annotation>
          <xs:documentation>
            Patch an object based on its macro, to add components that may be missing when loading a savegame. This action is only required by extensions and should normally only be used when loading a savegame
            in which the extension was not active yet. The script is responsible for finding the objects, usually ships or stations, that need patching.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="patch_macros">
        <xs:annotation>
          <xs:documentation>
            Finds objects with given filter criteria and patches them based on their macro (see &lt;patch_macro&gt;)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="matchbase">
              <xs:attributeGroup ref="action" />
              <xs:attributeGroup ref="findobject" />
              <xs:attribute name="space" type="expression">
                <xs:annotation>
                  <xs:documentation>
                    Space in which to find objects to be patched. The galaxy is used if no space is supplied.
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>

      <xs:element name="install_software">
        <xs:annotation>
          <xs:documentation>
            Installs the given software on object. If the software is not compatible with object this will fail silently!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="software" type="ware" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="uninstall_software">
        <xs:annotation>
          <xs:documentation>
            Uninstalls the given software (and all previous versions) from object. If the software to be uninstalled (or any of its previous versions) are part of the default software, these will remain installed!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="software" type="ware" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="downgrade_software">
        <xs:annotation>
          <xs:documentation>
            Uninstalls all newer versions of software from object. If any of the software versions about to be removed are part of the default software, they will remain installed!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="software" type="ware" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_playership_throttle">
        <xs:annotation>
          <xs:documentation>
            Set the throttle value of the playership.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="value" type="expression">
            <xs:annotation>
              <xs:documentation>
                Value for throttle setting between full reverse (-1) and full forward (1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_stock">
        <xs:annotation>
          <xs:documentation>
            Add inventory to a given entity using the entity's stock ID, as defined in the character definition.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The entity that should receive some stock.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_stock_reference">
        <xs:annotation>
          <xs:documentation>
            Set the stock entry the given entity should use
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="entity" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The entity that gets the stock reference.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="stock" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The stock reference.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_clothing_mod">
        <xs:annotation>
          <xs:documentation>
            Add clothing mod to an NPC or the player
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="entity" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The NPC or player that should receive clothing mod.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Clothing mod ware (from clothingmods.xml, defines a quality level and visual properties of a clothing mod)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="add_workforce">
        <xs:annotation>
          <xs:documentation>
            Add workforce of the specified race to a given object. (will not add more than can fit, see $container.workforce.{$race}.capacity)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="race" type="race" use="required" />
          <xs:attributeGroup ref="random" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_workforce">
        <xs:annotation>
          <xs:documentation>
            Remove workforce of the specified race from a given object.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="race" type="race" use="required" />
          <xs:attributeGroup ref="random" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_equipment_wares_excluded">
        <xs:annotation>
          <xs:documentation>
            Define equipment wares from the default equipment for the object owners' faction that should not be available for construction (only applies to objects with build modules such as shipyards or equipment docks).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="buildexcludewares" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_equipment_wares_included">
        <xs:annotation>
          <xs:documentation>
            Define equipment wares outside the default equipment for the object owners' faction that should be available for construction regardless (only applies to objects with build modules such as shipyards or equipment docks).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="buildincludewares" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_ship_wares_excluded">
        <xs:annotation>
          <xs:documentation>
            Define ship wares from the default ships for the object owners' faction that should not be available for construction (only applies to objects with build modules such as shipyards or equipment docks).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="buildexcludewares" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_ship_wares_included">
        <xs:annotation>
          <xs:documentation>
            Define ship wares outside the default ships for the object owners' faction that should be available for construction regardless (only applies to objects with build modules such as shipyards or equipment docks).
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="buildincludewares" />
          <xs:attribute name="object" type="object" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="report_online_encounter">
        <xs:annotation>
          <xs:documentation>
            Report that the object had an encounter which should be tracked and submitted to the server as potentially relevant for transmission to original owner. Will fail silently if the object does not originate from another universe.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="type" type="encountertypelookup" use="required" />
          <xs:attribute name="param" type="expression" />
          <xs:attribute name="param2" type="expression" />
          <xs:attribute name="param3" type="expression" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_trade_computer">
        <xs:annotation>
          <xs:documentation>
            Creates a trade computer entity on the specified object that will attempt to perform the first trade order in the current order queue, provided the tradepartner is the container the object is currently docked at.
            After completion of the order the trade computer will remove itself. (see orders.base.tradecomputer)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="result" type="lvaluename">
            <xs:annotation>
              <xs:documentation>
                The trade computer entity, if one was created.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="estimate_travel_time">
        <xs:annotation>
          <xs:documentation>
            Estimate the time it takes to fly to a target location (takes highways and travel mode into account)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="startposition" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Start position relative to the start component.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="targetposition" type="position" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Target position relative to the target component.
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="start" type="object" use="required" />
          <xs:attribute name="target" type="object" use="required" />
          <xs:attribute name="ship" type="expression">
            <xs:annotation>
              <xs:documentation>
                The ship from which to get the engine parameters. Other parameters can be defined to override individual values. If not provided, all engine parameters must be defined.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="uselocalhighways" type="expression">
            <xs:annotation>
              <xs:documentation>
                Whether local highways are to be included in time estimations.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="speed" type="expression">
            <xs:annotation>
              <xs:documentation>
                The maximum forward speed without using boost or travel mode.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="travelfactor" type="expression">
            <xs:annotation>
              <xs:documentation>
                The travel drive's thrust factor. Multiplies the forward speed.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="travelcharge" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time it takes to charge travel mode.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="travelattack" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time it takes to reach maximum travel speed after charging has finished.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result" type="lvalueexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                The estimated travel time.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:attributeGroup name="collectableammoamount">
    <xs:attribute name="min" type="xs:nonNegativeInteger" />
    <xs:attribute name="max" type="xs:positiveInteger" />
    <xs:attribute name="exact" type="xs:positiveInteger" />
  </xs:attributeGroup>

  <xs:complexType name="wareamount">
    <xs:annotation>
      <xs:documentation>
        Ware amount
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="ware" type="namestring" use="required" />
    <xs:attribute name="amount" type="xs:positiveInteger" />
    <xs:attribute name="min" type="xs:nonNegativeInteger" />
    <xs:attribute name="max" type="xs:positiveInteger" />
  </xs:complexType>

  <xs:complexType name="collectablewares">
    <xs:annotation>
      <xs:documentation>
        Collectable wares
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="ware" type="wareamount" minOccurs="1" maxOccurs="unbounded" />
      <xs:element name="select" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Selection element (used if selection attribute present)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ware" type="wareamount" minOccurs="1" maxOccurs="unbounded" />
          </xs:sequence>
          <xs:attribute name="weight" type="selectionweight" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
    <xs:attribute name="selection" type="selectionlookup" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="collectablemoney">
    <xs:attribute name="chance">
      <xs:annotation>
        <xs:documentation>
          Chance percentage of spawning any money (default is 100)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="100" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="min" type="xs:nonNegativeInteger" use="required" />
    <xs:attribute name="max" type="xs:positiveInteger" use="required" />
  </xs:complexType>

  <xs:complexType name="collectableammo">
    <xs:annotation>
      <xs:documentation>
        Collectable ammo
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="select" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Selection element (used if selection attribute present)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="macro" type="namestring" use="required" />
          <xs:attributeGroup ref="collectableammoamount" />
          <xs:attribute name="weight" type="selectionweight" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="macro" type="namestring" />
    <xs:attributeGroup ref="collectableammoamount" />
    <xs:attribute name="selection" type="selectionlookup" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="collectablefuel">
    <xs:annotation>
      <xs:documentation>
        Collectable fuel
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="min" type="xs:nonNegativeInteger" use="required" />
    <xs:attribute name="max" type="xs:positiveInteger" use="required" />
  </xs:complexType>

  <xs:complexType name="collectableshieldrestore">
    <xs:annotation>
      <xs:documentation>
        Collectable shieldrestore
      </xs:documentation>
    </xs:annotation>
  </xs:complexType>

  <xs:complexType name="drop">
    <xs:annotation>
      <xs:documentation>
        Drop definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="collectable" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:choice>
            <xs:sequence>
              <xs:element name="wares" type="collectablewares" />
              <xs:element name="money" type="collectablemoney" minOccurs="0" maxOccurs="1" />
            </xs:sequence>
            <xs:element name="money" type="collectablemoney" />
            <xs:element name="ammo" type="collectableammo" />
            <xs:element name="fuel" type="collectablefuel" />
            <xs:element name="shieldrestore" type="collectableshieldrestore" />
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="chance">
      <xs:annotation>
        <xs:documentation>
          Chance percentage of spawning any drops (default is 100)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="100" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="min" type="xs:nonNegativeInteger">
      <xs:annotation>
        <xs:documentation>
          Minimal amount (default is 1)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:positiveInteger">
      <xs:annotation>
        <xs:documentation>
          Maximal amount
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macro" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Macro name (required in all cases except for collectable wares - if no macro is supplied in this case, the container macro from WareDB is used)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- ===== Root element ==== -->

  <xs:element name="droplists">
    <xs:annotation>
      <xs:documentation>
        DropDB document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="droplist">
          <xs:annotation>
            <xs:documentation>
              List of drop definitions
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="drop" minOccurs="0" maxOccurs="unbounded" type="drop" />
            </xs:sequence>
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="name">
              <xs:annotation>
                <xs:documentation>
                  Name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="description">
              <xs:annotation>
                <xs:documentation>
                  Description
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="droplist_id">
      <xs:selector xpath="droplist" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="colorvalue">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="255" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="iconid">
    <xs:restriction base="idname" />
  </xs:simpleType>

  <xs:complexType name="icon">
    <xs:attribute name="active" type="iconid" use="required">
      <xs:annotation>
        <xs:documentation>
          Active icon id for faction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="inactive" type="iconid" use="required">
      <xs:annotation>
        <xs:documentation>
          Inactive icon id for faction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="responseid">
    <xs:restriction base="idname" />
  </xs:simpleType>

  <xs:complexType name="response">
    <xs:attribute name="id" type="responseid" use="required">
      <xs:annotation>
        <xs:documentation>
          Response id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Response name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Response description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="signalid">
    <xs:restriction base="idname" />
  </xs:simpleType>

  <xs:complexType name="signal">
    <xs:sequence>
      <xs:element name="response" type="response" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Signal response
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="signalid" use="required">
      <xs:annotation>
        <xs:documentation>
          Signal id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Signal name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Signal description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="default" type="responseid" use="required">
      <xs:annotation>
        <xs:documentation>
          Default response
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ask" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Default ask setting
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="responsesetting">
    <xs:attribute name="signal" type="signalid" use="required">
      <xs:annotation>
        <xs:documentation>
          Signal id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="response" type="responseid" use="required">
      <xs:annotation>
        <xs:documentation>
          Response id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ask" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Ask setting (not normally required, as default in signal definition should be set to player default)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="responsesettings">
    <xs:sequence>
      <xs:element name="response" type="responsesetting" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Response setting (only required in this file if behaviour for this faction is not the same as the default)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="relationrangelookup">
    <xs:annotation>
      <xs:documentation>
        Named relation range
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="ally" />
      <xs:enumeration value="dock" />
      <xs:enumeration value="enemy" />
      <xs:enumeration value="friend" />
      <xs:enumeration value="kill" />
      <xs:enumeration value="member" />
      <xs:enumeration value="nemesis" />
      <xs:enumeration value="neutral" />
      <xs:enumeration value="self" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="factiontaglookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="aggressive" />
      <xs:enumeration value="claimspace" />
      <xs:enumeration value="economic" />
      <xs:enumeration value="notradeoffer" />
      <xs:enumeration value="plunder" />
      <xs:enumeration value="police" />
      <xs:enumeration value="privateloadout" />
      <xs:enumeration value="privateship" />
      <xs:enumeration value="protective" />
      <xs:enumeration value="publicloadout" />
      <xs:enumeration value="publicship" />
      <xs:enumeration value="visitor" />
      <xs:enumeration value="watchdoguser" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="relationvalue">
    <xs:annotation>
      <xs:documentation>
        Relation value
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:float">
      <xs:minInclusive value="-1.0" />
      <xs:maxInclusive value="1.0" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="factionid">
    <xs:restriction base="idname" />
  </xs:simpleType>

  <xs:complexType name="relation">
    <xs:attribute name="faction" type="factionid">
      <xs:annotation>
        <xs:documentation>
          Faction id for relation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="relation" type="relationvalue">
      <xs:annotation>
        <xs:documentation>
          Relation value for relation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="relations">
    <xs:sequence>
      <xs:element name="relation" type="relation" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Relation for one faction to another
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="locked" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Are relations locked? (don't change permanently)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="account">
    <xs:attribute name="amount" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Money
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="color">
    <xs:attribute name="r" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Red
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="g" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Green
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="b" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Blue
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="licence">
    <xs:attribute name="type" type="licencelookup">
      <xs:annotation>
        <xs:documentation>
          Type of licence
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Licence name (Do not use with 'faction' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Licence description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="icon" type="iconid">
      <xs:annotation>
        <xs:documentation>
          Icon for licence
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="factions" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Factions that have granted a license of the specified type (only use with type attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minrelation" type="xs:float" use="optional">
      <xs:annotation>
        <xs:documentation>
          Minimum relation the player must have with this faction to obtain this licence (Only use with 'type' attribute)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="precursor" type="licencelookup" use="optional">
      <xs:annotation>
        <xs:documentation>
          Type of licence required as a precursor to this one
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="price" type="xs:float" use="optional">
      <xs:annotation>
        <xs:documentation>
          Price of the licence
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxlegalscan" type="xs:integer" use="optional">
      <xs:annotation>
        <xs:documentation>
          Defines up to which scan level becomes legal if licence is held
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hidden" type="xs:boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          Hide licence from user interface (default false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

  </xs:complexType>

  <xs:complexType name="licences">
    <xs:sequence>
      <xs:element name="licence" type="licence" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Licence definition
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="factiondef">
    <xs:sequence>
      <xs:element name="color" type="color" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Color for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="account" type="account" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Account for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="icon" type="icon" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Icons for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="licences" type="licences" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Licences for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="relations" type="relations" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Relations for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="signals" type="responsesettings" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Signal response settings for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="factionid" use="required">
      <xs:annotation>
        <xs:documentation>
          Faction id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Faction name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Faction description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shortname" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Short faction name (i.e. abbreviation)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="behaviourset" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Name of a flight behaviour set which is used by members of this race. Must correspond to an entry in behaviours.xml
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="constructionbias" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Construction direction bias (omit or set to 0.0 to default from primary race, or use range 0.1 to 10.0 where less than 1.0 prefers vertical connections, 1.0 is balanced, and greater than 1.0 prefers horizontal connections)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="primaryrace" type="racelookup" use="required">
      <xs:annotation>
        <xs:documentation>
          Race id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="policefaction" type="factionid">
      <xs:annotation>
        <xs:documentation>
          Folice faction for this faction (optional). Police faction must have the police tag. Default is the faction itself if it has the police tag, otherwise no police faction at all.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags">
      <xs:annotation>
        <xs:documentation>
          Tags
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:list itemType="factiontaglookup" />
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="known" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Is the faction known to the player (on game start)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hide" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether the faction should show up in info library/encyclopedia
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="relationrange">
    <xs:attribute name="range" type="relationrangelookup" use="required" />
    <xs:attribute name="min" type="relationvalue" />
    <xs:attribute name="max" type="relationvalue" />
  </xs:complexType>

  <xs:complexType name="factions">
    <xs:sequence>
      <xs:element name="signals" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="signal" type="signal" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ranges" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="range" type="relationrange" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="faction" type="factiondef" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Definition of a single faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="factions" type="factions">
    <xs:annotation>
      <xs:documentation>
        Faction DB
      </xs:documentation>
    </xs:annotation>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="gamestartimageid">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="gamestartid">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="gamestartmacroname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="gamestartmacropath">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9_./]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="gamestartconnectionname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="gamestartinfoitem">
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Item name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Item description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartinfo">
    <xs:sequence>
      <xs:element name="item" type="gamestartinfoitem" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Definition of one name/description text pair
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="requirement" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Description of requirement to make this gamestart available
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartunlockachievement">
    <xs:attribute name="ref" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Achievement name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartunlock">
    <xs:sequence>
      <xs:element name="achievement" type="gamestartunlockachievement" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Achievement required to unlock gamestart
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

<xs:complexType name="gamestartplayerlocation">
    <xs:sequence>
      <xs:element name="position" type="position" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Start position of player
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Start rotation of player
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="room" type="gamestartmacroname">
      <xs:annotation>
        <xs:documentation>
          Macro name of room
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="disembarked" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether player is disembarked from player ship
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartinterior">
    <xs:attribute name="type" type="roomtypelookup">
      <xs:annotation>
        <xs:documentation>
          Interior type
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Interior name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="corridor" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name of interior corridor
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="door" type="gamestartconnectionname" use="required">
      <xs:annotation>
        <xs:documentation>
          Connection name within corridor to which room should be attached
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="room" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name of interior room
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="module" type="gamestartmacroname">
      <xs:annotation>
        <xs:documentation>
          Macro name of module within object in which to create interior
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="modulepath" type="gamestartmacropath">
      <xs:annotation>
        <xs:documentation>
          Macro path of module within object in which to create interior
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartlocation">
    <xs:sequence>
      <xs:element name="position" type="position" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Start position of player ship
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="rotation" type="rotation" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Start rotation of player ship
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="player" type="gamestartplayerlocation" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location of player if separate from ship
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="interior" type="gamestartinterior" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Dynamically created interior for player to start in
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="galaxy" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name of galaxy to use for map
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="zone" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Macro name of start zone within galaxy
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="stationpath" type="gamestartmacropath">
      <xs:annotation>
        <xs:documentation>
          Macro path of station within galaxy
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="station" type="gamestartmacroname">
      <xs:annotation>
        <xs:documentation>
          Macro name of station
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tradestation" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is trade station (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shipyard" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is shipyard (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="equipmentdock" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is equipment dock (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="defencestation" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is defence station (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="piratebase" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is pirate base (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="headquarters" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Station is headquarters (only used with station macro, no check made if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shippath" type="gamestartmacropath">
      <xs:annotation>
        <xs:documentation>
          Macro path of ship within galaxy
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ship" type="gamestartmacroname">
      <xs:annotation>
        <xs:documentation>
          Macro name of ship
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="roompath" type="gamestartmacropath">
      <xs:annotation>
        <xs:documentation>
          Macro path of room within galaxy
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="room" type="gamestartmacroname">
      <xs:annotation>
        <xs:documentation>
          Macro name of room
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="faction" type="factionlookup">
      <xs:annotation>
        <xs:documentation>
          Faction name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="docked" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether player ship should be docked
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="playershiploadout">
    <xs:sequence>
      <xs:group ref="loadoutelements">
        <xs:annotation>
          <xs:documentation>
            Player ship loadout
          </xs:documentation>
        </xs:annotation>
      </xs:group>
    </xs:sequence>
    <xs:attribute name="debug" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Loadout is debug-only
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartshipmod">
    <xs:attribute name="paint" type="xs:string" use="optional">
      <xs:annotation>
        <xs:documentation>
          Paint mod
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartplayership">
    <xs:sequence>
      <xs:element name="loadout" type="playershiploadout" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Player ship sloadout
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="modification" type="gamestartshipmod" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Player ship mods
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="macro" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Player ship macro
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Player ship name (if different to that in the player ship macro)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartinventoryware">
    <xs:attribute name="ware" type="ware" use="required">
      <xs:annotation>
        <xs:documentation>
          Inventory ware name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="amount" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Amount of inventory ware
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartinventory">
    <xs:sequence>
      <xs:element name="ware" type="gamestartinventoryware" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Inventory item
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="gamestartblueprintware">
    <xs:attribute name="ware" type="ware" use="required">
      <xs:annotation>
        <xs:documentation>
          Blueprint ware name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="method" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Ware production method
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cycle" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Cycle efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="product" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Product efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="resource" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Resource efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartblueprints">
    <xs:sequence>
      <xs:element name="ware" type="gamestartblueprintware" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Blueprint
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="station" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Include blueprints for player-owned stations (defaults to true)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartresearchware">
    <xs:attribute name="ware" type="ware" use="required">
      <xs:annotation>
        <xs:documentation>
          Blueprint ware name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cycle" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Cycle efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="product" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Product efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="resource" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Resource efficiency
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartresearch">
    <xs:sequence>
      <xs:element name="ware" type="gamestartresearchware" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Research item
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="gamestarttimelineentry">
    <xs:attribute name="ref" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Timeline entry ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestarttimeline">
    <xs:sequence>
      <xs:element name="entry" type="gamestarttimelineentry" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Timeline entry
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="gamestarttheme">
    <xs:attribute name="paint" type="xs:string" use="optional">
      <xs:annotation>
        <xs:documentation>
          Paint theme
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="clothing" type="xs:string" use="optional">
      <xs:annotation>
        <xs:documentation>
          Clothing theme
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartplayermod">
    <xs:attribute name="clothing" type="xs:string" use="optional">
      <xs:annotation>
        <xs:documentation>
          Clothing mod
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestartplayer">
    <xs:sequence>
      <xs:element name="ship" type="gamestartplayership" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Player ship
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="inventory" type="gamestartinventory" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Inventory
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="blueprints" type="gamestartblueprints" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Blueprints
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="research" type="gamestartresearch" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Research
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="timeline" type="gamestarttimeline" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Timeline
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="theme" type="gamestarttheme" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Theme
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="modification" type="gamestartplayermod" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Player mods
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="macro" type="gamestartmacroname" use="required">
      <xs:annotation>
        <xs:documentation>
          Player macro
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Player name (if different to that in the player macro)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="money" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Player starting money
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestart">
    <xs:sequence>
      <xs:element name="info" type="gamestartinfo" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Descriptive text for new game menu
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="unlock" type="gamestartunlock" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Unlock requirements for gamestart
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="location" type="gamestartlocation" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Map and start location
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="player" type="gamestartplayer" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Player information
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="gamestartid" use="required">
      <xs:annotation>
        <xs:documentation>
           Gamestart id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Gamestart name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Gamestart description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="image" type="gamestartimageid">
      <xs:annotation>
        <xs:documentation>
          Gamestart image
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cutscene" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Gamestart cutscene name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cutscenevoice" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Gamestart cutscene voice sequence name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="intro" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Gamestart intro animation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="introvoice" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Gamestart intro animation voice sequence name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Gamestart group number
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="debug" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Gamestart is debug-only
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="gamestarts">
    <xs:sequence>
      <xs:element name="gamestart" type="gamestart" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Definition of a single gamestart
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="gamestarts" type="gamestarts">
    <xs:annotation>
      <xs:documentation>
        Gamestarts
      </xs:documentation>
    </xs:annotation>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <!-- ===== Root elements ==== -->

  <xs:element name="ships">
    <xs:annotation>
      <xs:documentation>
        Root element of ships.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="ship">
          <xs:annotation>
            <xs:documentation>
              Ship definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="shipdbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Ship category used for finding a suitable ship in the ShipDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:group ref="createship" />
            </xs:sequence>
            <xs:attributeGroup ref="createship" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="name">
              <xs:annotation>
                <xs:documentation>
                  Name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="description">
              <xs:annotation>
                <xs:documentation>
                  Description
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="ship_id">
      <xs:selector xpath="ship" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:element name="characters">
    <xs:annotation>
      <xs:documentation>
        Root element of characters.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="character">
          <xs:annotation>
            <xs:documentation>
              Character (NPC) definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="characterdbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Character category used for finding a suitable character in the CharacterDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:group ref="createnpc" />
            </xs:sequence>
            <xs:attributeGroup ref="createnpc" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="name">
              <xs:annotation>
                <xs:documentation>
                  Name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="description">
              <xs:annotation>
                <xs:documentation>
                  Description
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="character_id">
      <xs:selector xpath="character" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:element name="modules">
    <xs:annotation>
      <xs:documentation>
        Root element of modules.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="module" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Module definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="moduledbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Module category used for finding a suitable module in the ModuleDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:group ref="createmodule" />
            </xs:sequence>
            <xs:attributeGroup ref="createmodule" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="module_id">
      <xs:selector xpath="module" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:element name="rooms">
    <xs:annotation>
      <xs:documentation>
        Root element of rooms.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="room" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Room definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="roomdbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Room category used for finding a suitable room in the RoomDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:group ref="createmodule" />
            </xs:sequence>
            <xs:attributeGroup ref="createroom" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="room_id">
      <xs:selector xpath="room" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:element name="props">
    <xs:annotation>
      <xs:documentation>
        Root element of props.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="prop" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Prop definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="propdbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Prop category used for finding a suitable room in the PropDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
            <xs:attributeGroup ref="createprop" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="prop_id">
      <xs:selector xpath="prop" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:element name="modulesets">
    <xs:annotation>
      <xs:documentation>
        Root element of modulessets.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="set" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="race" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="ref" type="racelookup" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="idname" use="required"/>
            <xs:attribute name="name" use="required"/>
            <xs:attribute name="type" type="modulesettypelookup" use="required"/>
            <xs:attribute name="player" type="boolean" use="optional">
              <xs:annotation>
                <xs:documentation>
                  Allow the player to use this module set (defaults to false)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="constructionvesselrequired" type="boolean" use="optional">
              <xs:annotation>
                <xs:documentation>
                  Are construction vessels required for builds related to this set? (defaults to true)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="macro" use="required">
              <xs:annotation>
                <xs:documentation>
                  Station macro used as the base for this set
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="race" type="racelookup" use="optional">
              <xs:annotation>
                <xs:documentation>
                  Default race of this set
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="stations">
    <xs:annotation>
      <xs:documentation>
        Root element of stations.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="station" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Station definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="stationdbcategory">
                <xs:annotation>
                  <xs:documentation>
                    Station category used for finding a suitable station in the StationDB
                  </xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:group ref="createstation" />
            </xs:sequence>
            <xs:attributeGroup ref="createstation" />
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="station_id">
      <xs:selector xpath="station" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:complexType name="joborder">
    <xs:annotation>
      <xs:documentation>
        Orders
      </xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="param">
        <xs:complexType>
          <xs:attribute name="name" type="paramname" use="required" />
          <xs:attribute name="value" type="expression" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="order" type="namestring" use="required" />
    <xs:attribute name="default" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Set as default order of the ship?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="task">
    <xs:annotation>
      <xs:documentation>
        Task
      </xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="param">
        <xs:complexType>
          <xs:attribute name="name" type="paramname" use="required" />
          <xs:attribute name="value" type="expression" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="task" type="namestring" use="required" />
    <xs:attribute name="entitytype" type="entitytypelookup" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="positionrange">
    <xs:annotation>
      <xs:documentation>
        Position in zone
      </xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element name="distance">
        <xs:annotation>
          <xs:documentation>
            Distance from the position
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="exact">
            <xs:annotation>
              <xs:documentation>
                Exact distance from the position
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minExclusive value="0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="min">
            <xs:annotation>
              <xs:documentation>
                Minimum distance from the position (same as exact if 'max' is omitted)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minExclusive value="0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="max">
            <xs:annotation>
              <xs:documentation>
                Maximum distance from the position (min treated as 0 if omitted)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minExclusive value="0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="x" type="xs:float"/>
    <xs:attribute name="y" type="xs:float"/>
    <xs:attribute name="z" type="xs:float"/>
    <xs:attribute name="safepos" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Position the object with a safe position (defaults to true)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="yaw" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Yaw rotation in degrees (ignored for ships, random if not specified for stations and other objects)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="pitch" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Pitch rotation in degrees (ignored for ships, random if not specified for stations and other objects)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="roll" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Roll rotation in degrees (ignored for ships, random if not specified for stations and other objects)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:element name="jobs">
    <xs:annotation>
      <xs:documentation>
        Root element of jobs.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="job">
          <xs:annotation>
            <xs:documentation>
              Job definition
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="basket">
                  <xs:annotation>
                    <xs:documentation>
                      Default ware basket to select wares from. This basket definition is used when neither basket nor list are defined in a wares element of the ship definition.
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="basket" type="namestring" use="required" />
                    <xs:attribute name="comment" type="comment" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="category">
                  <xs:annotation>
                    <xs:documentation>
                      Job category used for finding a suitable job entries in the JobDB
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="faction" type="expression">
                      <xs:annotation>
                        <xs:documentation>
                          Faction
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="tags" type="expression">
                      <xs:annotation>
                        <xs:documentation>
                          Specification tag or list of tags
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="size">
                      <xs:annotation>
                        <xs:documentation>
                          Ship size
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:enumeration value="ship_xs" />
                          <xs:enumeration value="ship_s" />
                          <xs:enumeration value="ship_m" />
                          <xs:enumeration value="ship_l" />
                          <xs:enumeration value="ship_xl" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="comment" type="comment" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="order" type="joborder">
                  <xs:key name="single_order_param_name">
                    <xs:selector xpath="param" />
                    <xs:field xpath="@name" />
                  </xs:key>
                </xs:element>
                <xs:element name="orders">
                  <xs:annotation>
                    <xs:documentation>
                      Specify orders for the created ship. If this is specified any single &lt;order /&gt; node in the job root is ignored.
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
                      <xs:element name="order" type="joborder">
                        <xs:key name="orders_order_param_name">
                          <xs:selector xpath="param" />
                          <xs:field xpath="@name" />
                        </xs:key>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element name="task" type="task" />
                <xs:element name="tasks">
                  <xs:annotation>
                    <xs:documentation>
                      Specify tasks for multiple entities on the created ship. If this is specified any single &lt;task /&gt; node in the job root is ignored.
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
                      <xs:element name="task" type="task" />
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
                <xs:element name="quota" type="basejobquota" minOccurs="0" maxOccurs="1" />
                <xs:element name="quotas" type="gamestartjobquotas" minOccurs="0" maxOccurs="1" />
                <xs:element name="location">
                  <xs:annotation>
                    <xs:documentation>
                      Location
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="economy" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                          <xs:documentation>
                            Economy range
                          </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:attribute name="min" />
                          <xs:attribute name="max" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element name="security" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                          <xs:documentation>
                            Security range
                          </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:attribute name="min" />
                          <xs:attribute name="max" />
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="macro" />
                    <xs:attribute name="class" />
                    <xs:attribute name="faction">
                      <xs:annotation>
                        <xs:documentation>
                          Faction or list of factions
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="regionbasket" type="namestring" />
                    <xs:attribute name="relation" type="relationlookup">
                      <xs:annotation>
                        <xs:documentation>
                          Relation range
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="comparison" type="relationcomparison"/>
                    <xs:attribute name="factionrace">
                      <xs:annotation>
                        <xs:documentation>
                          Race or list of races, matched against factions' primary races (relation ranges are not taken into account)
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>
                <xs:element name="commander">
                  <xs:annotation>
                    <xs:documentation>
                      Commander
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="macro" />
                    <xs:attribute name="entitytype" type="entitytypelookup" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="encounters">
                  <xs:annotation>
                    <xs:documentation>
                      Player encounters
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="id" type="namestring" use="required" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="environment">
                  <xs:annotation>
                    <xs:documentation>
                      Environment
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="zone" type="boolean" />
                    <xs:attribute name="gate" type="boolean" />
                    <xs:attribute name="buildatshipyard" type="boolean" />
                    <xs:attribute name="spawninsector" type="boolean" />
                    <xs:attribute name="spwanoutofsector" type="boolean" />
                    <xs:attribute name="chancedocked">
                      <xs:simpleType>
                        <xs:restriction base="xs:integer">
                          <xs:minInclusive value="0" />
                          <xs:maxInclusive value="100" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>
                <xs:element name="position" type="positionrange" minOccurs="0" maxOccurs="1" />
                <xs:element name="modifiers">
                  <xs:annotation>
                    <xs:documentation>
                      Modifiers
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="commandeerable" type="boolean" />
                    <xs:attribute name="invincible" type="boolean" />
                    <xs:attribute name="rebuild" type="boolean" />
                    <xs:attribute name="subordinate" type="boolean" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="time">
                  <xs:annotation>
                    <xs:documentation>
                      Job timing
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="interval" use="required">
                      <xs:annotation>
                        <xs:documentation>
                          Minimum job processing interval with +/- 25% random variation
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:double">
                          <xs:minExclusive value="0" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="start">
                      <xs:annotation>
                        <xs:documentation>
                          First job processing time (interval without variation is used if not specified)
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:double">
                          <xs:minInclusive value="0" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>
                <xs:element name="expirationtime">
                  <xs:annotation>
                    <xs:documentation>
                      Job expiration time (affects script property .jobexpired). Some time after destruction, the object will be re-created by job engine.
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:attribute name="min" use="required">
                      <xs:annotation>
                        <xs:documentation>
                          Minimum expiration time in seconds
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:double">
                          <xs:minExclusive value="0" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="max">
                      <xs:annotation>
                        <xs:documentation>
                          Maximum expiration time in seconds
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:double">
                          <xs:minExclusive value="0" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
              <xs:choice>
                <xs:sequence>
                  <xs:element name="ship">
                    <xs:annotation>
                      <xs:documentation>
                        Non-mass-traffic ship definition
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:group ref="createship" />
                      <xs:attributeGroup ref="createship" />
                      <xs:attribute name="comment" type="comment" />
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="subordinates" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Subordinates
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:element name="subordinate">
                          <xs:complexType>
                            <xs:attribute name="job" use="required" />
                            <xs:attribute name="rebuild" type="booleanexpression" use="optional" />
                          </xs:complexType>
                          <!-- 
                          <xs:keyref name="subordinate_job" refer="job_id">
                            <xs:selector xpath="." />
                            <xs:field xpath="@job" />
                          </xs:keyref>
 -->
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:element name="masstraffic">
                  <xs:annotation>
                    <xs:documentation>
                      Mass-traffic ship definition
                    </xs:documentation>
                  </xs:annotation>
                  <xs:complexType>
                    <xs:group ref="createship" />
                    <xs:attributeGroup ref="createship" />
                    <xs:attribute name="relaunchdelay" type="xs:float">
                      <xs:annotation>
                        <xs:documentation>
                          The minimum delay between a mass traffic object from this job arriving and a new one appearing (defaults to 0)
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="respawndelay" type="xs:float">
                      <xs:annotation>
                        <xs:documentation>
                          The minimum delay between a mass traffic object from this job being destroyed and a new one appearing (defaults to 0)
                        </xs:documentation>
                      </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="comment" type="comment" />
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="id" type="idname" use="required">
              <xs:annotation>
                <xs:documentation>
                  ID
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="name">
              <xs:annotation>
                <xs:documentation>
                  Name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="description">
              <xs:annotation>
                <xs:documentation>
                  Description
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="disabled">
              <xs:annotation>
                <xs:documentation>
                  Skips loading of the job completely, as if commented out (defaults to false)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="startactive" type="boolean">
              <xs:annotation>
                <xs:documentation>
                  Default active state (defaults to true) - should not be true when defining wing quota
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="fullname" type="boolean">
              <xs:annotation>
                <xs:documentation>
                  Allow including ship type and variation in ship name? Defaults to true
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="ignorecommanderwares" type="boolean">
              <xs:annotation>
                <xs:documentation>
                  Skip checks which enforce the basket wares match with the commanders production wares (defaults to false)
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="comment" type="comment" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="job_id">
      <xs:selector xpath="job" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

  <xs:complexType name="godlocationfilters">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="corerange" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location filter by the range to the sector core which is based on jumpgates and highways. 0 to 1 is within the core. Values exceeding 1 will place the object beyond the core boundary by that factor
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:float" />
          <xs:attribute name="max" type="xs:float" />
        </xs:complexType>
      </xs:element>
      <xs:element name="economy" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location filter by economy value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min">
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minInclusive value="0.0" />
                <xs:maxInclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="max">
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minInclusive value="0.0" />
                <xs:maxInclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="maxbound" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Is the location rejected if its economy level exceeds the 'max' value? If false, location is treated as if it has the 'max' value (defaults to true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="region" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location filter by region wares
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="matchall" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Match all wares? Defaults to false
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="min" type="xs:integer">
            <xs:annotation>
              <xs:documentation>
                The minimum distance the location should be from a region of the specified type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:integer">
            <xs:annotation>
              <xs:documentation>
                The maximum distance the location should be from a region of the specified type.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ware" type="expression" use="required" />
        </xs:complexType>
      </xs:element>
      <xs:element name="security" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location filter by security value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min">
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minInclusive value="0.0" />
                <xs:maxInclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="max">
            <xs:simpleType>
              <xs:restriction base="xs:float">
                <xs:minInclusive value="0.0" />
                <xs:maxInclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="sunlight" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Location filter by sunlight value
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="min" type="xs:integer" />
          <xs:attribute name="max" type="xs:integer" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="macro" />
    <xs:attribute name="class" />
    <xs:attribute name="faction" />
    <xs:attribute name="relation" type="relationlookup">
      <xs:annotation>
        <xs:documentation>
          Relation range
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comparison" type="relationcomparison" />
    <xs:attribute name="excluderinghighway" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Exclude placement along ring highways
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="solitary" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Is this object to be placed in a zone only inhabited by itself
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="newzonechance" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Chance (0.0 to 1.0) of the god entry to not attempt to be placed in an existing zone and instead create a new zone. No effect if a zone macro is specified.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="coreboundaryzoneheight" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Height range in meters of which new zones are allowed to be placed in the sector at the core boundary. Allowed height range reduces within the core boundary and increases out of it.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:group name="godentry">
    <xs:sequence>
      <xs:element name="quota" type="basegodquota" minOccurs="0" maxOccurs="1" />
      <xs:element name="quotas" type="gamestartgodquotas" minOccurs="0" maxOccurs="1" />
      <xs:element name="location" type="godlocationfilters">
        <xs:annotation>
          <xs:documentation>
            Location filters
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="position" type="positionrange" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:group>

  <xs:element name="god">
    <xs:annotation>
      <xs:documentation>
        Root element of god.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="objects" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Object definitions
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="object" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>
                    Object definition
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:group ref="godentry" />
                    <xs:element name="object" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Object definition
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:group ref="createobject" />
                        <xs:attributeGroup ref="createobject" />
                        <xs:attribute name="state" type="componentstatelookup">
                          <xs:annotation>
                            <xs:documentation>
                              Object initial state
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="comment" type="comment" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="idname" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        ID
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="name">
                    <xs:annotation>
                      <xs:documentation>
                        Name
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="description">
                    <xs:annotation>
                      <xs:documentation>
                        Description
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="owner" type="rawfactionexprlookup">
                    <xs:annotation>
                      <xs:documentation>
                        Object owner faction (optional, defaults to ownerless)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="stations" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Station definitions
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="defaults" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>
                    Station defaults
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="location" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Default location parameters
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="corerange" minOccurs="0" maxOccurs="1">
                            <xs:annotation>
                              <xs:documentation>
                                Default placement range for god objects based on the core of the sector which is based on jumpgates and highways. 0 to 1 is within the core. Values exceeding 1 will place the object beyond the core boundary by that factor
                              </xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:attribute name="min" type="xs:float" />
                              <xs:attribute name="max" type="xs:float" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="newzonechance" type="xs:float">
                          <xs:annotation>
                            <xs:documentation>
                              Chance (0.0 to 1.0) of the god entry to not attempt to be placed in an existing zone and instead create a new zone. No effect if a zone macro is specified.
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="coreboundaryzoneheight" type="xs:float">
                          <xs:annotation>
                            <xs:documentation>
                              Default height range in meters of which new zones are allowed to be placed in the sector at the core boundary. Height range reduces within the core boundary and increases out of it.
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="modules" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Station module limits (defaults to 20 or limited by god defaults for god generated stations)
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attributeGroup ref="moduletypelimits" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="quota" type="basegodquota" minOccurs="0" maxOccurs="1" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="station" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>
                    Station definition
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:group ref="godentry" />
                    <xs:element name="station" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Station definition
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:group ref="createstation" />
                        <xs:attributeGroup ref="createstation" />
                        <xs:attribute name="comment" type="comment" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="idname" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        ID
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="name">
                    <xs:annotation>
                      <xs:documentation>
                        Name
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="description">
                    <xs:annotation>
                      <xs:documentation>
                        Description
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="owner" type="rawfactionexprlookup" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Station owner faction
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="race" type="racelookup" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Station entry race
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="type" type="modulesettypelookup">
                    <xs:annotation>
                      <xs:documentation>
                        Module set type
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="set">
                    <xs:annotation>
                      <xs:documentation>
                        Module set (supersedes using 'race' and 'type' to select a set)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="products" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Production definitions
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="product" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>
                    Product definition
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:group ref="godentry" />
                    <xs:element name="module" minOccurs="0" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Module definition
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:group ref="createmodule" />
                        <xs:attributeGroup ref="createmodule" />
                        <xs:attribute name="comment" type="comment" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="id" type="idname" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        ID
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="name">
                    <xs:annotation>
                      <xs:documentation>
                        Name
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="description">
                    <xs:annotation>
                      <xs:documentation>
                        Description
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="ware" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Production ware
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="owner" type="rawfactionexprlookup" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Factory owner faction
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="type" type="modulesettypelookup">
                    <xs:annotation>
                      <xs:documentation>
                        Module set type
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="set">
                    <xs:annotation>
                      <xs:documentation>
                        Module set (supersedes using 'race' and 'type' to select a set)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="jobquotas">
    <xs:attribute name="galaxy" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Quota for the whole galaxy, which the job engine will attempt to populate. May be exceeded by requested job ships.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxgalaxy" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Maximum quota for the whole galaxy, after which the job engine will attempt to remove ships. May be exceeded by requested job ships. (defaults to galaxy quota)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="wing" type="xs:integer" />
    <xs:attribute name="cluster" type="xs:integer" />
    <xs:attribute name="sector" type="xs:integer" />
    <xs:attribute name="zone" type="xs:integer" />
    <xs:attribute name="station" type="comment" />
    <xs:attribute name="variation" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Variation, requires wing attribute
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:complexType name="basejobquota">
    <xs:annotation>
      <xs:documentation>
        Quotas across all gamestarts
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="jobquotas"/>
  </xs:complexType>

  <xs:complexType name="gamestartjobquota">
    <xs:annotation>
      <xs:documentation>
        Quota entry for gamestart (or default if 'gamestart' omitted)
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="jobquotas"/>
    <xs:attribute name="gamestart" type="namestring"/>
  </xs:complexType>

  <xs:complexType name="gamestartjobquotas">
    <xs:annotation>
      <xs:documentation>
        Quotas optionally filtered by gamestart
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="quota" type="gamestartjobquota" minOccurs="1" maxOccurs="unbounded"/>
    </xs:choice>
  </xs:complexType>

  <xs:attributeGroup name="godquotas">
    <xs:attribute name="galaxy" type="xs:integer" />
    <xs:attribute name="cluster" type="xs:integer" />
    <xs:attribute name="sector" type="xs:integer" />
    <xs:attribute name="zone" type="xs:integer" />
  </xs:attributeGroup>

  <xs:complexType name="basegodquota">
    <xs:annotation>
      <xs:documentation>
        Quotas across all gamestarts
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="godquotas"/>
  </xs:complexType>

  <xs:complexType name="gamestartgodquota">
    <xs:annotation>
      <xs:documentation>
        Quota entry for gamestart (or default if 'gamestart' omitted)
      </xs:documentation>
    </xs:annotation>
    <xs:attributeGroup ref="godquotas"/>
    <xs:attribute name="gamestart" type="namestring"/>
  </xs:complexType>

  <xs:complexType name="gamestartgodquotas">
    <xs:annotation>
      <xs:documentation>
        Quotas optionally filtered by gamestart
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="quota" type="gamestartgodquota" minOccurs="1" maxOccurs="unbounded"/>
    </xs:choice>
  </xs:complexType>

  <xs:element name="defaults">
    <xs:annotation>
      <xs:documentation>
        Root element of mapdefaults.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="dataset" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Macro definitions
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="properties">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="boundaries" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:attribute name="priority" type="xs:int">
                          <xs:annotation>
                            <xs:documentation>
                              Priority
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="identification" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:attribute name="name">
                          <xs:annotation>
                            <xs:documentation>
                              Name
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="description">
                          <xs:annotation>
                            <xs:documentation>
                              Description
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="system" type="xs:unsignedInt">
                          <xs:annotation>
                            <xs:documentation>
                              System (raw text ID)
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="sounds" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="music" minOccurs="0" maxOccurs="1">
                            <xs:complexType>
                              <xs:attribute name="ref" type="xs:string">
                                <xs:annotation>
                                  <xs:documentation>
                                    Music reference (see sound_library.xml)
                                  </xs:documentation>
                                </xs:annotation>
                              </xs:attribute>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="fightmusic" minOccurs="0" maxOccurs="1">
                            <xs:complexType>
                              <xs:attribute name="ref" type="xs:string">
                                <xs:annotation>
                                  <xs:documentation>
                                    Fight music reference (see sound_library.xml)
                                  </xs:documentation>
                                </xs:annotation>
                              </xs:attribute>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="area" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:attribute name="sunlight">
                          <xs:annotation>
                            <xs:documentation>
                              Sunlight
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:float">
                              <xs:minInclusive value="0.0" />
                              <xs:maxInclusive value="1.0" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="economy">
                          <xs:annotation>
                            <xs:documentation>
                              Economy
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:float">
                              <xs:minInclusive value="0.0" />
                              <xs:maxInclusive value="1.0" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="security">
                          <xs:annotation>
                            <xs:documentation>
                              Security
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:float">
                              <xs:minInclusive value="0.0" />
                              <xs:maxInclusive value="1.0" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="backgroundcolor" minOccurs="0" maxOccurs="1">
                      <xs:complexType>
                        <xs:attribute name="r">
                          <xs:annotation>
                            <xs:documentation>
                              Red
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:int">
                              <xs:minInclusive value="0" />
                              <xs:maxInclusive value="255" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="g">
                          <xs:annotation>
                            <xs:documentation>
                              Green
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:int">
                              <xs:minInclusive value="0" />
                              <xs:maxInclusive value="255" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="b">
                          <xs:annotation>
                            <xs:documentation>
                              Blue
                            </xs:documentation>
                          </xs:annotation>
                          <xs:simpleType>
                            <xs:restriction base="xs:int">
                              <xs:minInclusive value="0" />
                              <xs:maxInclusive value="255" />
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>

                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="macro" type="xs:string">
              <xs:annotation>
                <xs:documentation>
                  Macro name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="loadoutruletypes">
    <xs:restriction base="xs:string">
      <xs:enumeration value="" />
      <xs:enumeration value="default" />
      <xs:enumeration value="player" />
      <xs:enumeration value="xenon" />
      <xs:enumeration value="shipyard" />
      <xs:enumeration value="military" />
      <xs:enumeration value="highvalue" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="unitcategories">
    <xs:restriction base="xs:string">
      <xs:enumeration value="" />
      <xs:enumeration value="build" />
      <xs:enumeration value="defence" />
      <xs:enumeration value="gascollector" />
      <xs:enumeration value="orecollector" />
      <xs:enumeration value="police" />
      <xs:enumeration value="repair" />
      <xs:enumeration value="transport" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="deployablecategories">
    <xs:restriction base="xs:string">
      <xs:enumeration value="" />
      <xs:enumeration value="mine" />
      <xs:enumeration value="lasertower" />
      <xs:enumeration value="navbeacon" />
      <xs:enumeration value="resourceprobe" />
      <xs:enumeration value="satellite" />
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="loadoutrulemacro">
    <xs:attribute name="mk" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          The mk number of the unit/deployable category
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macro" type="macroname">
      <xs:annotation>
        <xs:documentation>
          Unit macro
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Space-separated list of tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="factions" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Space-separated list of factions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="restricted" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Use is restricted
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="loadoutrule">
    <xs:attribute name="mk" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          The mk number of the unit/deployable category
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="weight" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Weighting for distribution over unit/deployable capacity
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="requiredocking" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Entry will only be processed for objects that have at least one dockingbay allowing a unit/deployable of the matching size to dock
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="requireundocking" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Entry will only be processed for objects that have at least one dockingbay allowing a unit/deployable of the matching size to undock
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="important" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Unit type is important for the operation of the ship/station, the system will attempt to ensure at least one unit/deployable of this type is added
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cargotags" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry will only be processed for objects where available storage supports cargo of at least one of the specified tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="factiontags" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry will only be processed for objects where the owner faction matches at least one of the specified tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="classes" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          If non-empty, entry will only be processed for objects matching exactly one of the specified class(es)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="purposes" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          If non-empty, entry will only be processed for objects that have a primary pruposes matching exactly one of the the specified purpose(s)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="rules">
    <xs:annotation>
      <xs:documentation>
        Loadout rules root node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="unit" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="macros" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="macro" minOccurs="1" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:attribute name="category" type="unitcategories">
                          <xs:annotation>
                            <xs:documentation>
                              Unit category
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attributeGroup ref="loadoutrulemacro" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="rules" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ruleset" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="rule" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:attribute name="category" type="unitcategories">
                                <xs:annotation>
                                  <xs:documentation>
                                    Unit category
                                  </xs:documentation>
                                </xs:annotation>
                              </xs:attribute>
                              <xs:attributeGroup ref="loadoutrule" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="type" type="loadoutruletypes">
                          <xs:annotation>
                            <xs:documentation>
                              Loadout rule type
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="waregroups" type="xs:string">
                          <xs:annotation>
                            <xs:documentation>
                              Space separated list of waregroup names. The wares associated with these groups will be checked against the products and tradewares of the station to see if it fits into this category
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="deployable" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="macros" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="macro" minOccurs="1" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:attribute name="category" type="deployablecategories">
                          <xs:annotation>
                            <xs:documentation>
                              Deployable category
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attributeGroup ref="loadoutrulemacro" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="rules" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ruleset" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="rule" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:attribute name="category" type="deployablecategories">
                                <xs:annotation>
                                  <xs:documentation>
                                    Deployable category
                                  </xs:documentation>
                                </xs:annotation>
                              </xs:attribute>
                              <xs:attributeGroup ref="loadoutrule" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="type" type="loadoutruletypes">
                          <xs:annotation>
                            <xs:documentation>
                              Loadout rule type
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="waregroups" type="xs:string">
                          <xs:annotation>
                            <xs:documentation>
                              Space separated list of waregroup names. The wares associated with these groups will be checked against the products and tradewares of the station to see if it fits into this category
                            </xs:documentation>
                          </xs:annotation>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="blendmodelookup">
    <xs:restriction base="xs:string">
      <!-- <xs:enumeration value="UNDEFINED" /> -->
      <!-- <xs:enumeration value="DEFAULT" /> -->
      <xs:enumeration value="NONE" />
      <xs:enumeration value="WIREFRAME" />
      <xs:enumeration value="WIREFRAME_NOCULLING" />
      <xs:enumeration value="TWOSIDED" />
      <xs:enumeration value="ALPHA1" />
      <xs:enumeration value="ALPHA1NOG" />
      <xs:enumeration value="SOLID_FADING" />
      <xs:enumeration value="ALPHA1_FADING" />
      <xs:enumeration value="LINEDRAW" />
      <xs:enumeration value="ALPHA8" />
      <xs:enumeration value="PREALPHA8" />
      <xs:enumeration value="SCREEN" />
      <xs:enumeration value="ADDITIVE" />
      <xs:enumeration value="ADDITIVE_SS" />
      <xs:enumeration value="MULTIPLY" />
      <xs:enumeration value="SUBSTRACTIVE" />
      <xs:enumeration value="SRCCOLOR" />
      <xs:enumeration value="HAZEBLEND" />
      <xs:enumeration value="ALPHA8_ANARK" />
      <xs:enumeration value="SCREEN_ANARK" />
      <xs:enumeration value="MULTIPLY_ANARK" />
      <xs:enumeration value="OVERLAY_ANARK" />
      <xs:enumeration value="BLEACH_ANARK" />
      <xs:enumeration value="GHOST_ANARK" />
      <xs:enumeration value="SATURATE_ANARK" />
      <xs:enumeration value="SCREEN_GLOW" />
      <xs:enumeration value="ADDITIVE_GLOW" />
      <xs:enumeration value="WIREFRAME_OVERLAY" />
      <xs:enumeration value="ALPHA8_OVERLAY" />
      <xs:enumeration value="ALPHA8_SINGLE" />
      <xs:enumeration value="ADDITIVE_SINGLE" />
      <xs:enumeration value="DISTORTION" />
      <xs:enumeration value="HAIR" />
      <xs:enumeration value="PLANET_ATMOSPHERE" />
      <xs:enumeration value="TESSELLATION" />
    </xs:restriction>
  </xs:simpleType>

  <xs:element name="materiallibrary">
    <xs:annotation>
      <xs:documentation>
        Root element of material_library.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="collection">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="material" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="properties">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:attribute name="name" use="required" />
                              <xs:attribute name="language" type="xs:integer" />
                              <xs:attribute name="type">
                                <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                    <xs:enumeration value="Float" />
                                    <xs:enumeration value="BitMap" />
                                    <xs:enumeration value="Int" />
                                    <xs:enumeration value="Integer" />
                                    <xs:enumeration value="Color" />
                                  </xs:restriction>
                                </xs:simpleType>
                              </xs:attribute>
                              <xs:attribute name="value" />
                              <xs:attribute name="preload" />
                              <xs:attribute name="r" />
                              <xs:attribute name="g" />
                              <xs:attribute name="b" />
                              <xs:attribute name="a" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="variations" minOccurs="0" maxOccurs="1" />
                    <xs:element name="areas" minOccurs="0" maxOccurs="1" />
                  </xs:sequence>
                  <xs:attribute name="name" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Name
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="shader" use="required" />
                  <xs:attribute name="blendmode" type="blendmodelookup" use="required" />
                  <xs:attribute name="priority" type="xs:integer" />
                  <xs:attribute name="preview" />
                  <xs:attribute name="ref" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        Source material (must appear earlier in the file)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" use="required">
              <xs:annotation>
                <xs:documentation>
                  Name
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
           </xs:complexType>
          <xs:key name="material_name">
            <xs:selector xpath="material" />
            <xs:field xpath="@name" />
          </xs:key>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="collection_name">
      <xs:selector xpath="collection" />
      <xs:field xpath="@name" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <!-- ===== Text simple types ===== -->

  <xs:simpleType name="cuename">
    <xs:annotation>
      <xs:documentation>
        Cue name
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="expression" />
  </xs:simpleType>

  <!-- ===== Enumeration simple types ===== -->

  <xs:simpleType name="missiontypelookup">
    <xs:annotation>
      <xs:documentation>
        Mission type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="missiontype.plot" />
          <xs:enumeration value="missiontype.trade" />
          <xs:enumeration value="missiontype.fight" />
          <xs:enumeration value="missiontype.build" />
          <xs:enumeration value="missiontype.think" />
          <xs:enumeration value="missiontype.station" />
          <xs:enumeration value="missiontype.chain" />
          <xs:enumeration value="missiontype.other" />
          <xs:enumeration value="missiontype.board" />
          <xs:enumeration value="missiontype.collect" />
          <xs:enumeration value="missiontype.deliver" />
          <xs:enumeration value="missiontype.destroy" />
          <xs:enumeration value="missiontype.drop" />
          <xs:enumeration value="missiontype.escort" />
          <xs:enumeration value="missiontype.explore" />
          <xs:enumeration value="missiontype.extend" />
          <xs:enumeration value="missiontype.find" />
          <xs:enumeration value="missiontype.follow" />
          <xs:enumeration value="missiontype.guidance" />
          <xs:enumeration value="missiontype.hack" />
          <xs:enumeration value="missiontype.kill" />
          <xs:enumeration value="missiontype.patrol" />
          <xs:enumeration value="missiontype.pickup" />
          <xs:enumeration value="missiontype.procure" />
          <xs:enumeration value="missiontype.protect" />
          <xs:enumeration value="missiontype.race" />
          <xs:enumeration value="missiontype.raid" />
          <xs:enumeration value="missiontype.repair" />
          <xs:enumeration value="missiontype.rescue" />
          <xs:enumeration value="missiontype.research" />
		  <xs:enumeration value="missiontype.restock" />
          <xs:enumeration value="missiontype.scan" />
          <xs:enumeration value="missiontype.smuggle" />
          <xs:enumeration value="missiontype.talkto" />
          <xs:enumeration value="missiontype.transport" />
          <xs:enumeration value="missiontype.intelligence" />
          <xs:enumeration value="missiontype.military" />
          <xs:enumeration value="missiontype.police" />
          <xs:enumeration value="missiontype.upkeep_extend" />
          <xs:enumeration value="missiontype.upkeep_hirenpc" />
          <xs:enumeration value="missiontype.upkeep_credits" />
          <xs:enumeration value="missiontype.upkeep_subordinates" />
          <xs:enumeration value="missiontype.upkeep_units" />
          <xs:enumeration value="missiontype.tutorial" />
          <xs:enumeration value="missiontype.completed_tutorial" />
          <xs:enumeration value="missiontype.hints" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="objectivetypelookup">
    <xs:annotation>
      <xs:documentation>
        Objective action type
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="objective.custom">
            <xs:annotation>
              <xs:documentation>
                Custom objective action, requires attribute customaction
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.none">
            <xs:annotation>
              <xs:documentation>
                No objective
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.achieve_coverage">
            <xs:annotation>
              <xs:documentation>
                Achieve Coverage
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.acquire_crew">
            <xs:annotation>
              <xs:documentation>
                Acquire crew
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.acquire_units">
            <xs:annotation>
              <xs:documentation>
                Acquire units
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.activate">
            <xs:annotation>
              <xs:documentation>
                Activate something
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.assign_subordinate">
            <xs:annotation>
              <xs:documentation>
                Assign subordinate
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.attack">
            <xs:annotation>
              <xs:documentation>
                Attack object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.board">
            <xs:annotation>
              <xs:documentation>
                Board object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.build_module">
            <xs:annotation>
              <xs:documentation>
                Build module
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.build_ship">
            <xs:annotation>
              <xs:documentation>
                Build ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.build_station">
            <xs:annotation>
              <xs:documentation>
                Build station
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.buy">
            <xs:annotation>
              <xs:documentation>
                Buy ware
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.collect">
            <xs:annotation>
              <xs:documentation>
                Collect
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.confiscate">
            <xs:annotation>
              <xs:documentation>
                Confiscate
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.craft">
            <xs:annotation>
              <xs:documentation>
                Craft
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.defend">
            <xs:annotation>
              <xs:documentation>
                Defend
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.deliver">
            <xs:annotation>
              <xs:documentation>
                Deliver ware
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.deploy">
            <xs:annotation>
              <xs:documentation>
                Deploy (satellite, mines)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.destroy">
            <xs:annotation>
              <xs:documentation>
                Destroy object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.disembark">
            <xs:annotation>
              <xs:documentation>
                Disembark from your ship (e.g. by using the spacesuit)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.dockat">
            <xs:annotation>
              <xs:documentation>
                Dock at object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.drop">
            <xs:annotation>
              <xs:documentation>
                Drop
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.embark">
            <xs:annotation>
              <xs:documentation>
                Embark a ship
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.enable">
            <xs:annotation>
              <xs:documentation>
                Enable
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.escort">
            <xs:annotation>
              <xs:documentation>
                Escort
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.exchange_wares">
            <xs:annotation>
              <xs:documentation>
                Exchange wares
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.explore">
            <xs:annotation>
              <xs:documentation>
                Explore
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.extend">
            <xs:annotation>
              <xs:documentation>
                Extend
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.equip">
            <xs:annotation>
              <xs:documentation>
                Equip
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.find">
            <xs:annotation>
              <xs:documentation>
                Find object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.flyto">
            <xs:annotation>
              <xs:documentation>
                Fly to location or object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.follow">
            <xs:annotation>
              <xs:documentation>
                Follow object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.getup">
            <xs:annotation>
              <xs:documentation>
                Get up (from chair)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.guidance">
            <xs:annotation>
              <xs:documentation>
                Get up (from chair)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.goto">
            <xs:annotation>
              <xs:documentation>
                Go to (on platform)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.hack">
            <xs:annotation>
              <xs:documentation>
                Hack an object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.gain_reputation">
            <xs:annotation>
              <xs:documentation>
                Gain reputation with a faction
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.investigate">
            <xs:annotation>
              <xs:documentation>
                Investigate some situation
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.join">
            <xs:annotation>
              <xs:documentation>
                Join a mission-subscription/squadron/...
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.kill">
            <xs:annotation>
              <xs:documentation>
                Kill actor
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.launch">
            <xs:annotation>
              <xs:documentation>
                Launch something (ship or missile)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.patrol">
            <xs:annotation>
              <xs:documentation>
                Patrol
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.pickup">
            <xs:annotation>
              <xs:documentation>
                Pick up object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.pickup_person">
            <xs:annotation>
              <xs:documentation>
                Pick up a person
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.police_scan">
            <xs:annotation>
              <xs:documentation>
                Police scan
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.protect">
            <xs:annotation>
              <xs:documentation>
                Protect object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.race">
            <xs:annotation>
              <xs:documentation>
                Race
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.repair">
            <xs:annotation>
              <xs:documentation>
                Repair
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.research">
            <xs:annotation>
              <xs:documentation>
                Research 
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.restock">
            <xs:annotation>
              <xs:documentation>
                Restock
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.sabotage">
            <xs:annotation>
              <xs:documentation>
                Sabotage an object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.scan">
            <xs:annotation>
              <xs:documentation>
                Scan an object
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.secure">
            <xs:annotation>
              <xs:documentation>
                Secure (ship or location)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.sell">
            <xs:annotation>
              <xs:documentation>
                Sell ware
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.smuggle">
            <xs:annotation>
              <xs:documentation>
                Smuggle an item
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.steal">
            <xs:annotation>
              <xs:documentation>
                Steal
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.supply">
            <xs:annotation>
              <xs:documentation>
                Supply
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.support">
            <xs:annotation>
              <xs:documentation>
                Support
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.talkto">
            <xs:annotation>
              <xs:documentation>
                Talk to actor
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.track">
            <xs:annotation>
              <xs:documentation>
                Track
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.transport">
            <xs:annotation>
              <xs:documentation>
                Transport
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.undock">
            <xs:annotation>
              <xs:documentation>
                Return to your ship and undock
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.unlock">
            <xs:annotation>
              <xs:documentation>
                Unlock an object or location
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.upgrade">
            <xs:annotation>
              <xs:documentation>
                Upgrade
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="objective.wait">
            <xs:annotation>
              <xs:documentation>
                Wait
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="missiongrouplookup">
    <xs:annotation>
      <xs:documentation>
        Mission group lookup
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="expression">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="missiongroup.argon_police">
            <xs:annotation>
              <xs:documentation>
                Argon Police
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="missiongroup.argon_secret_service">
            <xs:annotation>
              <xs:documentation>
                Argon Secret Service
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="missiongroup.argon_war_holyorder">
            <xs:annotation>
              <xs:documentation>
                Argon Vs Holy Order war
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="missiongroup.argon_war_xenon">
            <xs:annotation>
              <xs:documentation>
                Argon Vs Xenon war
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="missiongroup.antigone_trade_guild">
            <xs:annotation>
              <xs:documentation>
                Antigone Trade Guild
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="missiongroup.scaleplate_pirates">
            <xs:annotation>
              <xs:documentation>
                Scale Plate Pact Pirates
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="missionthreadtypelookup">
    <xs:annotation>
      <xs:documentation>
        Mission thread types for missions and mission offers
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="parallel">
        <xs:annotation>
          <xs:documentation>
            Missions are active in parallel
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="sequential">
        <xs:annotation>
          <xs:documentation>
            Missions are played through sequentially
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="namespacelookup">
    <xs:annotation>
      <xs:documentation>
        Which cue is used as namespace?
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="this">
        <xs:annotation>
          <xs:documentation>
            Use &quot;this&quot; cue as namespace, even for instances: $foo == this.$foo
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="static">
        <xs:annotation>
          <xs:documentation>
            Same as &quot;this&quot;, but when instantiated, use the static cue: $foo == static.$foo
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="default">
        <xs:annotation>
          <xs:documentation>
            By default the namespace is inherited from the parent cue. The default for root cues is same as &quot;static&quot;.
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="todopriority">
    <xs:annotation>
      <xs:documentation>
        Priority of "todo" item
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="trivial">
        <xs:annotation>
          <xs:documentation>
            Trivial (nice to have)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="low">
        <xs:annotation>
          <xs:documentation>
            Low priority
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="medium">
        <xs:annotation>
          <xs:documentation>
            Medium priority
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="high">
        <xs:annotation>
          <xs:documentation>
            High priority
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="critical">
        <xs:annotation>
          <xs:documentation>
            Critical (game cannot ship without)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="onfaillookup">
    <xs:annotation>
      <xs:documentation>
        Action when cue conditions fail (optional)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="cancel">
        <xs:annotation>
          <xs:documentation>
            Cancel the cue when conditions fail
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="complete">
        <xs:annotation>
          <xs:documentation>
            Complete the cue when conditions fail
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="cuestatelookup">
    <xs:annotation>
      <xs:documentation>
        Cue state
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="cuestate.disabled">
        <xs:annotation>
          <xs:documentation>
            Disabled (no condition checks)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cuestate.waiting">
        <xs:annotation>
          <xs:documentation>
            Waiting (checking conditions)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cuestate.active">
        <xs:annotation>
          <xs:documentation>
            Active (running actions)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cuestate.complete">
        <xs:annotation>
          <xs:documentation>
            Complete (finished running actions)
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cuestate.cancelled">
        <xs:annotation>
          <xs:documentation>
            Cancelled
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- ===== Attribute groups ==== -->

  <xs:attributeGroup name="objective">
    <xs:attribute name="object" type="object" />
    <xs:attribute name="slot" type="expression">
      <xs:annotation>
        <xs:documentation>
          Component slot or list of component slots as objective targets (cannot be used in combination with any of the attributes object or group)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="expression">
      <xs:annotation>
        <xs:documentation>
          Group of objective targets (cannot be used in combination with any of the attributes object or slot)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="offset" type="offset" />
    <xs:attribute name="radius" type="expression">
      <xs:annotation>
        <xs:documentation>
          Optional radius associated with the objective. Default is 0
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="silent" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Change the objective silently? Default is false
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="action" type="objectivetypelookup" use="required" />
    <xs:attribute name="customaction" type="expression">
      <xs:annotation>
        <xs:documentation>
          Custom action text, required if action=&quot;custom&quot;
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="text" type="expression">
      <xs:annotation>
        <xs:documentation>
          Objective detail text
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="endtime" type="expression">
      <xs:annotation>
        <xs:documentation>
          Objective end time
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="checkunknown" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Should the target name be shown as unknown if the target is unknown? Default is false.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="step" type="expression">
      <xs:annotation>
        <xs:documentation>
          Briefing step (either as part of the briefing definition, or as reference to it when setting the objective)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="missiondetails">
    <xs:attribute name="name" type="expression">
      <xs:annotation>
        <xs:documentation>
          Mission name (required if mission or mission offer is created from scratch)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="expression">
      <xs:annotation>
        <xs:documentation>
          Mission description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="faction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Faction that offers the mission (required if mission or mission offer is created from scratch)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="opposingfaction" type="factionexprlookup">
      <xs:annotation>
        <xs:documentation>
          Opposition faction to be encountered during the mission
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="licence" type="expression">
      <xs:annotation>
        <xs:documentation>
          Licence required to accept the mission (licence faction must match 'faction')
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="missiontypelookup">
      <xs:annotation>
        <xs:documentation>
          (required if mission or mission offer is created from scratch)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="missiongrouplookup">
      <xs:annotation>
        <xs:documentation>
          Mission group (defined in missiongroups.xml)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="difficulty" type="levellookup" />
    <xs:attribute name="alertlevel" type="upkeepalertlevellookup" />
    <xs:attribute name="reward" type="expression">
      <xs:annotation>
        <xs:documentation>
          Money reward
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="rewardtext" type="expression">
      <xs:annotation>
        <xs:documentation>
          Arbitrary reward text (takes precedence if both money and text rewards are specified)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="abortable" type="booleanexpression">
      <xs:annotation>
        <xs:documentation>
          Is this mission abortable? (Only used for missions, has no effect on mission offers)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="associated" type="expression">
      <xs:annotation>
        <xs:documentation>
          Object that is associated with this mission (e.g. an NPC)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="scantarget" type="expression">
      <xs:annotation>
        <xs:documentation>
          Class, macro or object to be set as the long range scan target (can also be 0 to clear the long range scan target when updating a mission)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- ===== Complex types ==== -->

  <xs:complexType name="cuedoc">
    <xs:sequence>
      <xs:element name="content" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="reference" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Cue reference
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="name" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Cue name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="version" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="number" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Internal version number
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="date" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Date of current version
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="status" type="versionstatus">
            <xs:annotation>
              <xs:documentation>
                Status of current version
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="history" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="change" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="author" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Author name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="date" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Date of change
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="description" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Change description
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="todo" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="item" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="author" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Author name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="date" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Date of change
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="description" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Description of change
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="priority" type="todopriority">
                  <xs:annotation>
                    <xs:documentation>
                      Priority of change
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="objectiveprogress">
    <xs:annotation>
      <xs:documentation>
        Objective progress data for progress bar display
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="text" type="expression">
      <xs:annotation>
        <xs:documentation>
          Progress display text string (if provided, it's shown in message ticker with progress value, otherwise a progress bar is shown)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="expression" use="required">
      <xs:annotation>
        <xs:documentation>
          Max progress count (rounded to an integer)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="progress" type="expression">
      <xs:annotation>
        <xs:documentation>
          Current progress count (rounded to an integer, default is 0 if not supplied)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="objective">
    <xs:annotation>
      <xs:documentation>
        Mission objective
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="progress" type="objectiveprogress" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attributeGroup ref="objective" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- ===== Groups ==== -->

  <xs:group name="missiondetails">
    <xs:sequence>
      <xs:element name="briefing">
        <xs:annotation>
          <xs:documentation>
            Definition of briefing steps
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="objective" type="objective" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
          <xs:attribute name="replace" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Replace briefing steps, i.e. discard all existing steps? This is supported for &lt;update_offer&gt;, &gt;create_mission&gt; (with attribute offercue) and &lt;update_mission&gt;. Default is false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
        <xs:key name="briefing_objective_step">
          <xs:selector xpath="objective" />
          <xs:field xpath="@step" />
        </xs:key>
      </xs:element>
    </xs:sequence>
  </xs:group>
  
  <xs:group name="missionthreadoffer">
    <xs:sequence>
      <xs:element name="briefing">
        <xs:annotation>
          <xs:documentation>
            Definition of briefing steps
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="mission" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attributeGroup ref="missiondetails" />
                <xs:attribute name="step" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Briefing step (either as part of the briefing definition, or as reference to it when setting the objective)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="replace" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Replace briefing steps, i.e. discard all existing steps? This is supported for &lt;update_offer&gt;, &gt;create_mission&gt; (with attribute offercue) and &lt;update_mission&gt;. Default is false.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
        <xs:key name="briefing_mission_thread_step">
          <xs:selector xpath="mission" />
          <xs:field xpath="@step" />
        </xs:key>
      </xs:element>
    </xs:sequence>
  </xs:group>

  <!-- ===== Conditions ==== -->

  <xs:group name="specificconditions_event">
    <xs:choice>

      <xs:element name="event_briefing_started">
        <xs:annotation>
          <xs:documentation>
            Event for when a briefing is started for a mission or mission offer (object = cue, param = list of rendertarget names)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_briefing_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a briefing is cancelled (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_briefing_submission_selected">
        <xs:annotation>
          <xs:documentation>
            Event for when a submission selection is made in a briefing is started for a mission thread or mission thread offer (object = submission cue, param = list of rendertarget names)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_briefing_submission_unselected">
        <xs:annotation>
          <xs:documentation>
            Event for when a submission is unselected in a mission thread related briefing (object = submission cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cue_activated">
        <xs:annotation>
          <xs:documentation>
            Event for when a cue is activated (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cue_cancelled">
        <xs:annotation>
          <xs:documentation>
            Event for when a cue is cancelled (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cue_completed">
        <xs:annotation>
          <xs:documentation>
            Event for when a cue is completed (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_cue_signalled">
        <xs:annotation>
          <xs:documentation>
            Event for when a cue is signalled (object = cue). Default is this cue if no cue is specified. (param = Script parameter passed from &lt;signal_cue_instantly&gt;)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_guidance_disabled">
        <xs:annotation>
          <xs:documentation>
            Event for when mission guidance is disabled for a mission (object = mission cue). NOTE: Under normal circumstances, this event should not have an effect on a mission.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_guidance_enabled">
        <xs:annotation>
          <xs:documentation>
            Event for when mission guidance is enabled for a mission (object = cue). NOTE: Under normal circumstances, this event should not have an effect on a mission.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_mission_aborted">
        <xs:annotation>
          <xs:documentation>
            Event for when a mission is aborted by the player (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_npc_created">
        <xs:annotation>
          <xs:documentation>
            Event for when a npc is created (param = npc actor)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_offer_accepted">
        <xs:annotation>
          <xs:documentation>
            Event for when a cue offer is accepted (object = cue)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="event_platform_actor_created">
        <xs:annotation>
          <xs:documentation>
            Event for when a character is created on a platform by platform population system, or manually by &lt;create_platform_actor&gt; (param = actor, param2 = entity type, param3 = true iff actor is a representative)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="actor" type="actor" />
          <xs:attribute name="type" type="entitytypeexprlookup" />
          <xs:attribute name="representative" type="expression">
            <xs:annotation>
              <xs:documentation>
                Is actor a representative?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_triggered">
        <xs:annotation>
          <xs:documentation>
            Event for when a marine commander starts a boarding operation (param = commander, param2 = target to be boarded, param3 = boarder faction)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="boarder" type="expression">
            <xs:annotation>
              <xs:documentation>
                The marine commander that controls the boarding operation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="expression">
            <xs:annotation>
              <xs:documentation>
                The target object to be boarded
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="expression">
            <xs:annotation>
              <xs:documentation>
                The boarder faction, which is trying to take ownership of the target
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="event_boarding_support_requested">
        <xs:annotation>
          <xs:documentation>
            Event for when a boarding commander requests support by the player (param = commander, param2 = object being boarded, param3 = forced mission (0 should mean no forced mission))
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="eventcondition" />
          <xs:attribute name="boarder" type="expression">
            <xs:annotation>
              <xs:documentation>
                The platform commander requesting support
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="boarded" type="expression">
            <xs:annotation>
              <xs:documentation>
                The object being boarded by the commander requesting support
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <xs:group name="specificconditions_nonevent">
    <xs:choice>

      <xs:element name="cue_is_active">
        <xs:annotation>
          <xs:documentation>
            Cue is in active state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cue_is_cancelled">
        <xs:annotation>
          <xs:documentation>
            Cue is in cancelled state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cue_is_complete">
        <xs:annotation>
          <xs:documentation>
            Cue is in complete state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cue_is_disabled">
        <xs:annotation>
          <xs:documentation>
            Cue is in disabled state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cue_is_waiting">
        <xs:annotation>
          <xs:documentation>
            Cue is in waiting state
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="guidance_is_active">
        <xs:annotation>
          <xs:documentation>
            Mission guidance is active for the mission cue. NOTE: Under normal circumstances, this information should not have an effect on a mission.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="noneventcondition" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <!--
  XML restriction: Elements with the same name and in the same scope must have the same type.
  Which means that check_all / check_any always have to behave the same, even if we know whether
  they are allowed to have event conditions or not. So we always allow them.
  -->

  <xs:group name="conditions_single_nonevent">
    <xs:choice>
      <xs:group ref="commonconditions_nonevent" />
      <xs:group ref="specificconditions_nonevent" />
    </xs:choice>
  </xs:group>

  <xs:group name="conditions_single_event">
    <xs:choice>
      <xs:group ref="commonconditions_event" />
      <xs:group ref="specificconditions_event" />
    </xs:choice>
  </xs:group>

  <xs:group name="conditions">
    <xs:sequence>
      <xs:group ref="conditions_single_event" minOccurs="0" maxOccurs="1"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="check_all" type="checkall"/>
        <xs:element name="check_any" type="checkany"/>
        <xs:group ref="conditions_single_nonevent"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:complexType name="checkall">
    <xs:annotation>
      <xs:documentation>
        List of conditions all of which must be met
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="conditions"/>
    <xs:attributeGroup ref="condition" />
    <xs:attributeGroup ref="counting" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:complexType>

  <xs:complexType name="checkany">
    <xs:annotation>
      <xs:documentation>
        List of conditions any one of which must be met
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="check_all" type="checkall"/>
        <xs:element name="check_any" type="checkany"/>
        <xs:group ref="conditions_single_event"/>
        <xs:group ref="conditions_single_nonevent"/>
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="condition" />
    <xs:attributeGroup ref="counting" />
    <xs:attribute name="negate" type="negatecondition" />
  </xs:complexType>

  <!-- ===== Actions ==== -->

  <xs:group name="specificactions">
    <xs:choice>

      <xs:element name="quit_gameover">
        <xs:annotation>
          <xs:documentation>
            Show Game-over menu
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="quit_to_desktop">
        <xs:annotation>
          <xs:documentation>
            Quit to desktop
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="quit_to_startmenu">
        <xs:annotation>
          <xs:documentation>
            Quit to startmenu
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="capture_movie_start">
        <xs:annotation>
          <xs:documentation>
            Start capturing a movie (to stop capture, see capture_movie_stop)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="capture_movie_stop">
        <xs:annotation>
          <xs:documentation>
            Stop capturing a movie
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="capture_screen">
        <xs:annotation>
          <xs:documentation>
            Make a screenshot (optional in a subdirectory)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="directory" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sub-folder of the personal screenshot folder where the screenshot will be stored (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="benchmark_start">
        <xs:annotation>
          <xs:documentation>
            Enable Benchmarking (until we call benchmark_stop)
            Note: This action is only available in egosoft-internal builds with benchmarking enabled
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="directory" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sub-folder of the personal folder where the benchmarking results will be stored (optional)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="benchmark_stop">
        <xs:annotation>
          <xs:documentation>
            Disable Benchmarking (has to be previously started with benchmark_start)
            Note: This action is only available in egosoft-internal builds with benchmarking enabled
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>


      <xs:element name="activate_mission">
        <xs:annotation>
          <xs:documentation>
            Activate an existing mission associated with a cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cancel_cue">
        <xs:annotation>
          <xs:documentation>
            Cancel cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="complete_cue">
        <xs:annotation>
          <xs:documentation>
            Complete cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_cue_actor">
        <xs:annotation>
          <xs:documentation>
            Create an actor object and associate it with this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="createnpc" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="createnpc" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="name" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_mission">
        <xs:annotation>
          <xs:documentation>
            Create a mission and associate it with this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="missiondetails" minOccurs="0" maxOccurs="1" />
            <xs:element name="objective" type="objective" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="offercue" type="expression">
            <xs:annotation>
              <xs:documentation>
                Cue associated with a mission offer, whose properties will be copied to the mission. The other mission parameters are optional if offercue is supplied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                End time of the mission
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="activate" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Should mission become active if there is already another mission? Default is true. (Setting to false also prevents the mission being activated automatically when another mission gets deactivated.)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="missionthread" type="expression">
            <xs:annotation>
              <xs:documentation>
                The cue of the mission thread
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="beforemissioncue" type="expression">
            <xs:annotation>
              <xs:documentation>
                Mission cue to insert this thread before in the mission-thread
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="accept_offer">
        <xs:annotation>
          <xs:documentation>
            Create the accept event for the mission offer cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_offer">
        <xs:annotation>
          <xs:documentation>
            Create a mission offer and associate it with this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="missiondetails" minOccurs="0" maxOccurs="1" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="actor" type="expression">
            <xs:annotation>
              <xs:documentation>
                The actor making the mission offer, used to start the briefing conversation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="location" type="expression">
            <xs:annotation>
              <xs:documentation>
                The offer location component slot (if not supplied then the mission offer has no visible location)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="distance" type="expression">
            <xs:annotation>
              <xs:documentation>
                Distance from the offer location for the offer to be displayed in the BBS (unless hidden for another reason)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                Duration of the mission
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="hidden" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the offer hidden from the BBS? If true, the mission offer can only be found via the offer location.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space location or list of locations the player must be in for the mission to appear in the BBS (unless hidden for another reason)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>
      
      <xs:element name="create_mission_thread">
        <xs:annotation>
          <xs:documentation>
            Create a mission and associate it with this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="offercue" type="expression">
            <xs:annotation>
              <xs:documentation>
                Cue associated with a mission offer, whose properties will be copied to the mission. The other mission parameters are optional if offercue is supplied.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                End time of the mission
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="threadtype" type="missionthreadtypelookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The mission thread type of this offer
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_mission_thread_offer">
        <xs:annotation>
          <xs:documentation>
            Create a mission-thread offer and associate it with this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="missionthreadoffer" minOccurs="0" maxOccurs="1" />
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="actor" type="expression">
            <xs:annotation>
              <xs:documentation>
                The actor making the mission offer, used to start the briefing conversation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="location" type="expression">
            <xs:annotation>
              <xs:documentation>
                The offer location component slot (if not supplied then the mission offer has no visible location)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="distance" type="expression">
            <xs:annotation>
              <xs:documentation>
                Distance from the offer location for the offer to be displayed in the BBS (unless hidden for another reason)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                Duration of the mission
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="hidden" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Is the offer hidden from the BBS? If true, the mission offer can only be found via the offer location.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="space" type="expression">
            <xs:annotation>
              <xs:documentation>
                Space location or list of locations the player must be in for the mission to appear in the BBS (unless hidden for another reason)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="threadtype" type="missionthreadtypelookup" use="required">
            <xs:annotation>
              <xs:documentation>
                The mission thread type of this offer
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_platform_actor">
        <xs:annotation>
          <xs:documentation>
            Create an actor object on a platform manually and fire the corresponding &lt;event_platform_actor_created&gt; event.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="createnpc" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="createnpc" />
          <xs:attribute name="room" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                The room in which the actor should be created
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="entitytypeexprlookup" use="optional" />
          <xs:attribute name="post" type="controlpostexprlookup" use="optional" />
          <xs:attribute name="name" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_presentation_cluster">
        <xs:annotation>
          <xs:documentation>
            Create a presentation cluster for use by cutscene system (must be destroyed after use)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action"/>
          <xs:attribute name="name" type="lvaluename" use="required"/>
          <xs:attribute name="background" type="macro"/>
        </xs:complexType>
      </xs:element>

      <xs:element name="create_representative_actor">
        <xs:annotation>
          <xs:documentation>
            Create an faction representative actor on a random landing platform in the given sector, and fire the corresponding &lt;event_platform_actor_created&gt; event.
            If a representative already exists for this sector, no actor will be created; the result will be the existing actor.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="station" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Station on which the faction representative should be created
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="faction" type="factionexprlookup" use="required" />
          <xs:attribute name="name" type="lvaluename" />
        </xs:complexType>
      </xs:element>

      <xs:element name="create_target_points">
        <xs:annotation>
          <xs:documentation>
            Create target points and associate them with a mission cue. NOTE: This only works if the mission is currently active, and it will remove previously existing target points of other missions.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Mission cue which will be associated with the target points
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="target" type="destructible" use="required" />
          <xs:attribute name="tags" type="expression">
            <xs:annotation>
              <xs:documentation>
                Either a single tag or a list of tags which are required for the target points
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="groupname" type="groupname" />
          <xs:attribute name="sequence" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sequence identifier string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="stage" type="expression">
            <xs:annotation>
              <xs:documentation>
                Sequence stage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type" type="targetpointtypelookup" />
        </xs:complexType>
      </xs:element>

      <xs:element name="find_mission_offer_location">
        <xs:annotation>
          <xs:documentation>
            Find a mission offer location on a container
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="append" type="findappend" />
          <xs:attribute name="multiple" type="findmultiple" />
          <xs:attribute name="required" type="findrequired" />
          <xs:attribute name="container" type="container" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="force_cue">
        <xs:annotation>
          <xs:documentation>
            Force cue (not for general use)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="include_actions">
        <xs:annotation>
          <xs:documentation>
            Perform actions of the referenced library in the context of this cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="ref" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Library cue name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="populate_platforms">
        <xs:annotation>
          <xs:documentation>
            Create characters on platforms in the player zone, based on character quotas
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_all_cue_actors">
        <xs:annotation>
          <xs:documentation>
            Remove all associations of actor NPCs with this cue (the actors will be removed unless referenced outside the MD)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_cue_actor">
        <xs:annotation>
          <xs:documentation>
            Remove association of cue actor with this cue (the actor will be removed unless referenced outside the MD)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="actor">
            <xs:annotation>
              <xs:documentation>
                Actor NPC to be removed from the cue. If not supplied, the last created actor will be removed.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_mission">
        <xs:annotation>
          <xs:documentation>
            Remove the mission associated with this cue, if there is one
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="type">
            <xs:annotation>
              <xs:documentation>
                Optional indication of why the mission was removed. This can cause additional actions such as displaying a message.
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="aborted">
                  <xs:annotation>
                    <xs:documentation>
                      Mission aborted
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="completed">
                  <xs:annotation>
                    <xs:documentation>
                      Mission completed successfully
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="tutorialcompleted">
                  <xs:annotation>
                    <xs:documentation>
                      Tutorial completed successfully
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="failed">
                  <xs:annotation>
                    <xs:documentation>
                      Mission failed
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="reason" type="expression" use="optional">
            <xs:annotation>
              <xs:documentation>
                Reason text (for mission failed only)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="activate">
            <xs:annotation>
              <xs:documentation>
                Optional specification of whether another mission should be activated automatically as replacement for this one, in case this is the currently active mission. By default no new mission is activated automatically.
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="none">
                  <xs:annotation>
                    <xs:documentation>
                      If this is the current mission, no new mission should be activated. The player has to set a new current mission manually (default setting).
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="previous">
                  <xs:annotation>
                    <xs:documentation>
                      If this is the current mission, the last previously active mission is activated again.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="next">
                  <xs:annotation>
                    <xs:documentation>
                      If this is the current sub-mission in a master mission sequence, the next sequential mission will be activated.
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_offer">
        <xs:annotation>
          <xs:documentation>
            Remove the mission offer associated with this cue, if there is one
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_target_points">
        <xs:annotation>
          <xs:documentation>
            Remove target points that are associated with the mission cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Mission cue which is associated with the target points
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="reset_cue">
        <xs:annotation>
          <xs:documentation>
            Reset cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="add_holomap">
        <xs:annotation>
          <xs:documentation>
            Add a holomap to a rendertarget
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="name" type="lvaluename" use="required" />
          <xs:attribute name="rendertarget" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Name of render target on which the cutscene should be played (ignored for event monitor cutscenes)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="remove_holomap">
        <xs:annotation>
          <xs:documentation>
            Remove a holomap
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_holomap_target">
        <xs:annotation>
          <xs:documentation>
            Set the target of the holo map. If necessary, the map will zoom in or out, using the target's parent component as the displayed space. Please make sure that you only go up or down one level of the hierarchy - it will still work if you don't, but might not look as good. This only works if the map is active!
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="holomap" type="holomap" use="required" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="distance" type="expression">
            <xs:annotation>
              <xs:documentation>
                Distance from the map plane (TODO @Owen - perhaps remove this when able to get suitable distance based on the target)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pantime" type="expression">
            <xs:annotation>
              <xs:documentation>
                The time the map should take to pan to the new target if necessary. If not provided, the map will use the default time from parameters.xml (Note: this time should be shorter than the zoom time for better visuals)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="showunknown" type="expression">
            <xs:annotation>
              <xs:documentation>
                Whether the map should also display items and spaces the player hasn't visited yet
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_job_active">
        <xs:annotation>
          <xs:documentation>
            Activate or deactivate a job
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="job" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Job ID string
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="activate" type="booleanexpression">
            <xs:annotation>
              <xs:documentation>
                Activate job? (default is true)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="set_objective">
        <xs:annotation>
          <xs:documentation>
            Set an objective for the cue's mission (see &lt;create_mission&gt;)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="progress" type="objectiveprogress" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attributeGroup ref="objective" />
          <xs:attribute name="cue" type="cuename" use="required" />
        </xs:complexType>
      </xs:element>

      <xs:element name="set_presentation_cluster_persistence">
        <xs:annotation>
          <xs:documentation>
            Set the persistence of dynamically created presentation clusters. Whether they should be exported to a savegame or not.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cluster" type="object" use="required" />
          <xs:attribute name="persistent" type="booleanexpression" use="required">
            <xs:annotation>
              <xs:documentation>
                Is the cluster persistent
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="update_objective_progress">
        <xs:annotation>
          <xs:documentation>
            Update progress count of the objective for the cue's mission. The progress data must already have been set up by &lt;set_objective&gt;.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="progress" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Current progress count (rounded to an integer)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="expression">
            <xs:annotation>
              <xs:documentation>
                Max progress count (rounded to an integer, remains unchanged if not supplied)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="update_mission">
        <xs:annotation>
          <xs:documentation>
            Update metadata and briefing of an existing mission associated with a cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="missiondetails" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                End time of the mission (set to 0s to remove existing end time)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="update_objective_endtime">
        <xs:annotation>
          <xs:documentation>
            Update the current objective end time
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="endtime" type="expression">
            <xs:annotation>
              <xs:documentation>
                End time of the objective
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="update_offer">
        <xs:annotation>
          <xs:documentation>
            Update metadata and briefing of an existing mission offer associated with a cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="missiondetails" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                Duration of the mission (set to 0s to remove existing duration)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="update_mission_thread_offer">
        <xs:annotation>
          <xs:documentation>
            Update metadata and briefing of an existing mission thread offer associated with a cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:group ref="missionthreadoffer" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="duration" type="expression">
            <xs:annotation>
              <xs:documentation>
                Duration of the mission (set to 0s to remove existing duration)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="missiondetails" />
        </xs:complexType>
      </xs:element>

      <xs:element name="leave_control_position">
        <xs:annotation>
          <xs:documentation>
            Have the player leave their current control position and activate first person controls
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="undock_player_ship">
        <xs:annotation>
          <xs:documentation>
            Undocks the player ship
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>

      <xs:element name="force_player_speed">
        <xs:annotation>
          <xs:documentation>
            Set speed of the players currently controlled ship (aborts boost)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="speed" type="expression">
            <xs:annotation>
              <xs:documentation>
                Throttle value (defaults to 0) (-1 for full reverse, 0 for stop and 1 for full forward)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="signal_cue">
        <xs:annotation>
          <xs:documentation>
            Send a signal to a cue, triggering cues that wait for this signal via &lt;event_cue_signalled&gt;
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="check" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Check for existing cue listeners? If true and there are no listeners for the cue signal, a warning is produced. Default is true.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

      <xs:element name="signal_cue_instantly">
        <xs:annotation>
          <xs:documentation>
            Signal a cue instantly, triggering cues that wait for this signal via &lt;event_cue_signalled&gt;. Can pass parameter to &lt;event_cue_signalled&gt;
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="cue" type="cuename" use="required" />
          <xs:attribute name="check" type="boolean">
            <xs:annotation>
              <xs:documentation>
                Check for existing cue listeners? If true and there are no listeners for the cue signal, a warning is produced. Default is true.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="param" type="expression">
            <xs:annotation>
              <xs:documentation>
                Script Parameter passed to &lt;event_cue_signalled&gt;
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>

    </xs:choice>
  </xs:group>

  <xs:group name="actions">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="do_all" type="doall" />
        <xs:element name="do_any" type="doany" />
        <xs:sequence>
          <xs:element name="do_if" type="doif" />
          <xs:element name="do_elseif" type="doelseif" minOccurs="0" maxOccurs="unbounded" />
          <xs:element name="do_else" type="doelse" minOccurs="0" maxOccurs="1" />
        </xs:sequence>
        <xs:element name="do_while" type="dowhile"/>
        <xs:group ref="commonactions"/>
        <xs:group ref="specificactions"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:complexType name="doall">
    <xs:annotation>
      <xs:documentation>
        Actions in all sub-nodes will be performed.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="counting"/>
  </xs:complexType>

  <xs:complexType name="doany">
    <xs:annotation>
      <xs:documentation>
        A randomly selected sub-node action will be performed. The chances of selection can be specified by using weights on the actions.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
  </xs:complexType>

  <xs:complexType name="doif">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the value matches.
        Can be followed by &lt;do_elseif&gt; and/or &lt;do_else&gt;.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <xs:complexType name="doelseif">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the conditions in the previous nodes are not met and if this action's values matches.
        Can be followed by &lt;do_elseif&gt; and/or &lt;do_else&gt;.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <xs:complexType name="doelse">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed only if the conditions in the previous nodes are not met.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
  </xs:complexType>

  <xs:complexType name="dowhile">
    <xs:annotation>
      <xs:documentation>
        Actions in sub-nodes will be performed in a loop while the value matches.
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="actions"/>
    <xs:attributeGroup ref="action"/>
    <xs:attributeGroup ref="conditionalaction"/>
  </xs:complexType>

  <!-- ===== Cue definition ==== -->

  <xs:attributeGroup name="cue">
    <xs:attribute name="name" type="scriptname" use="required">
      <xs:annotation>
        <xs:documentation>
          Cue name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="version" type="xs:nonNegativeInteger">
      <xs:annotation>
        <xs:documentation>
          Cue version number
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="module" type="namestring">
      <xs:annotation>
        <xs:documentation>
          Define the module name the cue should run in (cue runs in all by default)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="namespace" type="namespacelookup"/>
    <xs:attribute name="instantiate" type="boolean">
      <xs:annotation>
        <xs:documentation>
          Create a new cue instance when activating?
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="checktime" type="expression">
      <xs:annotation>
        <xs:documentation>
          Minimum game time (player age) of first condition check, can be variable and is evaluated when cue is enabled (use only in combination with onfail or checkinterval)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="checkinterval" type="expression">
      <xs:annotation>
        <xs:documentation>
          Delay between condition checks, must be constant (do not use with cues containing event conditions)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="onfail" type="onfaillookup">
      <xs:annotation>
        <xs:documentation>
          Action after first time condition is checked (do not use with cues containing event conditions)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:attributeGroup>

  <xs:group name="cue">
    <xs:sequence>
      <xs:element name="conditions" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Cue conditions all of which must be met to activate the cue
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="conditions" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>

      <xs:element name="delay" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Range of delay time between activation and performing actions
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="random"/>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>

      <xs:element name="actions" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Cue actions
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="actions" />
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>

      <xs:element name="force" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Cue force actions, which will be performed before the actual actions when forcing a cue for debugging
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="actions" />
          <xs:attribute name="name" type="namestring">
            <xs:annotation>
              <xs:documentation>
                Name of the force actions, used to provide a list of plot shortcuts for testing
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>

      <xs:element name="patch" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Actions for patching a cue of an older version (will be performed when loading the MD script from a save).
            Patches are applied to waiting, active, complete or cancelled cues (see state attribute).
            This includes library users and instances, except for completed/cancelled instances that have already been deleted.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:group ref="actions" />
          <xs:attribute name="sinceversion" use="required" type="xs:positiveInteger">
            <xs:annotation>
              <xs:documentation>
                Cue version at which this patch element was added (it will only be applied when loading a cue of an older version)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="state">
            <xs:annotation>
              <xs:documentation>
                Required state that this cue must be in for this patch to be applied (default is complete)
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="complete">
                  <xs:annotation>
                    <xs:documentation>
                      Apply patch only if this cue is complete (default)
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="waiting">
                  <xs:annotation>
                    <xs:documentation>
                      Apply patch only if this cue is waiting (conditions are being checked)
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="active">
                  <xs:annotation>
                    <xs:documentation>
                      Apply patch only if this cue is active (not complete yet because of a delay)
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="cancelled">
                  <xs:annotation>
                    <xs:documentation>
                      Apply patch only if this cue is cancelled
                    </xs:documentation>
                  </xs:annotation>
                </xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="comment" type="comment" />
        </xs:complexType>
      </xs:element>

      <xs:element name="cues" type="cues" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Sub-cues
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:group>

  <xs:complexType name="cue">
    <xs:annotation>
      <xs:documentation>
        Cue
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="documentation" type="cuedoc" minOccurs="0" maxOccurs="1" />
      <xs:choice>
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="param">
            <xs:annotation>
              <xs:documentation>
                Cue parameter (only used if cue is a reference)
              </xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:attribute name="name" type="paramname" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Parameter name
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="value" type="expression" use="required">
                <xs:annotation>
                  <xs:documentation>
                    Parameter value
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="comment" type="comment" />
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <xs:group ref="cue" />
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="cue" />
    <xs:attribute name="ref" type="expression">
      <xs:annotation>
        <xs:documentation>
          Library cue name (all other cue data is ignored if this is present)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="library">
    <xs:annotation>
      <xs:documentation>
        A library cue
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="documentation" type="cuedoc" minOccurs="0" maxOccurs="1" />
      <xs:element name="params" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="param">
              <xs:annotation>
                <xs:documentation>
                  Library parameter
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="name" type="paramname" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      Parameter name
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="default" type="expression">
                  <xs:annotation>
                    <xs:documentation>
                      Default value (parameter is required if default value not supplied)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="comment" type="comment" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:group ref="cue" />
    </xs:sequence>
    <xs:attributeGroup ref="cue" />
  </xs:complexType>

  <xs:complexType name="cues">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="cue" type="cue">
        <xs:key name="cue_param_name">
          <xs:selector xpath="param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>
      <xs:element name="library" type="library">
        <xs:key name="library_param_name">
          <xs:selector xpath="params/param" />
          <xs:field xpath="@name" />
        </xs:key>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <!-- ===== Root element ==== -->

  <xs:element name="mdscript">
    <xs:annotation>
      <xs:documentation>
        Mission Director script root element
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="documentation" type="filedoc" minOccurs="0" maxOccurs="1" />
        <xs:element name="cues" type="cues" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Cues
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="signature" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Signature
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="name" type="scriptname" use="required" />
      <xs:attribute name="comment" type="comment" />
    </xs:complexType>
    <xs:key name="cue_name">
      <xs:selector xpath=".//cue | .//library" />
      <xs:field xpath="@name" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="objectspawnpoints">
    <xs:annotation>
      <xs:documentation>
        Object spawn point list root node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="space" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              The space for which the spawn points are defined
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="spawnpoint" minOccurs="1" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>
                    Object spawn point
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="position" minOccurs="1" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Spawn position in sector coordinates (unless space is overridden)
                        </xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:attribute name="x" type="xs:float" />
                        <xs:attribute name="y" type="xs:float" />
                        <xs:attribute name="z" type="xs:float" />
                      </xs:complexType>
                    </xs:element>
                    <xs:choice minOccurs="0" maxOccurs="1">
                      <xs:element name="rotation">
                        <xs:annotation>
                          <xs:documentation>
                            Spawn rotation in sector coordinates (unless space is overridden)
                          </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:attribute name="yaw" type="xs:float" />
                          <xs:attribute name="pitch" type="xs:float" />
                          <xs:attribute name="roll" type="xs:float" />
                        </xs:complexType>
                      </xs:element>
                      <xs:element name="quaternion">
                        <xs:annotation>
                          <xs:documentation>
                            Spawn rotation in sector coordinates (unless space is overridden)
                          </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:attribute name="qw" type="xs:float" />
                          <xs:attribute name="qx" type="xs:float" />
                          <xs:attribute name="qy" type="xs:float" />
                          <xs:attribute name="qz" type="xs:float" />
                        </xs:complexType>
                      </xs:element>
                    </xs:choice>
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:positiveInteger" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Unique (per sector) id
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="macro" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        Macro name of the object to spawn
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="space" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        Macro path to another coordinate space to use instead of the sector (usually a station)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="respawn" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        The minimum time after which the object may respawn (only happens out-of-sector)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="drop" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        The droplist id (from libraries/drops.xml) to use instead of the macro-defined one
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="comment" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        No in-game effect
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="macro" use="required">
              <xs:annotation>
                <xs:documentation>
                  The macro name of the sector
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
          <xs:unique name="Unique_ID_per_sector">
            <xs:selector xpath="spawnpoint" />
            <xs:field xpath="@id" />
          </xs:unique>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="stationtype">
    <xs:annotation>
      <xs:documentation>
        Station Type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="modulesettypelookup" />
  </xs:simpleType>

  <xs:simpleType name="fieldtypelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="asteroid" />
      <xs:enumeration value="debris" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="resourcelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ore" />
      <xs:enumeration value="silicon" />
      <xs:enumeration value="ice" />
      <xs:enumeration value="nividium" />
      <xs:enumeration value="hydrogen" />
      <xs:enumeration value="helium" />
      <xs:enumeration value="methane" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="fieldtype">
    <xs:annotation>
      <xs:documentation>
        Field Type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="fieldtypelookup" />
  </xs:simpleType>

  <xs:simpleType name="objectmacro">
    <xs:annotation>
      <xs:documentation>
        The macro name for the spawned object (only used if not specified by a spawn point)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:simpleType name="drop">
    <xs:annotation>
      <xs:documentation>
        The drop list override for the spawned object (optional, spawned object's default drop list is used if not defined)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  
  <xs:complexType name="objectspawnselection">
    <xs:annotation>
      <xs:documentation>
        Defining this overrides the macro and drop attributes in the parent node
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="macro" type="objectmacro" />
    <xs:attribute name="drop" type="drop" />
    <xs:attribute name="weight" type="xs:nonNegativeInteger" />
  </xs:complexType>
  
  <xs:attributeGroup name="spawnruleprops">
    <xs:attribute name="sector" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Rule only applies in this sector if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="chance" type="xs:float" use="required">
      <xs:annotation>
        <xs:documentation>
          If rule applies, the chance in percent that an object is spawned at a randomly selected location
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="drop" type="drop" />
  </xs:attributeGroup>

  <xs:complexType name="stationspawnrule">
    <xs:annotation>
      <xs:documentation>
        The spawn rule
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="select" minOccurs="0" maxOccurs="unbounded" type="objectspawnselection" />
    </xs:sequence>
    <xs:attributeGroup ref="spawnruleprops" />
    <xs:attribute name="owner" type="factionlookup">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to stations owned by this faction if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hazardousregion" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to stations inside hazardous regions if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="stationtype" type="stationtype">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to stations of this type if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="regionspawnrule">
    <xs:annotation>
      <xs:documentation>
        The spawn rule
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="select" minOccurs="0" maxOccurs="unbounded" type="objectspawnselection" />
    </xs:sequence>
    <xs:attributeGroup ref="spawnruleprops" />
    <xs:attribute name="owner" type="factionlookup">
      <xs:annotation>
        <xs:documentation>
          Rule only applies in sectors owned by this faction if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="hazardousregion" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to hazardous regions if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="region" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to regions with this region definition if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="fieldtype" type="fieldtype">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to fields of this type if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="resource" type="resourcelookup">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to fields with this resource if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minsize" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to fields with objects at least this large if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxsize" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Rule only applies to fields with objects at most this large if defined
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="macro" type="macro" />
  </xs:complexType>

  <xs:element name="objectspawnrules">
    <xs:annotation>
      <xs:documentation>
        Object spawn rule list root node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="stations" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="rule" type="stationspawnrule" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="regions" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="rule" type="regionspawnrule" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="unitvalue">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+[\.]?[0-9]*([ ]*(m|km|ms|s|min|h))?" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="colorvalue">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="255" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="logbase">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="10" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="viewangle">
    <xs:annotation>
      <xs:documentation>
        Maximum angle away from crosshair center (horizontal or vertical), in positive degrees (default: 180, i.e. no restriction)
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="max">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="1" />
          <xs:maxInclusive value="180" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="chance">
    <xs:annotation>
      <xs:documentation>
        Chance value, defaults to 100.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="1" />
      <xs:maxInclusive value="100" />
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="argbcolor">
    <xs:annotation>
      <xs:documentation>
        Color value given as ARGB components.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="r" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Red color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="g" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Green color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="b" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Blue color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="a" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Alpha value (0-255, default: 255)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="highlightcolour">
    <xs:annotation>
      <xs:documentation>
        Control highlighting options
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="r" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Red color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="g" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Green color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="b" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Blue color value (0-255, default: 0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="a" type="colorvalue">
      <xs:annotation>
        <xs:documentation>
          Alpha value (0-255, default: 255)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="duration" type="xs:float" use="required">
      <xs:annotation>
        <xs:documentation>
          Duration of the highlight effect
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="frequency" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Frequency of oscillation effect (default: 0, no oscillation)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minalpha">
      <xs:annotation>
        <xs:documentation>
          Minimum alpha value for oscillation effect (0.0-1.0, default: 0)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="1" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="maxalpha">
      <xs:annotation>
        <xs:documentation>
          Maximum alpha value for oscillation effect (0.0-1.0, default: 1)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="1" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:complexType name="curve">
    <xs:sequence>
      <xs:element name="point" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="position" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Input value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="value" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Output value for this point's input value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="default" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default value, used when input is outside of bounds defined by the curve
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:attributeGroup name="plotpricefactors">
    <xs:attribute name="min" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Full plot price contribution at min or smaller distance
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          No plot price contribution after max distance
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="factor" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Factor added per object of this category to price calculation, linear scaling between min and max distance
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:complexType name="highlightdef">
    <xs:sequence>
      <xs:element name="outline" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Outline effect
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="highlightcolour" />
        </xs:complexType>
      </xs:element>
      <xs:element name="fill" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Fill effect
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="highlightcolour" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="scan">
    <xs:sequence>
      <xs:element name="outline" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Outline effect
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="highlightcolour" />
        </xs:complexType>
      </xs:element>
      <xs:element name="fill" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Fill effect
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="highlightcolour" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="minlevel" use="required">
      <xs:annotation>
        <xs:documentation>
          Minimum scan level to trigger this effect
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="9" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="highlight">
    <xs:sequence>
      <xs:element name="target" type="highlightdef" minOccurs="0" maxOccurs="1" />
      <xs:element name="environmentobject" type="highlightdef" minOccurs="0" maxOccurs="1" />
      <xs:element name="scan" type="scan" minOccurs="0" maxOccurs="9" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="scriptparams">
    <xs:sequence>
      <xs:element name="category" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="name" type="idname" use="required" />
                <xs:attribute name="value" type="expression" use="required" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="name" type="idname" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:attributeGroup name="vector3">
    <xs:attribute name="x" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          X coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="y" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Y coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="z" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Z coordinate
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:complexType name="jobsparams">
    <xs:sequence>
      <xs:element name="factor" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Factor of job quotas
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="galaxy" type="xs:float"/>
          <xs:attribute name="cluster" type="xs:float"/>
          <xs:attribute name="sector" type="xs:float"/>
          <xs:attribute name="zone" type="xs:float"/>
          <xs:attribute name="station" type="xs:float"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="godparams">
    <xs:sequence>
      <xs:element name="factor" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Factor of god quotas
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier applied to quota definition of any object entry in god.xml
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="production" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier applied to quota definition of any production entry in god.xml
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="station" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier applied to quota definition of any station entry in god.xml
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:attributeGroup name="yawpitchroll">
    <xs:attribute name="yaw" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Yaw angle
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="pitch" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Pitch angle
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="roll" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Roll angle
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:complexType name="posrot">
    <xs:sequence>
      <xs:element name="position" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:annotation>
            <xs:documentation>
              Position
            </xs:documentation>
          </xs:annotation>
          <xs:attributeGroup ref="vector3" />
        </xs:complexType>
      </xs:element>
      <xs:element name="rotation" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:annotation>
            <xs:documentation>
              Rotation
            </xs:documentation>
          </xs:annotation>
          <xs:attributeGroup ref="yawpitchroll" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="masstrafficparams">
    <xs:sequence>
      <xs:element name="objects" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to mass traffic objects
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="deviation" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters defining how a ship will deviate from the exact mass traffic position over time
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="amplitude" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        The maximum distance a mass traffic object can deviate in each direction
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attributeGroup ref="vector3" />
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="period" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Parameters for the period at which a mass traffic object oscillates in each coordinate. The result will be a random value between the minimum and the maximum period.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="min" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attributeGroup ref="vector3" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="max" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attributeGroup ref="vector3" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="phase" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Parameters for the phase shift of oscillation. The result will be a random value between the minimum and the maximum phase.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="min" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attributeGroup ref="vector3" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="max" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attributeGroup ref="vector3" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="width" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Defines the maximum deviation at which mass traffic objects move
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="tag" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:attribute name="id" type="xs:string">
                        <xs:annotation>
                          <xs:documentation>
                            The tag ID for this width setting
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="width" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The width (in m) to be used on roads with this tag
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="default" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The default width (in m) to be used when no matching tag is defined
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="widthfactors" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Width factors based on curve angle
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="point" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:attribute name="position" type="xs:float" use="required" />
                      <xs:attribute name="value" type="xs:float" use="required" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="default" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Default width factor
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="speed" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Defines the speeds at which mass traffic objects move
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="tag" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:attribute name="id" type="xs:string">
                        <xs:annotation>
                          <xs:documentation>
                            The tag ID for this speed setting
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="speed" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The speed (in m/s) to be used on roads with this tag
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="default" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The default speed (in m/s) to be used when no matching tag is defined
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="clearance" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Minimum distance between objects in a lane - this divided by the slowest speed is the time delay between launching ships
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="renderdistance" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The default maximum render distance (evaluated per road, not per object)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="componentdistance" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The maximum distance for standard mass traffic objects to become a component
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="lookahead" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The look-ahead time in seconds that mass traffic objects use to determine their rotation
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="highwaytrailcolor" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to mass traffic ship trails in highway
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:all>
            <xs:element name="danger" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Trail vertex color for signalling collision with player ship
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="argbcolor" />
              </xs:complexType>
            </xs:element>
            <xs:element name="safe" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Trail vertex color for signalling no collision with player ship
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="argbcolor" />
              </xs:complexType>
            </xs:element>
          </xs:all>
        </xs:complexType>
      </xs:element>
      <xs:element name="network" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters for network setup
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="blocklinks" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for connecting 'blocklink' waypoints
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="maxconnections" type="xs:integer">
                  <xs:annotation>
                    <xs:documentation>
                      Maximum number of connections to be made per blocklink waypoint (can be fewer if not enough are in range)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="prune" type="xs:boolean">
                  <xs:annotation>
                    <xs:documentation>
                      Whether to prune block link connections going to waypoints on the same module that are internally connected (i.e. you can go from A to B, so don't connect to B if you're already connected to A)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="maxdistance" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Maximum distance between waypoints for block links (if there is no matching blocklink within that distance the one that's closest will be used)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="closelinks" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for connecting 'closelink' waypoints
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="maxheight" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Maximum distance along the y-axis between waypoints for close links
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="maxdistance" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Maximum distance between waypoints for close links
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="tangent" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for spline tangents
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="length" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Base tangent length relative to distance between start and end point
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="curves" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters controlling curves between roads
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="maxlength" type="xs:float" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum fraction of a road that can be used for a curve. Should never be larger than 0.5!
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="turnspeed" type="xs:float" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum turn speed of mass traffic ships, in degrees per second. This, together with the forward speed, is used to calculate the curve radius.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="curvefactors" type="curve" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Curve defining the factor on the spline tangent length depending on the sharpness of the road pair's angle (position: degrees between 0 and 180)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="highway" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for static mass traffic nodes from, to and along highways
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="parallelroad" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Parameters for the roads that go along the highway tube
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="length" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The length of each highway-parallel segment
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="distancefactor" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            Will be multiplied with the highway's tube radius to determine the distance of the road from the highway center
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="entryroad" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Parameters for the roads leading into a highway entry gate
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="length" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The length of the road
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="exitroad" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Parameters for the roads leading out of a highway exit gate
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="length" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The length of the road
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="connectlocalhighways" type="xs:boolean">
                  <xs:annotation>
                    <xs:documentation>
                      Whether to connect stations to local highways in the same zone
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="connecthighwaygates" type="xs:boolean">
                  <xs:annotation>
                    <xs:documentation>
                      Whether to connect stations to highway entry and exit gates in the same zone
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="build" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for build mass traffic
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="numpaths" type="xs:integer">
                  <xs:annotation>
                    <xs:documentation>
                      The number of individual paths per build mass traffic network
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="numpoints" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The number of intermediate "welding points" per path
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="repair" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters for repair mass traffic
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="numpaths" type="xs:integer">
                  <xs:annotation>
                    <xs:documentation>
                      The number of individual paths per repair mass traffic network, per repaired component
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="connectstations" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether to connect stations in the same zone to each other
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxlengthforshortcuts" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Experimental: roads shorter than this length might be skipped over with a shortcut (only considers dynamically roads that start or end at a manually defined waypoint)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="lowattentioncombatparams">
    <xs:sequence>
      <xs:element name="attack" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to attack damage
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="firingarea" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Effective area for turrets to fire from, limiting damage from very large obects
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="laserweaponfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier for laser damage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="missileweaponfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier for missile damage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="turretfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier for turret damage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dronebulletfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier for attack drone bullet damage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dronemissilefactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Multiplier for attack drone missile damage
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minspeed" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum speed of the attacker, used for evasion calculations. Slower or immobile objects will use this value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="defence" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to the defender, negating damage
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="maneouverfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Factor of how much of a difference the speed between the attacker and defender affects the hit chance
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minspeed" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum speed of the defender, used for evasion calculations. Slower or immobile objects will use this value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxsize" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum size of the defender, used for hit chance calculations. Very large objects will use this value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="sizefactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Factor of how much of a difference the object size and 'maxsize' affects the hit chance
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="capshipfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Factor of how much turret damage against a defending capitalship is negated. Simulating the high attention wandering of capships which slows the battle
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="countermeasurefactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Factor of how much missile damage against can be avoided by using countermeasures. The higher the value, the more effective the countermeasures are. (factor is only applied if the target has any countermeasures at all)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dronedistractionfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Factor of how much damage a single defence drone will negate by distracting the attacker. Total result clamped between 0.5 and 1.0
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dronedamageamount" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Amount of damage needed to be dealt to destroy one defence drone
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="lootmagnetparams">
    <xs:attribute name="range" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum range at which a collectable will be pulled
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="force" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          How strongly the collectable will be pulled (note that the force at a certain range also increases when the range is increased)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxspeed" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The collectable's maximum speed
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="sound" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          The sound ID to be played while the magnet is active
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="renderparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to rendering
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="weaponglow" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to weapon glow
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="max" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The maximum glow value to be passed on to shaders
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="soundparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to sounds
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="anomaly" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to anomaly sounds
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="pitchcurve" type="curve">
              <xs:annotation>
                <xs:documentation>
                  The section curve for the sound's pitch depending on the distance to the center (this is additive, so 0 is neutral)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="volumecurve" type="curve">
              <xs:annotation>
                <xs:documentation>
                  The section curve for the sound's volume depending on the distance to the center (this is a factor, so 1 is neutral)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="highspeed" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to high speed sounds
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="delaycurve" type="curve">
              <xs:annotation>
                <xs:documentation>
                  The section curve for the delay between individual sound instances depending on the relative speed (input position of 0 is the unboosted maximum speed, 1 is the total maximum speed as defined in the spaceflight parameters)
                </xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="startfactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum speed at which the sound should play (value multiplied with the ship's unboosted maximum speed)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="enginedetail" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters related to detail sounds of ship engines
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="entry" minOccurs="1" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Detail sound properties for a specific ship size
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="size" type="xs:string" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum amount of ships of this size to get detail sounds at a time
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="amount" type="xs:unsignedInt" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum amount of ships of this size to get detail sounds at a time
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="range" type="xs:float" use="required">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum range at which ships of this size are even considered for detail sounds
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="swayparams">
    <xs:attribute name="min" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The minimum sway amplitude
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum sway amplitude
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="randomsgn" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          whether the sway direction should be randomized
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cp1" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The first control point of the bezier time curve
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cp2" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The second control point of the bezier time curve
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="dockingparams">
    <xs:sequence>
      <xs:element name="dock" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="farguidance" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:attribute name="material" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The material for each guidance light
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="amount" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      How many guidance lights (per side) can be seen at a time
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="duration" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      How long until the line of lights reached the end
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="scale" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Size of each light geometry
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="starttangent" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Start tangent multiplier - defaults to 1.0, should not get too high (certainly not higher than 2.0) or the spline can stick inside geometry unreasonably often, or look broken in other ways
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="startdistance" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      How far in front of the ship the first lights should appear - property is multiplied with the playership size to get the result
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="maxdistance" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      How far along the spline lights should be rendered at most
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="dx" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The half width of the light path (i.e. X offset to the center spline)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="dz" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The distance between 2 lights along the spline
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="fadein" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The initial fadein parameter for lights - the smaller this is the faster the lights fades in. Defaults to 0
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="nearguidance" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="background" minOccurs="1" maxOccurs="1">

                  </xs:element>
                  <xs:element name="rotation" minOccurs="1" maxOccurs="1">

                  </xs:element>
                  <xs:element name="position" minOccurs="1" maxOccurs="1">

                  </xs:element>
                </xs:sequence>
                <xs:attribute name="renderdistance" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The base distance from the head at which to render the elements
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="maxoffsets" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="maxoffset" minOccurs="1" maxOccurs="unbounded">
                    <xs:annotation>
                      <xs:documentation>
                        The maximum difference in position/rotation between ship and dock point for docking to finish
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="position" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:annotation>
                              <xs:documentation>
                                Position
                              </xs:documentation>
                            </xs:annotation>
                            <xs:attributeGroup ref="vector3" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="rotation" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:annotation>
                              <xs:documentation>
                                Rotation
                              </xs:documentation>
                            </xs:annotation>
                            <xs:attributeGroup ref="yawpitchroll" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                      <xs:attribute name="software" type="xs:string">
                        <xs:annotation>
                          <xs:documentation>
                            The minimum software that needs to be installed for this set of parameters to be used
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="landing" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters that control the visuals of ships landing
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                      <xs:documentation>
                        Data for a specific traffic level
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="slowdown" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attribute name="duration" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The duration of the slowdown sequence in seconds (must be shorter than the landing duration!)
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="align" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attribute name="duration" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The duration of the align sequence in seconds (must be shorter than the landing duration!)
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="suspension" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attribute name="dy" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The maximum suspension movement in metres
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="duration" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The duration of the suspension sequence in seconds
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="sway" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              Parameters defining how a landing ship sways around each axis
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="pitch" type="swayparams" />
                              <xs:element name="yaw" type="swayparams" />
                              <xs:element name="roll" type="swayparams" />
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                      <xs:attribute name="traffic" use="required">
                        <xs:annotation>
                          <xs:documentation>
                            The traffic level at which this parameter set is used
                          </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                          <xs:restriction base="expression">
                            <xs:enumeration value="normal" />
                            <xs:enumeration value="heavy" />
                            <xs:enumeration value="gridlock" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                      <xs:attribute name="duration" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The duration of the landing sequence in seconds (total duration is this plus the suspension duration)
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="takeoff" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Parameters that control the visuals of ships taking off
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                      <xs:documentation>
                        Data for a specific traffic level
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="release" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attribute name="dy" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The height of the initial release movement in metres
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="duration" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The duration of the initial release sequence in seconds
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="align" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:attribute name="starttime" type="xs:float">
                              <xs:annotation>
                                <xs:documentation>
                                  The start time (counted from the beginning of the takeoff movement) of the align sequence in seconds (must be shorter than the landing duration!)
                                </xs:documentation>
                              </xs:annotation>
                            </xs:attribute>
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="sway" minOccurs="0" maxOccurs="1">
                          <xs:annotation>
                            <xs:documentation>
                              Parameters defining how a ship taking off sways around each axis
                            </xs:documentation>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="pitch" type="swayparams" />
                              <xs:element name="yaw" type="swayparams" />
                              <xs:element name="roll" type="swayparams" />
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                      <xs:attribute name="traffic" use="required">
                        <xs:annotation>
                          <xs:documentation>
                            The traffic level at which this parameter set is used
                          </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                          <xs:restriction base="expression">
                            <xs:enumeration value="normal" />
                            <xs:enumeration value="heavy" />
                            <xs:enumeration value="gridlock" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                      <xs:attribute name="duration" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The duration of the takeoff sequence in seconds
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="tags" type="xs:string" use="required">
            <xs:annotation>
              <xs:documentation>
                The tags for this dock's compatible sizes
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="timeout" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The time after which an assignment is cancelled if the ship fails to dock
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxdistance" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The maximum distance a ship may have to a station for a dock to be (and stay) assigned
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unassigndistance" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The distance at which an undocking ship is unassigned from the dock it's departing from
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="retrievalsafety" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum duration a ship will not be stored away after having been retrieved
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="playerretrievalsafety" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum duration a player ship in high attention will not be stored away after having been retrieved
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="maxspeed" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum (linear) speed allowed while 'inside' an enclosed docking space
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="buildingparams">
    <xs:sequence>
      <xs:element name="plot">
        <xs:annotation>
          <xs:documentation>
            Definitions to control the price calculation of building plots
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="gate">
              <xs:annotation>
                <xs:documentation>
                  Distance and contribution factor definition for Gates
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="plotpricefactors" />
              </xs:complexType>
            </xs:element>
            <xs:element name="highway">
              <xs:annotation>
                <xs:documentation>
                  Distance and contribution factor definition for Highways
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="plotpricefactors" />
              </xs:complexType>
            </xs:element>
            <xs:element name="station">
              <xs:annotation>
                <xs:documentation>
                  Distance and contribution factor definition for Stations
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="plotpricefactors" />
                <xs:attribute name="highvaluemultiplier" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Additional multiplier for the contribution of a station if it is a Shipyard, Equipment Dock, Military Station or Trading Station
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="baseprice" type="xs:unsignedInt">
            <xs:annotation>
              <xs:documentation>
                Base price for a 1km * 1km * 1km plot in Credits
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="margin" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The minimum distance between the fully expanded bounding boxes of stations to allow building
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="navmeshcalculationparams">
    <xs:attribute name="method" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          The partitioning method. Watershed (slowest), 2: Monotone (fastest), 3: Layer (pretty fast)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tilesize" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          The size of tiles on the xz-plane.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="bordersize" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          The size of the non-navigable border around the heightfield.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cellwidth" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The xz-plane cell size to use for fields, in m. Must be larger than 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="cellheight" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The y-axis cell size to use for fields, in m. Must be larger than 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxslope" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum slope that is considered walkable, in degrees. Must be at least 0, and less than 90.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxclimb" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Maximum ledge height that is considered to still be traversable, in m. Must be at least 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxedgelength" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum allowed length for contour edges along the border of the mesh.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxsimplificationerror" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum distance a simplified contour's border edges should deviate from the original raw contour. Must not be negative.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minregionarea" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          The minimum number of cells allowed to form isolated island areas.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="mergeregionarea" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          Any regions with a span count smaller than this value will, if possible, be merged with larger regions.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxvertsperpoly" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>
          The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process. Must be at least 3.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="detailsampledistance" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Sets the sampling distance to use when generating the detail mesh. (For height detail only.) Must be either 0 or at least 0.9
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxdetailsampleerror" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The maximum distance the detail mesh surface should deviate from heightfield data in voxel units. (For height detail only.)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="platformnavigationparams">
    <xs:annotation>
      <xs:documentation>
        Parameters for various systems related to navigation on platforms. Note that many values are very technical and don't make much sense without knowing the context.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="navmesh" minOccurs="0" maxOccurs="1" type="navmeshcalculationparams">
        <xs:annotation>
          <xs:documentation>
            Parameters used during navmesh generation. Default data.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="smallnavmesh" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Parameters used during navmesh generation for objects smaller than the threshold. Data from default node are used where not overridden.
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="navmeshcalculationparams">
              <xs:attribute name="maxsize" type="xs:float">
                <xs:annotation>
                  <xs:documentation>
                    The maximum size of the navmesh object's bounding box (in m, half length of longest box edge) that can use these parameter overrides.
                  </xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="crowd" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="race" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  A race-specific set of character parameters.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="speed" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Different speeds of this race's characters, in m/s.
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="slowwalk" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The maximum slow-walking speed, in m/s.
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="walk" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The maximum walking speed, in m/s.
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="run" type="xs:float">
                        <xs:annotation>
                          <xs:documentation>
                            The maximum run speed, in m/s.
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="id" type="racelookup">
                  <xs:annotation>
                    <xs:documentation>
                      The race ID for this set of character parameters.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="width" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The width of the body (radius, not diameter), in m.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="height" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The height of the body, in m.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="acceleration" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum walking acceleration, in m/s^2.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="maxagents" type="xs:unsignedInt">
            <xs:annotation>
              <xs:documentation>
                The maximum allowed number of simultaneously active agents.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="collisionqueryrange" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Defines how close a collision element must be before it is considered for steering behaviors. Will be multiplied with the agent's race-specific width.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pathoptimizationrange" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The path visibility optimization range. Will be multiplied with the agent's race-specific width.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="anticipateturns" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether agents should calculate a smooth steering direction.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="optimizevis" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether crowd agents optimize their path by visibility.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="optimizetopo" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether crowd agents optimize their path by topology.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="obstacleavoidance" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether crowd agents should avoid obstacles.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="separation" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether agents that are very close to each other should separate.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="separationweight" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                AI agent separation weight.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="playerseparationweight" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Player agent separation weight.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="pickwidth" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Character width used to calculate the pick extents for character placement
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxwidth" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Maximum character width with tolerance (0.1) already deducted to determine walkable surfaces
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="maxheight" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Maximum character height with tolerance (0.6) already deducted to determine walkable surfaces
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="pathing" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Path finding parameters
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="pickextents" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Maximum distances used to find navmesh polygons (used inside the Recast library)
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="default" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Default values used for most cases
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="x" type="xs:float" use="required" />
                      <xs:attribute name="y" type="xs:float" use="required" />
                      <xs:attribute name="z" type="xs:float" use="required" />
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="strict" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Smaller values used when we can't have any false positives
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="x" type="xs:float" use="required" />
                      <xs:attribute name="y" type="xs:float" use="required" />
                      <xs:attribute name="z" type="xs:float" use="required" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="maxiter" type="xs:unsignedInt">
            <xs:annotation>
              <xs:documentation>
                The maximum number of iterations in a single path finding call
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="anyangle" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                Whether to use the DT_FINDPATH_ANY_ANGLE option for sliced path finding (can find shortcuts using line-of-sight checks)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="costs" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Traversal costs for the various floor types (all must be >= 1)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="walk" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Default cost for areas not covered by the other cases (must be >= 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="conveyor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Cost for areas tagged 'walk_conveyor' (must be >= 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="dockingbay" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Cost for areas tagged 'walk_dockingbay' (must be >= 1)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="conveyorspeeds" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Speeds for platform conveyor belts
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="tag" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="id" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The tag ID for this speed setting
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="speed" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The speed (in m/s) of conveyor belts with this tag
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="default" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The default speed (in m/s) to be used when no matching tag is defined
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="conveyorcurves" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Curve radii for platform conveyor belts
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="tag" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="id" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The tag ID for this curve radius
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="radius" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The curve radius (in m) of conveyor belts with this tag
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="triggerranges" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Ranges for proximity trigger parts
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="tag" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="id" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The tag ID for this range setting
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="range_xz" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The range (in m, x and z coordinates only) of proximity triggers with this tag
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="range_y" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The range (in m, y coordinate only) of proximity triggers with this tag
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="default_xz" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The default range (in m, x and z coordinates only) to be used when no matching tag is defined
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="default_y" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The default range (in m, y coordinate only) to be used when no matching tag is defined
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="navigationparams">
    <xs:sequence>
      <xs:element name="travelspeed" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            The travel speeds used for calculating edge costs for path finding
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="space" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The average travel speed (in m/s) of ships in space (should take boosting into account)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="highway" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The average travel speed of ships in highways (0 = min speed, 1 = max speed)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="workforceparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to workforce
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="update" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Workforce update behaviour
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="interval" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Update interval in seconds
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="variation" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Update interval variation (= interval +/- variation)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="growth" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Workforce growth behaviour
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ratio" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Ratio of habitation amount / habitation capacity.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="min" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Lower end of the habitation fill ratio value. If the value drops below this, always use factor->max for calculating effective growth rate.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="max" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Upper end of the habitation fill ratio value. If the value exceeds this, always use factor->min for calculating effective growth rate.
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="factor" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Factor to apply to final growth rate based on current habitation ratio.
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="min" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Minimum factor applied to growth rate when habitation fill ratio exceeds ratio->max
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="max" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      Maximum factor applied to growth rate when habitation fill ratio drops below ratio->min
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="interval" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Time interval between workforce growth evaluations
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="rate" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Base growth rate per evaluation (modified by other rules)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="upgraderesourceparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to upgrades. Used to determine reserved space for necessary resources.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="factor" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Resource amount multipliers per category
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="countermeasure" type="xs:double" />
          <xs:attribute name="drone" type="xs:double" />
          <xs:attribute name="engine" type="xs:double" />
          <xs:attribute name="fuel" type="xs:double" />
          <xs:attribute name="missile" type="xs:double" />
          <xs:attribute name="mine" type="xs:double" />
          <xs:attribute name="satellite" type="xs:double" />
          <xs:attribute name="navbeacon" type="xs:double" />
          <xs:attribute name="resourceprobe" type="xs:double" />
          <xs:attribute name="scanner" type="xs:double" />
          <xs:attribute name="shield" type="xs:double" />
          <xs:attribute name="thruster" type="xs:double" />
          <xs:attribute name="turret" type="xs:double" />
          <xs:attribute name="weapon" type="xs:double" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="productioncheckparams">
    <xs:annotation>
      <xs:documentation>
        Parameters controlling the parameters for detecting and responding to resource shortages.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="time" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Time thresholds for sending reports and requesting remedies
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="production" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Minimum time a production needs to be able to run for, before available resource are not considered in "low" supply
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="min" type="xs:integer" />
              </xs:complexType>
            </xs:element>
            <xs:element name="warning" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Time thresholds for sending events notifying the universe about a producer suffering from extended resource shortage
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="low" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Time thresholds that a ware must have been in "low" supply before a warning is sent
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="product" type="xs:integer" />
                      <xs:attribute name="resource" type="xs:integer" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="trigger" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Time thresholds for sending reports and requesting remedies
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="transport" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Time thresholds that a ware must have been in "low" supply before a transporter is requested
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="general" type="xs:integer">
                        <xs:annotation>
                          <xs:documentation>
                            After having been "low" on a ware for the specified time(in seconds) any transporter that can transport this ware is requested
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                      <xs:attribute name="special" type="xs:integer">
                        <xs:annotation>
                          <xs:documentation>
                            After having been "low" on a ware for the specified time(in seconds) a transporter that exclusively transports the ware is requested
                          </xs:documentation>
                        </xs:annotation>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="flag" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                      <xs:documentation>
                        Time threshold that controls after which amount of time on being low/out of a resource the production (and zone) is considered not viable and will be abandoned
                      </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                      <xs:attribute name="nonviable" type="xs:integer" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="threshold" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Percentage thresholds for ware amounts in production storage
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="resource">
            <xs:simpleType>
              <xs:restriction base="xs:double">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="1" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="product">
            <xs:simpleType>
              <xs:restriction base="xs:double">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="1" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="exclusionzoneparams">
    <xs:annotation>
      <xs:documentation>
        Parameters defining exclusion zone sizes for different dock types
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="exclusionzone" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="tag" use="required" />
          <xs:attribute name="x" type="xs:float" use="required" />
          <xs:attribute name="y" type="xs:float" use="required" />
          <xs:attribute name="z" type="xs:float" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="outline" type="xs:boolean" />
  </xs:complexType>

  <xs:complexType name="weaponmodeparams">
    <xs:sequence>
      <xs:element name="icons" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="mode" type="xs:string" use="required" />
                <xs:attribute name="icon" type="xs:string" use="required" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="default" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="pointerparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to 3D pointers
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="cursors" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Mappings from mouse cursor ID to icon material
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="cursor" minOccurs="1" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Mapping from mouse cursor ID to icon material
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="id" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The mouse cursor ID
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="icon" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      The icon material to be used when this cursor is set - if left empty the game will display a small sphere instead
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="scale" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The scale of the element (sphere or icon plane)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="vrmouse">
        <xs:annotation>
          <xs:documentation>
            Properties for the VR mouse pointer
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="origin">
              <xs:annotation>
                <xs:documentation>
                  The offset of the pointer origin relative to the VR center offset
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="position" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="length" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The default length of the pointer if nothing is being pointed at
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="width" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The width of the pointer
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="material" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          The material to be put on the pointer
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="iconscale" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The base scale of the icon shown at the end of the line, will be modified by the distance to the camera to keep the screen size consistent
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="weaponpointerparams">
    <xs:annotation>
      <xs:documentation>
        Parameters related to aim indicators of weapons
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="color" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            The base color for the indicator
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="argbcolor" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="scale" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          The base scale of the indicator
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="material" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          The material to be put on the indicator
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="renderdistance" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Render distance factor, 1.0 would put the pointer at the exact distance of the raycast hit
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="storageparams">
    <xs:attribute name="base" type="logbase">
      <xs:annotation>
        <xs:documentation>
          Base value for logarithmic calculation of number of cargo bays shown depending on fill status of storage module.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="miningparams">
    <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element name="damagefactors">
        <xs:annotation>
          <xs:documentation>
            Mining damage factors to estimate efficiency while shooting at asteroids
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="turret" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Damage factor for turrets
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="weapon" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Damage factor for front-mounted weapons
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="speedfactors">
        <xs:annotation>
          <xs:documentation>
            Factors to estimate how much of the max speed is used on average
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="ship" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Speed factor for the mining ship
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="unit" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Speed factor for the mining ship's collector units
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="drops">
        <xs:complexType>
          <xs:attribute name="distancefactor" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                How far asteroid drops are estimated to fly compared to the asteroid size.
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="engineparams">
    <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element name="acceleration">
        <xs:complexType>
          <xs:attribute name="time" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The time over which maximum acceleration can be achieved (this only affects visuals and not actual movement)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="jet">
        <xs:annotation>
          <xs:documentation>
            Parameters that control movement-dependent scaling of jet parts on engines or objects
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="acceleration" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The strength of influence the current acceleration has on the jet scale
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="velocity" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The strength of influence the current velocity has on the jet scale
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="scale" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Additional scale factor, applied before enforcing the maximum
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The maximum jet scale that the code can set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="glow">
        <xs:annotation>
          <xs:documentation>
            Parameters that control movement-dependent glow values on engines or objects
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="acceleration" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The strength of influence the current acceleration has on the glow strength
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="velocity" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The strength of influence the current velocity has on the glow strength
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="scale" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Additional scale factor, applied before enforcing the maximum
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="max" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The maximum glow strength that the code can set
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="align">
        <xs:annotation>
          <xs:documentation>
            Parameters that control movement-dependent rotation animations for engines
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="minspeed" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum speed that can influence alignment (relative to respective max speed)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minacctime" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum acceleration that can influence alignment (relative to respective max acceleration)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="minthrustdiff" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                The minimum difference between current speed and target speed that can influence alignment (relative to respective max speed)
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="vortex">
        <xs:annotation>
          <xs:documentation>
            Parameters that control vortex trails
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence minOccurs="0" maxOccurs="1">
            <xs:element name="rotation">
              <xs:annotation>
                <xs:documentation>
                  Vortex rotation parameters
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="min" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The minimum rotation speed above which vortex trails are shown at lowest density
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="max" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum rotation speed above which vortex trails are shown at highest density
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
            <xs:element name="speed">
              <xs:annotation>
                <xs:documentation>
                  Vortex soeed parameters
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="min" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The minimum forward speed above which vortex trails are shown at lowest density
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
                <xs:attribute name="max" type="xs:float">
                  <xs:annotation>
                    <xs:documentation>
                      The maximum forward speed above which vortex trails are shown at highest density
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="anycontent">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:any processContents="skip" />
    </xs:sequence>
    <xs:anyAttribute processContents="skip" />
  </xs:complexType>

  <xs:element name="parameters">
    <xs:annotation>
      <xs:documentation>
        Parameters library document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:all>
        <xs:element name="playerflight" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="aiflight" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="aicombat" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="spaceflight" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="playerfirstperson" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="playerfirstpersongeometry" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="platformnavigation" type="platformnavigationparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="navigation" type="navigationparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="playercamera" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="playerhelmet" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="environmentobject" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="highlight" type="highlight" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              Highlight settings
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="scanlevel" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="stationicon" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="holomap" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="minigame" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="longrangescan" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="drop" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="hintpositions" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="physics" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="bonuscontent" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="damagestate" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="engine" type="engineparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="controlpanel" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="materials" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="economy" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="hazardwarning" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="scriptparams" type="scriptparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="jobs" type="jobsparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="masstraffic" type="masstrafficparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="lowattentioncombat" type="lowattentioncombatparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="lootmagnet" type="lootmagnetparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="docking" type="dockingparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="building" type="buildingparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="waypoint" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="render" type="renderparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="sound" type="soundparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="workforce" type="workforceparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="upgraderesources" type="upgraderesourceparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="productioncheck" type="productioncheckparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="exclusionzones" type="exclusionzoneparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="weaponmodes" type="weaponmodeparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="pointer" type="pointerparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="weaponpointer" type="weaponpointerparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="storage" type="storageparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="mining" type="miningparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="god" type="godparams" minOccurs="0" maxOccurs="1" />
        <xs:element name="input" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="loadout" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="equipmentmod" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="voice" type="anycontent" minOccurs="0" maxOccurs="1" />
        <xs:element name="fightmusic" type="anycontent" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              If at least *mintargets* within *maxdistance* meters have been attacked during the last *attackduration* seconds, play fight music for at least *minduration* seconds.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:complexType name="peopleelement">
    <xs:group ref="people"/>
    <xs:attribute name="id" type="idname" use="required">
      <xs:annotation>
        <xs:documentation>
          ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <!-- ===== Root element ==== -->

  <xs:element name="peopledefinitions">
    <xs:annotation>
      <xs:documentation>
        PeopleDB document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="people" type="peopleelement"/>
      </xs:sequence>
    </xs:complexType>

  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <!-- ===== Simple types ==== -->

  <xs:simpleType name="quota_macro">
    <xs:annotation>
      <xs:documentation>
        Macro
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:simpleType name="quota_missiontype">
    <xs:annotation>
      <xs:documentation>
        Mission type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="plot" />
      <xs:enumeration value="trade" />
      <xs:enumeration value="fight" />
      <xs:enumeration value="build" />
      <xs:enumeration value="think" />
      <xs:enumeration value="other" />
      <xs:enumeration value="station" />
      <xs:enumeration value="board" />
      <xs:enumeration value="build_ship" />
      <xs:enumeration value="build_station" />
      <xs:enumeration value="buy" />
      <xs:enumeration value="deliver" />
      <xs:enumeration value="destroy" />
      <xs:enumeration value="dockat" />
      <xs:enumeration value="drop" />
      <xs:enumeration value="escort" />
      <xs:enumeration value="explore" />
      <xs:enumeration value="find" />
      <xs:enumeration value="flyto" />
      <xs:enumeration value="follow" />
      <xs:enumeration value="hack" />
      <xs:enumeration value="kill" />
      <xs:enumeration value="patrol" />
      <xs:enumeration value="pickup" />
      <xs:enumeration value="protect" />
      <xs:enumeration value="race" />
      <xs:enumeration value="repair" />
      <xs:enumeration value="restock" />
      <xs:enumeration value="scan" />
      <xs:enumeration value="sell" />
      <xs:enumeration value="talkto" />
      <xs:enumeration value="transport" />
      <xs:enumeration value="hazardousmaterials" />
      <xs:enumeration value="intelligence" />
      <xs:enumeration value="intoxicants" />
      <xs:enumeration value="military" />
      <xs:enumeration value="pharmaceuticals" />
      <xs:enumeration value="police" />
      <xs:enumeration value="protectedspecies" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="quota_actortype">
    <xs:annotation>
      <xs:documentation>
        Actor (entity) type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="entitytypelookup" />
  </xs:simpleType>

  <xs:simpleType name="quota_limit">
    <xs:union memberTypes="xs:nonNegativeInteger">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="none" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="quota_docktype">
    <xs:annotation>
      <xs:documentation>
        Dock population type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="build" />
      <xs:enumeration value="trade" />
      <xs:enumeration value="drones" />
      <xs:enumeration value="ships" />
      <xs:enumeration value="repair" />
      <xs:enumeration value="ammo" />
      <xs:enumeration value="bar" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="quota_cratetype">
    <xs:annotation>
      <xs:documentation>
        Crate visibility type
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="exposed" />
      <xs:enumeration value="hidden" />
      <xs:enumeration value="secret" />
      <xs:enumeration value="topsecret" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="quota_cratetag">
    <xs:restriction base="xs:string">
      <xs:enumeration value="crate_s" />
      <xs:enumeration value="crate_m" />
      <xs:enumeration value="crate_l" />
    </xs:restriction>
  </xs:simpleType>

  <!-- ===== Attribute groups ==== -->

  <xs:attributeGroup name="quota_wareamount">
    <xs:attribute name="amount" type="xs:nonNegativeInteger" />
    <xs:attribute name="min" type="xs:nonNegativeInteger" />
    <xs:attribute name="max" type="xs:nonNegativeInteger" />
    <xs:attribute name="chance">
      <xs:annotation>
        <xs:documentation>
          Chance percentage of this item being part of the content, if evaluated amount is nonzero (defaults to 100)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="100" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- ===== Offers ==== -->

  <xs:complexType name="quota_offer">
    <xs:annotation>
      <xs:documentation>
        Quota definition for mission type
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="type" type="quota_missiontype" use="required" />
    <xs:attribute name="weight" type="xs:nonNegativeInteger" />
    <xs:attribute name="zonelimit" type="quota_limit" />
  </xs:complexType>

  <xs:complexType name="quota_offers">
    <xs:annotation>
      <xs:documentation>
        Mission offer quota definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="offer" type="quota_offer" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="zonelimit" type="quota_limit" />
  </xs:complexType>

  <!-- ===== Actors ==== -->

  <xs:complexType name="quota_character">
    <xs:group ref="createnpc" minOccurs="0" maxOccurs="unbounded" />
    <xs:attributeGroup ref="createnpc" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="quota_actor_base">
    <xs:annotation>
      <xs:documentation>
        Quota definition for actor type
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="type" type="quota_actortype" use="required" />
    <xs:attribute name="weight" type="xs:nonNegativeInteger" />
    <xs:attribute name="zonelimit" type="quota_limit" />
    <xs:attribute name="stationlimit" type="quota_limit" />
    <xs:attribute name="modulelimit" type="quota_limit" />
    <xs:attribute name="roomlimit" type="quota_limit" />
  </xs:complexType>

  <xs:complexType name="quota_actors_base">
    <xs:annotation>
      <xs:documentation>
        Actor quota definition
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="zonelimit" type="quota_limit" />
    <xs:attribute name="stationlimit" type="quota_limit" />
    <xs:attribute name="modulelimit" type="quota_limit" />
    <xs:attribute name="roomlimit" type="quota_limit" />
  </xs:complexType>

  <xs:complexType name="quota_dock">
    <xs:annotation>
      <xs:documentation>
        Overrides the general actor weight for the specified dock population type
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="type" type="quota_docktype" use="required" />
    <xs:attribute name="weight" type="xs:nonNegativeInteger" use="required" />
  </xs:complexType>

  <!-- Actors with optional character definition -->
  <xs:complexType name="quota_actors">
    <xs:complexContent>
      <xs:extension base="quota_actors_base">
        <xs:sequence>
          <xs:element name="actor" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
              <xs:complexContent>
                <xs:extension base="quota_actor_base">
                  <xs:sequence>
                    <xs:element name="dock" type="quota_dock" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element name="character" type="quota_character" minOccurs="0" maxOccurs="1" />
                  </xs:sequence>
                </xs:extension>
              </xs:complexContent>
            </xs:complexType>
            <xs:key name="quota_actor_dock_type">
              <xs:selector xpath="dock" />
              <xs:field xpath="@type" />
            </xs:key>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Actors with required character definition -->
  <xs:complexType name="quota_actors_root">
    <xs:complexContent>
      <xs:extension base="quota_actors_base">
        <xs:sequence>
          <xs:element name="actor" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
              <xs:complexContent>
                <xs:extension base="quota_actor_base">
                  <xs:sequence>
                    <xs:element name="dock" type="quota_dock" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element name="character" type="quota_character" minOccurs="1" maxOccurs="1" />
                  </xs:sequence>
                </xs:extension>
              </xs:complexContent>
            </xs:complexType>
            <xs:key name="quota_actor_root_dock_type">
              <xs:selector xpath="dock" />
              <xs:field xpath="@type" />
            </xs:key>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- ===== Crates ==== -->

  <xs:complexType name="quota_crate">
    <xs:annotation>
      <xs:documentation>
        Quota definition for crate type
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="content" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Candidate for crate content
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ware" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Ware amount definition
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="ware" type="xs:string" use="required" />
                <xs:attributeGroup ref="quota_wareamount" />
              </xs:complexType>
            </xs:element>
            <xs:element name="money" minOccurs="0" maxOccurs="1">
              <xs:annotation>
                <xs:documentation>
                  Money
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attributeGroup ref="quota_wareamount" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="tags">
            <xs:annotation>
              <xs:documentation>
                Crate connection tag restrictions for this content
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:list itemType="quota_cratetag" />
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="weight" type="xs:nonNegativeInteger" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="type" type="quota_cratetype" use="required"/>
    <xs:attribute name="weight" type="xs:nonNegativeInteger" use="required" />
    <xs:attribute name="roomlimit" type="quota_limit"/>
  </xs:complexType>

  <xs:complexType name="quota_crates">
    <xs:annotation>
      <xs:documentation>
        Crate quota definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="crate" type="quota_crate" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="roomlimit" type="quota_limit" />
  </xs:complexType>

  <!-- ===== Crafting ==== -->

  <xs:complexType name="quota_crafting">
    <xs:annotation>
      <xs:documentation>
        Crafting crate quota definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ware" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Crafting ware definition
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="crate" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>
                  Crate candidate for a crafting resource
                </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                <xs:attribute name="weight" type="xs:nonNegativeInteger" use="required" />
                <xs:attribute name="type" type="quota_cratetype" use="required"/>
                <xs:attribute name="tags">
                  <xs:annotation>
                    <xs:documentation>
                      Crate connection tag restrictions for this crate
                    </xs:documentation>
                  </xs:annotation>
                  <xs:simpleType>
                    <xs:list itemType="quota_cratetag" />
                  </xs:simpleType>
                </xs:attribute>
                <xs:attribute name="ware" type="xs:string">
                  <xs:annotation>
                    <xs:documentation>
                      Crafting resource ware (optional - if present, only crate definitions with this ware will be considered for placing the resource)
                    </xs:documentation>
                  </xs:annotation>
                </xs:attribute>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="ware" type="xs:string" use="required" />
          <xs:attribute name="weight" type="xs:nonNegativeInteger" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="chance">
      <xs:annotation>
        <xs:documentation>
          Chance percentage of crates with crafting items being spawned for a station (defaults to 100)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:float">
          <xs:minInclusive value="0" />
          <xs:maxInclusive value="100" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <!-- ===== Spaces ==== -->

  <xs:complexType name="quota_zone">
    <xs:annotation>
      <xs:documentation>
        Zone
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="offers" type="quota_offers" minOccurs="0" maxOccurs="1" />
      <xs:element name="actors" type="quota_actors" minOccurs="0" maxOccurs="1" />
      <xs:element name="crates" type="quota_crates" minOccurs="0" maxOccurs="1" />
      <xs:element name="crafting" type="quota_crafting" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="macro" type="quota_macro" use="required" />
  </xs:complexType>

  <xs:complexType name="quota_sector">
    <xs:annotation>
      <xs:documentation>
        Sector
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="offers" type="quota_offers" minOccurs="0" maxOccurs="1" />
      <xs:element name="actors" type="quota_actors" minOccurs="0" maxOccurs="1" />
      <xs:element name="crates" type="quota_crates" minOccurs="0" maxOccurs="1" />
      <xs:element name="crafting" type="quota_crafting" minOccurs="0" maxOccurs="1" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="zone" type="quota_zone" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="macro" type="quota_macro" use="required" />
  </xs:complexType>

  <xs:complexType name="quota_cluster">
    <xs:annotation>
      <xs:documentation>
        Cluster
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="offers" type="quota_offers" minOccurs="0" maxOccurs="1" />
      <xs:element name="actors" type="quota_actors" minOccurs="0" maxOccurs="1" />
      <xs:element name="crates" type="quota_crates" minOccurs="0" maxOccurs="1" />
      <xs:element name="crafting" type="quota_crafting" minOccurs="0" maxOccurs="1" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="sector" type="quota_sector" />
        <xs:element name="zone" type="quota_zone" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="macro" type="quota_macro" use="required" />
  </xs:complexType>

  <!-- ===== Root ==== -->

  <xs:element name="quotas">
    <xs:annotation>
      <xs:documentation>
        Mission quota definitions
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="offers" type="quota_offers" minOccurs="0" maxOccurs="1" />
        <xs:element name="actors" type="quota_actors_root" minOccurs="0" maxOccurs="1" />
        <xs:element name="crates" type="quota_crates" minOccurs="0" maxOccurs="1" />
        <xs:element name="crafting" type="quota_crafting" minOccurs="0" maxOccurs="1" />
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="cluster" type="quota_cluster" />
          <xs:element name="sector" type="quota_sector" />
          <xs:element name="zone" type="quota_zone" />
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="loadmacros" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>
            Load macros even if they are not used in the universe map? May be useful to detect typos. (default is false)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:simpleType name="iconid">
    <xs:restriction base="idname" />
  </xs:simpleType>

  <xs:complexType name="icon">
    <xs:attribute name="active" type="iconid" use="required">
      <xs:annotation>
        <xs:documentation>
          Active icon id for faction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="inactive" type="iconid" use="required">
      <xs:annotation>
        <xs:documentation>
          Inactive icon id for faction
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="relationvalue">
    <xs:annotation>
      <xs:documentation>
        Relationship value
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="-1">
        <xs:annotation>
          <xs:documentation>
            I do not like you
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>
            I like you
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="0">
        <xs:annotation>
          <xs:documentation>
            I am neutral towards you
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="raceid">
    <xs:restriction base="xs:string">
      <xs:pattern value="([a-z])+" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="relation">
    <xs:attribute name="race" type="racelookup">
      <xs:annotation>
        <xs:documentation>
          Faction id for relationship
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="relation" type="relationvalue">
      <xs:annotation>
        <xs:documentation>
          Relation value for relationship
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="relations">
    <xs:sequence>
      <xs:element name="relation" type="relation" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Relation for one faction to another
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="characterspeed">
    <xs:attribute name="acceleration" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default acceleration (in meters/s^2) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="slowwalk" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default slowwalk speed (in meters/s) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="walk" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default walk speed (in meters/s) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="run" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default run speed (in meters/s) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="charactereventmonitor">
    <xs:attribute name="adjusty" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Height adjustment for character sitting in event monitor
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="adjustz" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Depth adjustment for character sitting in event monitor
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="character">
    <xs:sequence>
      <xs:element name="speed" type="characterspeed" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Character speed definition
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="eventmonitor" type="charactereventmonitor" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Position adjustment when sitting in event monitor
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="height" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default height (in meters) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="width" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default width (in meters) for a character of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="chair">
    <xs:attribute name="config" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Chair configuration used for members of this race (default: chairconfig_default)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="animation" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Chair animation used for members of this race (default: chair_default_active)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="racedef">
    <xs:sequence>
      <xs:element name="chair" type="chair" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Chair definitions
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="character" type="character" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Character definitions
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="icon" type="icon" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Icons for a faction
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="relations" type="relations" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Relations for a race
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="raceid">
      <xs:annotation>
        <xs:documentation>
          Race id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Race name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Race description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="shortname" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Short race name (i.e. abbreviation)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="names" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Text page ID for names of members of this race
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="constructionbias" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Construction direction bias (use range 0.1 to 10.0 where less than 1.0 prefers vertical connections, 1.0 is balanced, and greater than 1.0 prefers horizontal connections, default is 1.0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="races">
    <xs:sequence>
      <xs:element name="race" type="racedef" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Definition of a single race
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="races" type="races">
    <xs:annotation>
      <xs:documentation>
        Race DB
      </xs:documentation>
    </xs:annotation>
  </xs:element>

</xs:schema>
ï»¿<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- define additional simple types-->
  <xs:simpleType name="PositiveInteger">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="RefString">
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Za-z0-9_\-#]+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="NonNegativeFloat">
    <xs:restriction base="xs:float">
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ColorValue">
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:maxInclusive value="255" />
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="perlinnoise">
    <xs:attribute name="noisescale" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          Scales the perlin noise so that it forms structures of more appropriate sizes. Defaults to 1000.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="seed" type="PositiveInteger">
      <xs:annotation>
        <xs:documentation>
          Used for the Perlin noise generator. If not supplied, the region's macro name is hashed to get a consistent seed.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minnoisevalue" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          Positions in the region where the noise value is below this number are not used for placing objects, and nebula fields are not rendered. Defaults to 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="maxnoisevalue" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          Positions in the region where the noise value is above this number are not used for placing objects, and nebula fields are not rendered.Defaults to 1.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="field">
    <xs:attribute name="lodrule">
      <xs:annotation>
        <xs:documentation>
          The connection tag to use when looking up the LOD rule (see renderparam_library.xml). Leave empty to use the default rules for fields.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="perlinnoise" />
  </xs:attributeGroup>

  <xs:attributeGroup name="objectfield">
    <xs:attribute name="ref" type="RefString" />
    <xs:attribute name="groupref" type="RefString">
      <xs:annotation>
        <xs:documentation>
          Reference to a region object group from libraries/regionobjectgroups.xml
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="densityfactor" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          The factor to multiply the region's base density with, which is in objects per 100 kmÂ³. Defaults to 1.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="distancefactor" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          The fraction of each object's bounding sphere to be used for obstruction checks during population. Defaults to 1 for fields with physical objects, like asteroids, and 0 for others.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="rotation" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          The base angular speed of created objects, multiplied with the region's angular speed. Defaults to 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="rotationvariation" type="NonNegativeFloat">
      <xs:annotation>
        <xs:documentation>
          The randomized variation in angular speeds of created objects (in deg/s). Defaults to 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="allowpitchrotation" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether to allow the x axis (pitch) for random rotation. Defaults to true.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="allowyawrotation" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether to allow the y axis (yaw) for random rotation. Defaults to true.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="allowrollrotation" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Whether to allow the z axis (roll) for random rotation. Defaults to true.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="boxchecks">
      <xs:annotation>
        <xs:documentation>
          Whether to use exact bounding boxes instead of much faster spheres for obstruction checks when populating the field with objects. Defaults to false.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="resourcefield">
    <xs:attribute name="resources" use="optional">
      <xs:annotation>
        <xs:documentation>
          The resource ware for this field - recommended to use only when not using an object group
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:list>
          <xs:simpleType>
            <xs:restriction base="xs:NMTOKEN">
              <xs:enumeration value="ore" />
              <xs:enumeration value="nividium" />
              <xs:enumeration value="silicon" />
              <xs:enumeration value="ice" />
              <xs:enumeration value="hydrogen" />
              <xs:enumeration value="helium" />
              <xs:enumeration value="methane" />
            </xs:restriction>
          </xs:simpleType>
        </xs:list>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="yield" type="NonNegativeFloat" use="optional">
      <xs:annotation>
        <xs:documentation>
          The yield - either per object (for fields that instantiate then, like asteroid fields) or per area (for others, like nebulae). Defaults to 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="replenishtime" type="NonNegativeFloat" use="optional">
      <xs:annotation>
        <xs:documentation>
          The time (in minutes) it would take the region to replenish from being empty back to full yield. Defaults to 60.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="gatherspeedfactor" type="NonNegativeFloat" use="optional">
      <xs:annotation>
        <xs:documentation>
          A factor to modify how fast resources can be gathered here. Defaults to 1.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:attributeGroup name="resourceobjectfield">
    <xs:attributeGroup ref="objectfield" />
    <xs:attributeGroup ref="resourcefield" />
    <xs:attribute name="resourcepercentage" type="NonNegativeFloat" use="optional">
      <xs:annotation>
        <xs:documentation>
          The chance, in percent, for each instantiated object to have any yield at all. Defaults to 100.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="yieldvariation" type="NonNegativeFloat" use="optional">
      <xs:annotation>
        <xs:documentation>
          The maximum variation in yield from object to object. Defaults to 0.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- regions node -->
  <xs:element name="regions">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="region" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="boundary">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" name="size">
          <xs:complexType>
            <xs:attribute name="r" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Radius for sphere, cylinder or spline tube boundaries.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="linear" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Height for cylinder boundaries.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="x" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Side length in x direction for box boundaries.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="y" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Side length in y direction for box boundaries.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="z" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Side length in z direction for box boundaries.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="splineposition">
          <xs:annotation>
            <xs:documentation>
              Spline point. Coordinates are relative to the region. tx/ty/tz are the tangent direction.
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:attribute name="x" type="xs:float" />
            <xs:attribute name="y" type="xs:float" />
            <xs:attribute name="z" type="xs:float" />
            <xs:attribute name="tx" type="xs:float" />
            <xs:attribute name="ty" type="xs:float" />
            <xs:attribute name="tz" type="xs:float" />
            <xs:attribute name="inlength" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Incoming tangent length.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="outlength" type="NonNegativeFloat">
              <xs:annotation>
                <xs:documentation>
                  Outgoing tangent length.
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="class" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="box" />
            <xs:enumeration value="sphere" />
            <xs:enumeration value="cylinder" />
            <xs:enumeration value="splinetube" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="step">
    <xs:complexType>
      <xs:attribute name="position" type="NonNegativeFloat" use="required" />
      <xs:attribute name="value" type="NonNegativeFloat" use="required" />
    </xs:complexType>
  </xs:element>

  <xs:element name="falloff">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="lateral">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="2" maxOccurs="unbounded" ref="step" />
            </xs:sequence>
            <xs:attribute name="default" type="xs:float" use="optional" />
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="radial">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="2" maxOccurs="unbounded" ref="step" />
            </xs:sequence>
            <xs:attribute name="default" type="xs:float" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="damage">
    <xs:complexType>
      <xs:attribute name="value" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The damage value applied to shields first and then hull.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="shield" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The damage value applied only to shields.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="hull" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The damage value applied only to hull, bypassing shields.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="noshield" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The damage value applied to hull only if shields are down.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="speedcurve">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>
          The steps define damage multipliers at certain speeds.
        </xs:documentation>
      </xs:annotation>
      <xs:sequence>
        <xs:element minOccurs="2" maxOccurs="unbounded" ref="step" />
      </xs:sequence>
      <xs:attribute name="default" type="xs:float" use="optional" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region -->
  <xs:element name="region">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" ref="boundary" />
        <xs:element minOccurs="0" maxOccurs="1" ref="falloff" />
        <xs:element minOccurs="1" maxOccurs="1" ref="fields" />
        <xs:element minOccurs="0" maxOccurs="1" ref="resources" />
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use="required" />
      <xs:attribute name="density" type="NonNegativeFloat">
        <xs:annotation>
          <xs:documentation>
            The base density of created objects, in objects per 100 kmÂ³. Defaults to 1.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="rotation" type="xs:float">
        <xs:annotation>
          <xs:documentation>
            The base angular speed of created objects (in deg/s). Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attributeGroup ref="perlinnoise" />
      <xs:attribute name="persistencetime" type="xs:float">
        <xs:annotation>
          <xs:documentation>
            If defined, any spawned region objects will stay for as long as the player is in the same cluster, and for the given time when in a different cluster before being removed.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields -->
  <xs:element name="fields">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="ambientsound" />
        <xs:element ref="asteroid" />
        <xs:element ref="damagefield" />
        <xs:element ref="debris" />
        <xs:element ref="effect" />
        <xs:element ref="nebula" />
        <xs:element ref="object" />
        <xs:element ref="positional" />
        <xs:element ref="viewcorrection" />
      </xs:choice>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/<fieldtype>/scaneffect -->
  <xs:element name="scaneffect">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>
          This effect, if defined, will be created inside the valid region volume when long range scanned
        </xs:documentation>
      </xs:annotation>
      <xs:attribute name="ref" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation>
            The scan result effect definition, see libraries/effects.xml
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="density" type="xs:float" use="optional">
        <xs:annotation>
          <xs:documentation>
            The effect density, defaults to 1.0
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/<fieldtype>/color -->
  <xs:element name="color">
    <xs:complexType>
      <xs:annotation>
        <xs:documentation>
          This color, if defined, will be used to change the appearance of region objects
        </xs:documentation>
      </xs:annotation>
      <xs:attribute name="r" type="ColorValue">
        <xs:annotation>
          <xs:documentation>
            Red color value (0-255, default: 0)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="g" type="ColorValue">
        <xs:annotation>
          <xs:documentation>
            Green color value (0-255, default: 0)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="b" type="ColorValue">
        <xs:annotation>
          <xs:documentation>
            Blue color value (0-255, default: 0)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="a" type="ColorValue">
        <xs:annotation>
          <xs:documentation>
            Alpha value (0-255, default: 255)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="v" type="xs:float">
        <xs:annotation>
          <xs:documentation>
            Random color variation, all components (including Alpha) will be multiplied with the same random number between 1-v and 1
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/asteroid -->
  <xs:element name="asteroid">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
        <xs:element ref="color" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attributeGroup ref="resourceobjectfield" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/damagefield -->
  <xs:element name="damagefield">
    <xs:complexType>
      <xs:sequence minOccurs="1" maxOccurs="1">
        <xs:element ref="damage" minOccurs="1" maxOccurs="1" />
        <xs:element ref="speedcurve" minOccurs="0" maxOccurs="1" />
        <xs:element name="effects" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:annotation>
              <xs:documentation>
                These effects, if defined, will be created in the player's cockpit when the ship is damaged
              </xs:documentation>
            </xs:annotation>
            <xs:attribute name="hull" type="xs:string" use="optional">
              <xs:annotation>
                <xs:documentation>
                  The "hull damaged" effect definition, see libraries/effects.xml
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="shield" type="xs:string" use="optional">
              <xs:annotation>
                <xs:documentation>
                  The "shield damaged" effect definition, see libraries/effects.xml
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="mindelay" type="xs:float" use="required">
              <xs:annotation>
                <xs:documentation>
                  The minimum delay between effects
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="maxdelay" type="xs:float" use="required">
              <xs:annotation>
                <xs:documentation>
                  The maximum delay between effects
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/debris -->
  <xs:element name="debris">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attributeGroup ref="resourceobjectfield" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/effect -->
  <xs:element name="effect">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="1">
        <xs:element ref="damage" />
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attribute name="ref" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>
            The effect definition. (See effects.xml)
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="delay" type="xs:float" use="required">
        <xs:annotation>
          <xs:documentation>
            The base delay between 2 effects being created (in seconds).
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="delayvariation" type="xs:float" use="optional">
        <xs:annotation>
          <xs:documentation>
            The variation applied to the base delay between 2 effects being created (in seconds). Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="maxdistance" type="xs:float" use="optional">
        <xs:annotation>
          <xs:documentation>
            The maximum distance to the player at which effects will be created (in m). Defaults to 10000.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/nebula -->
  <xs:element name="nebula">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
        <xs:element ref="color" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attributeGroup ref="resourcefield" />
      <xs:attribute name="ref" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation>
            The macro name of the local fog component.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uniformred" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The red component of the uniform fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uniformgreen" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The green component of the uniform fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uniformblue" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The blue component of the uniform fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uniformdensity" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The factor to multiply the region's base density with to get the alpha scale. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="localred" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The red component of the local fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="localgreen" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The green component of the local fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="localblue" type="ColorValue" use="optional">
        <xs:annotation>
          <xs:documentation>
            The blue component of the local fog color. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="localdensity" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The factor to multiply the region's base density with to get the alpha scale. Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="fogdistance" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            The distance of the background fog in m. Defaults to 5000.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="backgroundfog" type="xs:boolean" use="optional">
        <xs:annotation>
          <xs:documentation>
            Defaults to true.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/object -->
  <xs:element name="object">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attributeGroup ref="objectfield" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/positional -->
  <xs:element name="positional">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scaneffect" minOccurs="0" maxOccurs="1" />
        <xs:element ref="color" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
      <xs:attributeGroup ref="field" />
      <xs:attributeGroup ref="objectfield" />
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/viewcorrection -->
  <xs:element name="viewcorrection">
    <xs:complexType>
      <xs:attributeGroup ref="field" />
      <xs:attribute name="tonemapLUT" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>
            The name of the tone map texture, including the path. Example: assets\textures\RegionLUTs\your_tone_map.dds
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="exposure" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="eyeadaptionspeed" type="NonNegativeFloat" use="optional">
        <xs:annotation>
          <xs:documentation>
            Defaults to 0.
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/fields/ambientsound -->
  <xs:element name="ambientsound">
    <xs:complexType>
      <xs:attributeGroup ref="field" />
      <xs:attribute name="soundid" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation>
            The sound ID of the sound to be played while in the region
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/resources -->
  <xs:element name="resources">
    <xs:annotation>
      <xs:documentation>
        Resource properties for this region
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="resource" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <!-- regions/region/resources/resource -->
  <xs:element name="resource">
    <xs:annotation>
      <xs:documentation>
        Properties for a specific resource ware. If valid, this will be distributed over all resource fields with an object group that defines the matching resource ware (see libraries/regionobjectgroups.xml). If the actual object density is higher than required for the resource density then only a portion of objects are going to have resources, with the rest being empty.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:attribute name="ware" use="required">
        <xs:annotation>
          <xs:documentation>
            The resource ware ID
          </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="ore" />
            <xs:enumeration value="nividium" />
            <xs:enumeration value="silicon" />
            <xs:enumeration value="ice" />
            <xs:enumeration value="hydrogen" />
            <xs:enumeration value="helium" />
            <xs:enumeration value="methane" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="yield" use="required">
        <xs:annotation>
          <xs:documentation>
            The yield for this resource - see libraries/regionyields.xml for valid values
          </xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="factor">
        <xs:annotation>
          <xs:documentation>
            A factor between 0 and 1 that's multiplied on the base yield density
          </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:float">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="1"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>
ï»¿<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="groups">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="group" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              A region object group, to be referenced in region_definitions.xml
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="select" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="macro" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        The macro name of the region object
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="weight">
                    <xs:annotation>
                      <xs:documentation>
                        The weight of this macro selection (defaults to 1)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" use="required" type="xs:ID">
              <xs:annotation>
                <xs:documentation>
                  The name of this region object group
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="resource">
              <xs:annotation>
                <xs:documentation>
                  The resource ware ID to be assigned when this group is used
                </xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="ore" />
                  <xs:enumeration value="nividium" />
                  <xs:enumeration value="silicon" />
                  <xs:enumeration value="ice" />
                  <xs:enumeration value="hydrogen" />
                  <xs:enumeration value="helium" />
                  <xs:enumeration value="methane" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="yield">
              <xs:annotation>
                <xs:documentation>
                  The base yield for region objects in this group
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="yieldvariation">
              <xs:annotation>
                <xs:documentation>
                  The yield variation fraction for region objects in this group
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
ï»¿<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="regionyields">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="resource" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>
              Yield definitions for a specific resource ware
            </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="yield" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="name" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        The ID of this yield definition, to be referenced in region_definitions.xml
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="resourcedensity" use="required" type="xs:float">
                    <xs:annotation>
                      <xs:documentation>
                        The resource density, in ware amount per kmÂ³
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="replenishtime" use="required" type="xs:float">
                    <xs:annotation>
                      <xs:documentation>
                        The time it takes to replenish the resources from empty to full (minutes)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="gatherspeedfactor" type="xs:float">
                    <xs:annotation>
                      <xs:documentation>
                        The gather speed factor (only relevant for liquid resources)
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="scaneffect" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        The scan result effect definition, see libraries/effects.xml
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="scaneffectdensity" type="xs:float" use="optional">
                    <xs:annotation>
                      <xs:documentation>
                        The scan result effect density, defaults to 1.0
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="scaneffectintensity" type="xs:float">
                    <xs:annotation>
                      <xs:documentation>
                        The scan result effect intensity (opacity, volume, etc.), defaults to 1.0
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="ware" use="required">
              <xs:annotation>
                <xs:documentation>
                  The resource ware ID
                </xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="ore" />
                  <xs:enumeration value="nividium" />
                  <xs:enumeration value="silicon" />
                  <xs:enumeration value="ice" />
                  <xs:enumeration value="hydrogen" />
                  <xs:enumeration value="helium" />
                  <xs:enumeration value="methane" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="scaneffect" type="xs:string" use="optional">
              <xs:annotation>
                <xs:documentation>
                  The default scan result effect definition, see libraries/effects.xml
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="scaneffectdensity" type="xs:float" use="optional">
              <xs:annotation>
                <xs:documentation>
                  The default scan result effect density, defaults to 1.0
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="scaneffectintensity" type="xs:float">
              <xs:annotation>
                <xs:documentation>
                  The default scan result effect intensity (opacity, volume, etc.), defaults to 1.0
                </xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="name">
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Za-z_][A-Za-z0-9_]*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="property">
    <xs:annotation>
      <xs:documentation>
        Script property
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Property name as used in expressions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="result" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Documentation of property result
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="name">
      <xs:annotation>
        <xs:documentation>
          Datatype of the property result
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="import">
    <xs:annotation>
      <xs:documentation>
        Import script properties from an XML or XSD file using XPath expressions
      </xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="1" maxOccurs="unbounded">
      <xs:element name="property">
        <xs:annotation>
          <xs:documentation>
            Define how to import the properties
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="name" use="required">
            <xs:annotation>
              <xs:documentation>
                XPath expression that locates the text node or attribute containing the property name
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="result">
            <xs:annotation>
              <xs:documentation>
                XPath expression that locates the text node or attribute containing the result description
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="type">
            <xs:annotation>
              <xs:documentation>
                Datatype of the property result
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="ignoreprefix" type="xs:boolean">
            <xs:annotation>
              <xs:documentation>
                In case the located name contains dots, should the prefix (until the last dot) be ignored?
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
        <xs:keyref name="import_property_type" refer="type_name">
          <xs:selector xpath="." />
          <xs:field xpath="@type" />
        </xs:keyref>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="source" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Name of the source XML file which contains the property data to be imported
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="select" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          XPath expression of property nodes in the imported file
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:group name="properties">
    <xs:sequence>
      <xs:element name="property" type="property" minOccurs="0" maxOccurs="unbounded">
        <xs:keyref name="property_type" refer="type_name">
          <xs:selector xpath="." />
          <xs:field xpath="@type" />
        </xs:keyref>
      </xs:element>
      <xs:element name="import" type="import" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:group>

  <xs:complexType name="keyword">
    <xs:annotation>
      <xs:documentation>
        Definition of a script keyword that is a valid &quot;stand-alone&quot; expression
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="properties" />
    <xs:attribute name="name" type="name" use="required">
      <xs:annotation>
        <xs:documentation>
          Keyword name as used in expressions
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Keyword documentation
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="name">
      <xs:annotation>
        <xs:documentation>
          Datatype of the keyword
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="script">
      <xs:annotation>
        <xs:documentation>
          Type of script that supports this keyword (MD, AI or NPC State Machine script). Default is &quot;any&quot;
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="any" />
          <xs:enumeration value="md" />
          <xs:enumeration value="ai" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="datatype">
    <xs:annotation>
      <xs:documentation>
        Definition of a real script data type, or a specialized/generalized value type for documentation purposes
        (e.g. &quot;ship&quot; as specialization of &quot;component&quot;, or &quot;numeric&quot; as generalization of &quot;integer&quot; etc.)
      </xs:documentation>
    </xs:annotation>
    <xs:group ref="properties" />
    <xs:attribute name="name" type="name" use="required">
      <xs:annotation>
        <xs:documentation>
          Unique name for the datatype, that can be referenced in type attributes
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="type" type="name">
      <xs:annotation>
        <xs:documentation>
          Base datatype of this datatype
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="suffix" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          The number suffix that denotes the default unit of the type. Only valid for numeric types.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="pseudo" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          Is this a pseudo-datatype? Values of such types do not exist in the script system, they only exist to access further properties.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="textdb">
    <xs:annotation>
      <xs:documentation>
        Provides a path to the TextDB XML file to support format string conversion of imported text strings
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="source" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Path to a TextDB XML file
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:element name="scriptproperties">
    <xs:annotation>
      <xs:documentation>
        Documentation of keywords and properties in script expressions
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="textdb" type="textdb" minOccurs="0" maxOccurs="1" />
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="keyword" type="keyword">
            <xs:keyref name="keyword_type" refer="type_name">
              <xs:selector xpath="." />
              <xs:field xpath="@type" />
            </xs:keyref>
            <xs:key name="keyword_property_name">
              <xs:selector xpath="property" />
              <xs:field xpath="@name" />
            </xs:key>
          </xs:element>
          <xs:element name="datatype" type="datatype">
            <xs:keyref name="datatype_base_type" refer="type_name">
              <xs:selector xpath="." />
              <xs:field xpath="@type" />
            </xs:keyref>
            <xs:key name="datatype_property_name">
              <xs:selector xpath="property" />
              <xs:field xpath="@name" />
            </xs:key>
          </xs:element>
        </xs:choice>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="type_name">
      <xs:selector xpath="datatype" />
      <xs:field xpath="@name" />
    </xs:key>
  </xs:element>

</xs:schema><?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="selectionlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="one" />
      <xs:enumeration value="random" />
      <xs:enumeration value="random_except" />
      <xs:enumeration value="choose" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="filtermodelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="lowpass" />
      <xs:enumeration value="bandpass" />
      <xs:enumeration value="highpass" />
      <xs:enumeration value="notch" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="roomlookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="default" />
      <xs:enumeration value="generic" />
      <xs:enumeration value="padded cell" />
      <xs:enumeration value="room" />
      <xs:enumeration value="bath room" />
      <xs:enumeration value="living room" />
      <xs:enumeration value="stone room" />
      <xs:enumeration value="auditorium" />
      <xs:enumeration value="concert hall" />
      <xs:enumeration value="cave" />
      <xs:enumeration value="arena" />
      <xs:enumeration value="hangar" />
      <xs:enumeration value="carpeted hallway" />
      <xs:enumeration value="hallway" />
      <xs:enumeration value="stone corridor" />
      <xs:enumeration value="alley" />
      <xs:enumeration value="forest" />
      <xs:enumeration value="city" />
      <xs:enumeration value="mountains" />
      <xs:enumeration value="quarry" />
      <xs:enumeration value="plain" />
      <xs:enumeration value="parking lot" />
      <xs:enumeration value="sewer pipe" />
      <xs:enumeration value="underwater" />
      <xs:enumeration value="small room" />
      <xs:enumeration value="medium room" />
      <xs:enumeration value="large room" />
      <xs:enumeration value="medium hall" />
      <xs:enumeration value="large hall" />
      <xs:enumeration value="plate" />
      <xs:enumeration value="drugged" />
      <xs:enumeration value="dizzy" />
      <xs:enumeration value="psychotic" />
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="sample">
    <xs:attribute name="start" />
    <xs:attribute name="loop" />
    <xs:attribute name="end" />
    <xs:attribute name="startduration" />
    <xs:attribute name="loopduration" />
    <xs:attribute name="endduration" />
  </xs:attributeGroup>

  <xs:complexType name="sample">
    <xs:annotation>
      <xs:documentation>
        Sound sample or selection of samples
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="select" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attributeGroup ref="sample" />
          <xs:attribute name="weight" type="xs:integer" />
          <xs:attribute name="index" type="xs:integer" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attributeGroup ref="sample" />
    <xs:attribute name="selection" type="selectionlookup" />
  </xs:complexType>

  <xs:simpleType name="curveinputs">
    <xs:union memberTypes="xs:string">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="boostchargeprogress">
            <xs:annotation>
              <xs:documentation>
                Boost charge progress (between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="forwardspeed">
            <xs:annotation>
              <xs:documentation>
                Relative forward speed (between -1 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="forwardspeeddiff">
            <xs:annotation>
              <xs:documentation>
                Relative difference between current and target forward speed (can be between -2 and 2)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_linear">
            <xs:annotation>
              <xs:documentation>
                Total IK translation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_x">
            <xs:annotation>
              <xs:documentation>
                IK x translation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_y">
            <xs:annotation>
              <xs:documentation>
                IK y translation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_z">
            <xs:annotation>
              <xs:documentation>
                IK z translation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_angular">
            <xs:annotation>
              <xs:documentation>
                Total IK rotation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_pitch">
            <xs:annotation>
              <xs:documentation>
                IK pitch rotation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_yaw">
            <xs:annotation>
              <xs:documentation>
                IK yaw rotation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="ikspeed_roll">
            <xs:annotation>
              <xs:documentation>
                IK roll rotation speed of the sound's position reference (can be between 0 and 1)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:complexType name="customcurve">
    <xs:sequence>
      <xs:element name="point" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="position" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Input value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="value" type="xs:float">
            <xs:annotation>
              <xs:documentation>
                Output value for this point's input value
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="default" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Default value, used when input is outside of bounds defined by the curve
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="input" type="curveinputs">
      <xs:annotation>
        <xs:documentation>
          The value to be used for curve input (not required in some cases)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="distancecurve">
    <xs:annotation>
      <xs:documentation>
        Sound Volume Curve
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="point" minOccurs="2" maxOccurs="4">
        <xs:complexType>
          <xs:attribute name="distance" type="xs:float" />
          <xs:attribute name="volume" type="xs:float" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="volume">
    <xs:annotation>
      <xs:documentation>
        Sound volume
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="distancecurve" type="distancecurve" minOccurs="0" maxOccurs="1" />
      <xs:element name="lfecurve" type="distancecurve" minOccurs="0" maxOccurs="1" />
      <xs:element name="lpfdirectcurve" type="distancecurve" minOccurs="0" maxOccurs="1" />
      <xs:element name="lpfreverbcurve" type="distancecurve" minOccurs="0" maxOccurs="1" />
      <xs:element name="reverbcurve" type="distancecurve" minOccurs="0" maxOccurs="1" />
      <xs:element name="customcurve" type="customcurve" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="start" type="xs:float" />
    <xs:attribute name="loop" type="xs:float" />
    <xs:attribute name="end" type="xs:float" />
    <xs:attribute name="distance" type="xs:float" />
  </xs:complexType>

  <xs:complexType name="pitch">
    <xs:annotation>
      <xs:documentation>
        Sound pitch
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="customcurve" type="customcurve" minOccurs="0" maxOccurs="1" />
    </xs:all>
  </xs:complexType>

  <xs:complexType name="lfe">
    <xs:annotation>
      <xs:documentation>
        Sound low pass filter
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="customcurve" type="customcurve" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="start" type="xs:float" />
    <xs:attribute name="loop" type="xs:float" />
    <xs:attribute name="end" type="xs:float" />
    <xs:attribute name="distance" type="xs:float" />
  </xs:complexType>

  <xs:complexType name="effects">
    <xs:all>
      <xs:element name="doppler" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="factor" type="xs:float" />
        </xs:complexType>
      </xs:element>
      <xs:element name="fade" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="in" type="xs:float" />
          <xs:attribute name="out" type="xs:float" />
        </xs:complexType>
      </xs:element>
      <xs:element name="filter" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="mode" type="filtermodelookup" />
          <xs:attribute name="frequency" type="xs:float" />
          <xs:attribute name="oneoverq" type="xs:float" />
        </xs:complexType>
      </xs:element>
      <xs:element name="reverb" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="room" type="roomlookup" />
          <xs:attribute name="roomsize" type="xs:float" />
          <xs:attribute name="drymix" type="xs:float" />
          <xs:attribute name="density" type="xs:float" />
        </xs:complexType>
      </xs:element>
      <xs:element name="pitch" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="start" type="xs:float" />
          <xs:attribute name="end" type="xs:float" />
          <xs:attribute name="steps" type="xs:unsignedShort" />
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <xs:attributeGroup name="random_noise">
    <xs:attribute name="interval" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Average interval between random background noise samples (actual intervals are random with exponential distribution)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:simpleType name="taglist">
    <xs:list>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="damaged" />
        </xs:restriction>
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>

  <xs:complexType name="random_noise">
    <xs:sequence>
      <xs:element name="override" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attributeGroup ref="random_noise" />
          <xs:attribute name="tags" use="required" type="taglist" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attributeGroup ref="random_noise" />
  </xs:complexType>

  <xs:complexType name="sound">
    <xs:annotation>
      <xs:documentation>
        Sound definition
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="sample" type="sample" minOccurs="1" maxOccurs="1" />
      <xs:element name="volume" type="volume" minOccurs="0" maxOccurs="1" />
      <xs:element name="pitch" type="pitch" minOccurs="0" maxOccurs="1" />
      <xs:element name="lfe" type="lfe" minOccurs="0" maxOccurs="1" />
      <xs:element name="effects" type="effects" minOccurs="0" maxOccurs="1" />
      <xs:element name="random_noise" type="random_noise" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="id" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Unique sound ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Sound description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tag" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Connection tag where the sound should be played
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="repeat">
      <xs:annotation>
        <xs:documentation>
          How often is playback executed?
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:union>
          <xs:simpleType>
            <xs:restriction base="xs:short">
              <xs:minInclusive value="1" />
            </xs:restriction>
          </xs:simpleType>
          <xs:simpleType>
            <xs:restriction base="xs:short">
              <xs:enumeration value="1">
                <xs:annotation>
                  <xs:documentation>
                    Play sound once (default)
                  </xs:documentation>
                </xs:annotation>
              </xs:enumeration>
              <xs:enumeration value="-1">
                <xs:annotation>
                  <xs:documentation>
                    Infinite loop
                  </xs:documentation>
                </xs:annotation>
              </xs:enumeration>
            </xs:restriction>
          </xs:simpleType>
        </xs:union>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="is3d" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound needs 3D control
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="isunique" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound can only be played one at a time
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="preload" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound should be preloaded on gamestart
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="amount" type="xs:unsignedShort">
      <xs:annotation>
        <xs:documentation>
          Maximum/simultaneous number of active Sounds
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:simpleType name="groupsoundtags">
    <xs:union memberTypes="xs:string">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="ambient">
            <xs:annotation>
              <xs:documentation>
                Always active
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="boostcharging">
            <xs:annotation>
              <xs:documentation>
                Active while boost is charging
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="boosting">
            <xs:annotation>
              <xs:documentation>
                Active while boosting
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="accelerate">
            <xs:annotation>
              <xs:documentation>
                Triggered when throttle is increased
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="decelerate">
            <xs:annotation>
              <xs:documentation>
                Triggered when throttle is reduced
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="boostchargestarted">
            <xs:annotation>
              <xs:documentation>
                Triggered when boost charge starts (doesn't happen if there is no charge time)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="boostchargestopped">
            <xs:annotation>
              <xs:documentation>
                Triggered when boost charge is aborted before it finished
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="booststarted">
            <xs:annotation>
              <xs:documentation>
                Triggered when actual boost starts
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="booststopped">
            <xs:annotation>
              <xs:documentation>
                Triggered when boost stops, either manually or due to timeout (doesn't happen if boost was still charging)
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:complexType name="groupsound">
    <xs:annotation>
      <xs:documentation>
        Sound reference
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="sample" type="sample" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Sample (only if not using ref)
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="volume" type="volume" minOccurs="0" maxOccurs="1" />
      <xs:element name="pitch" type="pitch" minOccurs="0" maxOccurs="1" />
      <xs:element name="lfe" type="lfe" minOccurs="0" maxOccurs="1" />
      <xs:element name="effects" type="effects" minOccurs="0" maxOccurs="1" />
      <xs:element name="random_noise" type="random_noise" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="id" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Unique sound ID (id and ref cannot be used together)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="ref" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Reference to unique sound ID (id and ref cannot be used together)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Sound description (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tag" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Connection tag where the sound should be played (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tags" type="groupsoundtags">
      <xs:annotation>
        <xs:documentation>
          Group sound tags
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="repeat">
      <xs:annotation>
        <xs:documentation>
          How often is playback executed? (only if not using ref)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:union>
          <xs:simpleType>
            <xs:restriction base="xs:short">
              <xs:minInclusive value="1" />
            </xs:restriction>
          </xs:simpleType>
          <xs:simpleType>
            <xs:restriction base="xs:short">
              <xs:enumeration value="1">
                <xs:annotation>
                  <xs:documentation>
                    Play sound once (default)
                  </xs:documentation>
                </xs:annotation>
              </xs:enumeration>
              <xs:enumeration value="-1">
                <xs:annotation>
                  <xs:documentation>
                    Infinite loop
                  </xs:documentation>
                </xs:annotation>
              </xs:enumeration>
            </xs:restriction>
          </xs:simpleType>
        </xs:union>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="is3d" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound needs 3D control (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="isunique" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound can only be played one at a time (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="preload" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          This sound should be preloaded on gamestart (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="amount" type="xs:unsignedShort">
      <xs:annotation>
        <xs:documentation>
          Maximum/simultaneous number of active Sounds (only if not using ref)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="soundgroup">
    <xs:annotation>
      <xs:documentation>
        Sound group definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="sound" type="groupsound" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="id" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Unique sound group ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:element name="soundlibrary">
    <xs:annotation>
      <xs:documentation>
        Sound library document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:sequence>
          <xs:element name="sound" type="sound" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:sequence>
          <xs:element name="group" type="soundgroup" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="sound_id">
      <xs:selector xpath="sound" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="statid">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z_][a-zA-Z0-9_]*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="positiveInteger32">
    <xs:restriction base="xs:unsignedInt">
      <xs:minInclusive value="1" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="comment">
    <xs:annotation>
      <xs:documentation>
        Comment
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:simpleType name="units">
    <xs:annotation>
      <xs:documentation>
        Stat units (default is none, i.e. just counting)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="none" />
      <xs:enumeration value="seconds" />
      <xs:enumeration value="credits" />
      <xs:enumeration value="metres" />
      <xs:enumeration value="kilometres" />
      <xs:enumeration value="unixseconds" />
      <xs:enumeration value="named" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="datatype">
    <xs:annotation>
      <xs:documentation>
        Internal data type (optional, derived from units if not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="int" />
      <xs:enumeration value="int64" />
      <xs:enumeration value="float" />
      <xs:enumeration value="double" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="fractional_digits">
    <xs:annotation>
      <xs:documentation>
        Number of fractional digits (Optional, only applies to floating point data types. Default is 0. Any other value is not compatible with separators.)
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:nonNegativeInteger">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="auto" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="default">
    <xs:annotation>
      <xs:documentation>
        Default stat value (default is 0 if not supplied)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:decimal" />
  </xs:simpleType>

  <xs:simpleType name="format">
    <xs:annotation>
      <xs:documentation>
        Display format (optional, derived from units if not supplied. Use %s as placeholder for the stat value)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:simpleType name="separators">
    <xs:annotation>
      <xs:documentation>
        Use (localised) separator for groups of three digits? (Optional, default is true; if used on a floating point type, the fractional digits are discarded)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean" />
  </xs:simpleType>

  <xs:simpleType name="secret">
    <xs:annotation>
      <xs:documentation>
        Hide stat in menu if the value is the default value? (Optional, default is false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean" />
  </xs:simpleType>

  <xs:simpleType name="highest">
    <xs:annotation>
      <xs:documentation>
        Keep only the highest value? (Optional, default is false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean" />
  </xs:simpleType>

  <xs:simpleType name="account">
    <xs:annotation>
      <xs:documentation>
        Is stat stored in Steam account persistently across savegames? (Optional, default is false)
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean" />
  </xs:simpleType>

  <xs:simpleType name="leaderboard">
    <xs:annotation>
      <xs:documentation>
        Name of the corresponding Steam leaderboard if this stat should be stored in a leaderboard (optional). The name should be display-friendly but still be a unique identifier.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <!-- CopyTo/AddTo/MapTo elements -->

  <xs:complexType name="copyto">
    <xs:attribute name="stat" type="statid" use="required" >
      <xs:annotation>
        <xs:documentation>
          Name of stat to copy value to.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="multiplier" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional multiplier for the value applied to the referenced stat.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="divisor" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional divisor for the value applied to the referenced stat.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="addto">
    <xs:attribute name="stat" type="statid" use="required" >
      <xs:annotation>
        <xs:documentation>
          Name of stat to add value change to.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="multiplier" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional multiplier for the value applied to the referenced stat.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="divisor" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Optional divisor for the value applied to the referenced stat.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:complexType name="mapto">
    <xs:attribute name="stat" type="statid" use="required" >
      <xs:annotation>
        <xs:documentation>
          Name of stat to set the specified value to when this stat is within the specified range.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Minimum value of this stat (inclusive).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:double" use="optional">
      <xs:annotation>
        <xs:documentation>
          Maximum value of this stat (exclusive).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="value" type="xs:double" use="required">
      <xs:annotation>
        <xs:documentation>
          Value to set the referenced stat to.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- Achievement element -->

  <xs:complexType name="achievement">
    <xs:annotation>
      <xs:documentation>
        Declares the existence of a corresponding achievement that is unlocked when a certain stat value is reached. Multiple achievement definitions with different unlock values are possible.
        The achievement requires account=&quot;true&quot; either for this stat or for a referenced copyto stat.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="progressstep" type="positiveInteger32">
      <xs:annotation>
        <xs:documentation>
          Stat value at which achievement progress indication is displayed if the achievement is not unlocked yet. Multiples of this value will also indicate progress. (Optional, default is no indication)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="unlock" type="positiveInteger32" use="required">
      <xs:annotation>
        <xs:documentation>
          Stat value at which the corresponding achievement is unlocked.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- NamedValue element -->

  <xs:complexType name="namedvalue">
    <xs:annotation>
      <xs:documentation>
        Provides a name for a stat value. The name will be used if the value is greater than or equal to this value but lower than the next higher one.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="value" type="xs:double" use="required">
      <xs:annotation>
        <xs:documentation>
          Value
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string" use="required" >
      <xs:annotation>
        <xs:documentation>
          Name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- Stat element -->

  <xs:complexType name="stat">
    <xs:annotation>
      <xs:documentation>
        Stat definition
      </xs:documentation>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="copyto" type="copyto" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="addto" type="addto" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="mapto" type="mapto" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="namedvalue" type="namedvalue" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="achievement" type="achievement" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>

    <xs:attribute name="id" type="statid" use="required">
      <xs:annotation>
        <xs:documentation>
          ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>

    <xs:attribute name="name" use="optional">
      <xs:annotation>
        <xs:documentation>
          Localized name (TextDB reference). If not supplied then the stat is treated as hidden (not shown in menu).
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:minLength value="1" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>

    <xs:attribute name="units" type="units" />
    <xs:attribute name="datatype" type="datatype" />
    <xs:attribute name="fractional_digits" type="fractional_digits" />
    <xs:attribute name="default" type="default" />
    <xs:attribute name="format" type="format" />
    <xs:attribute name="separators" type="separators" />
    <xs:attribute name="secret" type="secret" />
    <xs:attribute name="highest" type="highest" />
    <xs:attribute name="account" type="account" />
    <xs:attribute name="leaderboard" type="leaderboard" />
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <!-- Document element -->

  <xs:element name="stats">
    <xs:annotation>
      <xs:documentation>
        Document element of stats.xml
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="stat" type="stat" minOccurs="0" maxOccurs="unbounded">
          <xs:unique name="achievement_unlock">
            <xs:selector xpath="achievement" />
            <xs:field xpath="@unlock" />
          </xs:unique>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="stat_id">
      <xs:selector xpath="stat" />
      <xs:field xpath="@id" />
    </xs:key>
    <xs:unique name="stat_leaderboard">
      <xs:selector xpath="stat" />
      <xs:field xpath="@leaderboard" />
    </xs:unique>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="common.xsd" />

  <xs:complexType name="timelineentry">
    <xs:attribute name="id" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry id
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="image" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry image
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="video" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Entry video
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="voice" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Voice sequence ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="date" type="xs:float">
      <xs:annotation>
        <xs:documentation>
          Date (integer part is year, fractional part is primarily used for ordering within a year)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="group" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Group number (controls spacing of entries)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="timeline">
    <xs:sequence>
      <xs:element name="entry" type="timelineentry" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            Definition of a single timeline entry
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="timeline" type="timeline">
    <xs:annotation>
      <xs:documentation>
        Timeline DB
      </xs:documentation>
    </xs:annotation>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="unitvalue">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]+[\.]?[0-9]*([ ]*(m|km|ms|s|min|h))?" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="profilelookup">
    <xs:restriction base="xs:string">
      <xs:enumeration value="flat">
        <xs:annotation>
          <xs:documentation>
            Flat (linear) distribution, default if no profile specified
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="increasing">
        <xs:annotation>
          <xs:documentation>
            Higher numbers are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="decreasing">
        <xs:annotation>
          <xs:documentation>
            Lower numbers are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="bell">
        <xs:annotation>
          <xs:documentation>
            Numbers in the middle of the range are more likely
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="inversebell">
        <xs:annotation>
          <xs:documentation>
            Higher and lower numbers are more likely than those in the middle
          </xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="random">
    <xs:attribute name="exact" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          Exact value (takes priority over min/max/profile/scale)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="min" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          Minimum random number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          Maximum random number (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="profile" type="profilelookup">
      <xs:annotation>
        <xs:documentation>
          Random number profile (ignored if exact is set)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="scale">
      <xs:annotation>
        <xs:documentation>
          Scale of random number profile (ignored if exact is set or if profile is flat)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="2" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:simpleType name="classlist">
    <xs:annotation>
      <xs:documentation>
        Allowed classes of object the signal leak is attached to. Specify multiple separated by space. Allows all if omitted
      </xs:documentation>
    </xs:annotation>
    <xs:list>
      <xs:simpleType>
        <xs:restriction base="xs:string" />
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>

  <xs:complexType name="amount">
    <xs:attributeGroup ref="random" >
      <xs:annotation>
        <xs:documentation>
          Random amount value.
        </xs:documentation>
      </xs:annotation>
    </xs:attributeGroup>
  </xs:complexType>

  <xs:complexType name="time">
    <xs:attributeGroup ref="random" >
      <xs:annotation>
        <xs:documentation>
          Random time value.
        </xs:documentation>
      </xs:annotation>
    </xs:attributeGroup>
  </xs:complexType>

  <xs:complexType name="distance">
    <xs:attributeGroup ref="random">
      <xs:annotation>
        <xs:documentation>
          Maximum distance at which to unlock (default: as defined by globals node)
        </xs:documentation>
      </xs:annotation>
    </xs:attributeGroup>
  </xs:complexType>

  <xs:complexType name="viewangle">
    <xs:annotation>
      <xs:documentation>
        Maximum angle away from crosshair center (horizontal or vertical), in positive degrees (default: 180, i.e. no restriction)
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="max">
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="1" />
          <xs:maxInclusive value="180" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="scannerlevel">
    <xs:annotation>
      <xs:documentation>
        Minimum/maximum level of the scanner that can unlock this (default: 0 to MAX_SCAN_LEVEL, i.e. no restriction)
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="min" type="xs:integer" />
    <xs:attribute name="max" type="xs:integer" />
  </xs:complexType>

  <xs:simpleType name="weight">
    <xs:annotation>
      <xs:documentation>
        Weight value, defaults to 1.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="1" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="owner">
    <xs:annotation>
      <xs:documentation>
        Specify at which locations this unlock may be triggered based on who owns the object.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="factions" type="xs:string" >
      <xs:annotation>
        <xs:documentation>
          Space-separated list of factions (e.g. aquarius).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="negate" type="xs:boolean" >
      <xs:annotation>
        <xs:documentation>
          True to allow only owner factions that are NOT listed in the factions attribute, defaults to false.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="relation">
    <xs:annotation>
      <xs:documentation>
        Specify required relation when unlock may be triggered based on who owns the object.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="min" type="xs:float" >
      <xs:annotation>
        <xs:documentation>
          Minimum relation (defaults to -0.2, which is lower bound of neutral)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:float" >
      <xs:annotation>
        <xs:documentation>
          Maximum relation (defaults to 1.0)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="secrecy">
    <xs:annotation>
      <xs:documentation>
        Secrecy level a component must have for this unlock to trigger.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="min" type="xs:integer" >
      <xs:annotation>
        <xs:documentation>
          Minimum secrecy level (defaults to -1)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="max" type="xs:integer" >
      <xs:annotation>
        <xs:documentation>
          Maximum secrecy level (defaults to 3)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="wares">
    <xs:annotation>
      <xs:documentation>
        Specify which wares must be traded at the target location.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="buys" type="xs:string" >
      <xs:annotation>
        <xs:documentation>
          Space-separated list of wares (e.g. energycells) that must be bought at the location.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="sells" type="xs:string" >
      <xs:annotation>
        <xs:documentation>
          Space-separated list of wares (e.g. energycells) that must be sold at the location.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="matchall" type="xs:boolean" >
      <xs:annotation>
        <xs:documentation>
          True if all wares in the list must be sold/bought, defaults to false.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="conditions">
    <xs:all>
      <xs:element name="distance" type="distance" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Maximum distance at which to unlock (default: as defined by globals node)
            Note: if max is used this will be a random value from min(default: 0!) to max
            This can result in very small values, making the unlock extremely hard to trigger!
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="owner" type="owner" minOccurs="0" maxOccurs="1" />
      <xs:element name="relation" type="relation" minOccurs="0" maxOccurs="1" />
      <xs:element name="secrecy" type="secrecy" minOccurs="0" maxOccurs="1" />
      <xs:element name="blueprintsecrecy" type="secrecy" minOccurs="0" maxOccurs="1" />
      <xs:element name="viewangle" type="viewangle" minOccurs="0" maxOccurs="1" />
      <xs:element name="wares" type="wares" minOccurs="0" maxOccurs="1" />
      <xs:element name="scannerlevel" type="scannerlevel" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="weight" type="weight" />
    <xs:attribute name="classes" type="classlist" />
    <xs:attribute name="firstperson" type="xs:boolean" >
      <xs:annotation>
        <xs:documentation>
          Whether the player must be on foot to trigger this unlock. (defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="spacesuit" type="xs:boolean" >
      <xs:annotation>
        <xs:documentation>
          Whether the player must be in a spacesuit to trigger this unlock. (defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="actions">
    <xs:all>
      <xs:element name="amount" type="amount" minOccurs="1" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Amount of the unlocked bonus effect.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="duration" type="time" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Duration of the unlocked bonus effect.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="infoconditions">
    <xs:all>
      <xs:element name="distance" type="distance" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Maximum distance at which to unlock (default: as defined by globals node)
            Note: if max is used this will be a random value from min(default: 0!) to max
            This can result in very small values, making the unlock extremely hard to trigger!
            Only evaluated if scan="false".
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="owner" type="owner" minOccurs="0" maxOccurs="1" />
      <xs:element name="relation" type="relation" minOccurs="0" maxOccurs="1" />
      <xs:element name="secrecy" type="secrecy" minOccurs="0" maxOccurs="1" />
      <xs:element name="viewangle" type="viewangle" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            Only evaluated if scan="false".
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="wares" type="wares" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Only evaluated if scan="false".
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="scannerlevel" type="scannerlevel" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="weight" type="weight" />
    <xs:attribute name="classes" type="classlist" >
      <xs:annotation>
        <xs:documentation>
          Only evaluated if scan="false".
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="scan" type="xs:boolean" use="required" >
      <xs:annotation>
        <xs:documentation>
          Whether an active scan is required to trigger this unlock. Certain conditions are ignored when this is true.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="spacesuit" type="xs:boolean" >
      <xs:annotation>
        <xs:documentation>
          Whether the player must be in a spacesuit to trigger this unlock. (defaults to false)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="infoactions">
    <xs:all>
      <xs:element name="amount" type="amount" minOccurs="1" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Full percent of info locations to be unlocked.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="scan" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Scan level of the unlocking chain (for active scans the smaller value between the scan being performed and the level defined here is used)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="level" use="required">
            <xs:simpleType>
              <xs:restriction base="xs:integer">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="6" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
      <xs:element name="secrecy" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Maximum secrecy level of component information that can be unlocked
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="max">
            <xs:simpleType>
              <xs:restriction base="xs:integer">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="6" />
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:all>
  </xs:complexType>

  <xs:attributeGroup name="sharedunlock">
    <xs:attribute name="id" type="xs:string" use="required">
      <xs:annotation>
        <xs:documentation>
          Unique unlock ID (unique across discounts and commissions!)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Unlock name
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="description" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Unlock description
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="rechecktime" type="time">
    <xs:annotation>
      <xs:documentation>
        Time after which this unlock may be triggered again at the same entity once it has been unlocked.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:complexType name="unlock">
    <xs:annotation>
      <xs:documentation>
        Unlock definition
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="conditions" type="conditions" minOccurs="1" maxOccurs="1" />
      <xs:element name="actions" type="actions" minOccurs="0" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Apply unlock, required for discounts and commissions.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element ref="rechecktime" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attributeGroup ref="sharedunlock" />
  </xs:complexType>

  <xs:complexType name="blueprintunlock">
    <xs:annotation>
      <xs:documentation>
        Unlock definition
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="conditions" type="conditions" minOccurs="1" maxOccurs="1" />
      <xs:element ref="rechecktime" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attributeGroup ref="sharedunlock" />
  </xs:complexType>

  <xs:complexType name="infounlock">
    <xs:annotation>
      <xs:documentation>
        Unlock definition
      </xs:documentation>
    </xs:annotation>
    <xs:all>
      <xs:element name="conditions" type="infoconditions" minOccurs="1" maxOccurs="1" />
      <xs:element name="actions" type="infoactions" minOccurs="1" maxOccurs="1" >
        <xs:annotation>
          <xs:documentation>
            Unlock info chain.
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element ref="rechecktime" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attributeGroup ref="sharedunlock" />
  </xs:complexType>

  <xs:complexType name="global">
    <xs:sequence>
      <xs:element name="adjustment" minOccurs="0" maxOccurs="1" >
        <xs:complexType>
          <xs:attribute name="discount" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Name for offsetting a discount (appears as a "negative commission")
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attribute name="commission" type="xs:string">
            <xs:annotation>
              <xs:documentation>
                Name for offsetting a commission (appears as a "negative discount")
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="maxdistance" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          No unlock checks will be done if the target is more than maxdistance away.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="threshold" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          If an unlock condition has been checked, no further checks will be made unless
          the player has moved at least a distance of threshold away from the current location
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="rechecktime" type="unitvalue">
      <xs:annotation>
        <xs:documentation>
          Minimum time that must pass after an unlock has been triggered before *any* new unlock can be triggered
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:element name="unlocks">
    <xs:annotation>
      <xs:documentation>
        Unlock library document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="globals" type="global" minOccurs="0" maxOccurs="1" >
          <xs:annotation>
            <xs:documentation>
              Global settings
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="discount" type="unlock" minOccurs="0" maxOccurs="unbounded" >
          <xs:annotation>
            <xs:documentation>
              Discount
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="commission" type="unlock" minOccurs="0" maxOccurs="unbounded" >
          <xs:annotation>
            <xs:documentation>
              Commission
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="blueprint" type="blueprintunlock" minOccurs="0" maxOccurs="unbounded" >
          <xs:annotation>
            <xs:documentation>
              Blueprint unlock
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="information" type="infounlock" minOccurs="0" maxOccurs="unbounded" >
          <xs:annotation>
            <xs:documentation>
              Information (chain unlocking)
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="unlock_id">
      <xs:selector xpath="discount|commission" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="idname">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z_][a-zA-Z0-9_]*" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="comment">
    <xs:annotation>
      <xs:documentation>
        Comment for documentation purposes only
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>

  <xs:complexType name="speak">
    <xs:annotation>
      <xs:documentation>
        Voice sequence entry for speaking a TextDB line
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="page" type="xs:positiveInteger">
      <xs:annotation>
        <xs:documentation>
          TextDB page (optional if the voice sequence specifies a default page)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="line" type="xs:positiveInteger" use="required">
      <xs:annotation>
        <xs:documentation>
          Text line on the provided TextDB page
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="priority" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Speak priority (optional, falls back to the default priority specified by the voice sequence - note that a priority less than or equal to -50 suppresses subtitles)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="filter" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Voice filter override (optional if the voice sequence specifies a default filter override)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="delay">
    <xs:annotation>
      <xs:documentation>
        Voice sequence entry for a delay between lines
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="time" use="required">
      <xs:annotation>
        <xs:documentation>
          Length of the delay in seconds (fractions allowed)
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:double">
          <xs:minExclusive value="0" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="voicesequence">
    <xs:annotation>
      <xs:documentation>
        Voice sequence definition
      </xs:documentation>
    </xs:annotation>
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:choice>
        <xs:element name="speak" type="speak" />
        <xs:element name="delay" type="delay" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="id" type="idname" use="required">
      <xs:annotation>
        <xs:documentation>
          ID
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="page" type="xs:positiveInteger">
      <xs:annotation>
        <xs:documentation>
          Default TextDB page for &lt;speak&gt; sub-elements (optional)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="priority" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          Default priority for &lt;speak&gt; sub-elements (optional, default is conversation priority of 100 if omitted).
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="filter" type="xs:string">
      <xs:annotation>
        <xs:documentation>
          Default voice filter override for &lt;speak&gt; sub-elements (optional)
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="comment" type="comment" />
  </xs:complexType>

  <xs:element name="voicesequences">
    <xs:annotation>
      <xs:documentation>
        Voice sequence library document node
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="voicesequence" type="voicesequence" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>
    <xs:key name="voicesequence_id">
      <xs:selector xpath="voicesequence" />
      <xs:field xpath="@id" />
    </xs:key>
  </xs:element>

</xs:schema>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:include schemaLocation="../libraries/md.xsd" />

</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<!--faction.argon -->
<!--faction.alliance -->
<!--faction.antigone -->
<!--faction.hatikvah -->
<!--faction.holyorder -->
<!--faction.ministry -->
<!--faction.paranid -->
<!--faction.scaleplate -->
<!--faction.teladi -->

<!--faction.khaak -->
<!--faction.smuggler -->
<!--faction.xenon -->

<mdscript name="Missions_Bonus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
<!--Argon -->
    <cue name="Missions_Bonus_Argon_Friend">
    <conditions>
     <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
      <check_all>
        <check_value value ="player.entity.hasrelation.friend.{faction.argon}" negate="false"/>
      </check_all>   
    </conditions>
	   <actions>
       <reward_player money="+100000Cr"/>
     </actions>
    </cue>
    <cue name="Missions_Bonus_Argon_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.argon}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Argon_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.argon}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
<!--Teladi -->
    <cue name="Missions_Bonus_Teladi_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.teladi}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Teladi_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.teladi}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Teladi_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.teladi}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--alliance -->
    <cue name="Missions_Bonus_Alliance_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.alliance}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Alliance_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.alliance}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Alliance_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.alliance}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--antigone -->
    <cue name="Missions_Bonus_Antigone_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.antigone}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Antigone_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.antigone}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_Antigone_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.antigone}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--hatikvah -->
    <cue name="Missions_Bonus_hatikvah_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.hatikvah}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_hatikvah_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.hatikvah}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_hatikvah_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.hatikvah}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--holyorder -->
    <cue name="Missions_Bonus_holyorder_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.holyorder}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_holyorder_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.holyorder}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_holyorder_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.holyorder}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--ministry -->
    <cue name="Missions_Bonus_ministry_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.ministry}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_ministry_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.ministry}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_ministry_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.ministry}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--paranid -->
    <cue name="Missions_Bonus_paranid_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.paranid}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_paranid_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.paranid}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_paranid_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.paranid}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>
    <!--scaleplate -->
    <cue name="Missions_Bonus_scaleplate_Friend">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.friend.{faction.scaleplate}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+100000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_scaleplate_Member">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.member.{faction.scaleplate}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+250000Cr"/>
      </actions>
    </cue>
    <cue name="Missions_Bonus_scaleplate_Self">
      <conditions>
        <event_cue_signalled cue="md.GenericMissions.GenericCompleteLogbookEntry"/>
        <check_all>
          <check_value value ="player.entity.hasrelation.self.{faction.scaleplate}" negate="false"/>
        </check_all>
      </conditions>
      <actions>
        <reward_player money="+500000Cr"/>
      </actions>
    </cue>

  </cues>
 </mdscript>
<?xml version="1.0" encoding="iso-8859-1"?>
<content name="" description="" author="STB2199" version="100" save="false" date="2018-12-14" id="" lastupdate="">
  <text language="44" name="Missions_Bonus" description="Gives you a bonus for completed missions" author="STB2199" version="1.00"/>
  <text language="49" name="Missions_Bonus" description="Gibt dir ein Bonus für abgelossene Missionen" author="STB2199" version="1.00"/>
</content>
