XRWS         0  þ   U  \   U  øext_01.cat ext_01.dat ext_v900.cat ext_v900.dat aiscripts/order.salvage.routine.xml 2908 1778056250 a40cb9d94030b1577ca142d00b01ddaf
<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/aiscript/attention/actions/set_command_action[@commandaction='commandaction.searchingresources']" pos="after">

    <do_if value="this.isplayerowned and $mode == 'tug'">
      <debug_text text="'[n1911_better_scrap_ship_ai] player owned tug (%s %s %s) is searching for Scrap Cubes'.[@this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled]" chance="$debugchance"/>
      <do_for_each name="$space" in="$spaces">
        <do_if value="($range gt 0) and (($space.hashazardousregion and not $space.containsthewave and this.assignedcontrolled.takesregiondamage) or this.hasrelation.enemy.{$space.owner})">
          <continue/>
        </do_if>

        <find_object name="$potentialtargets" macro="macro.recyclable_gen_m_scrapcube_01_macro" space="$space" canbetowed="true" checkoperational="false" knownto="if this.isplayerowned then faction.player else null" sortbydistanceto="this.assignedcontrolled" multiple="true"/>
        <debug_text text="'[n1911_better_scrap_ship_ai] tug found %s potential targets in sector %s'.[$potentialtargets.count, $space.knownname]" chance="$debugchance"/>
        <do_if value="$potentialtargets.count">
          <do_for_each name="$locobject" in="$potentialtargets">
            <debug_text text="'[n1911_better_scrap_ship_ai] found %s %s, state: %s'.[$locobject.class, $locobject.knownname, $locobject.state]" chance="$debugchance"/>
            <do_if value="$locobject.canbetowed and not @$locobject.tugship and (not @$locobject.salvageclaimants.count or $locobject.salvageclaimants.indexof.{this.assignedcontrolled}) and @$locobject.recyclingwares.remaining.count">
              <assign_tow_target ship="this.assignedcontrolled" object="$locobject"/>
              <do_if value="$locobject.salvageclaimants.indexof.{this.assignedcontrolled}">
                <set_value name="$salvagetarget" exact="$locobject"/>
                <set_value name="$locverb" exact="'collecting'"/>
                <break/>
              </do_if>
            </do_if>
          </do_for_each>
        </do_if>

        <do_if value="@$salvagetarget.exists">
          <debug_text text="'[n1911_better_scrap_ship_ai] %s %s %s %s %s %s in sector %s, %s gates away.'.[@this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled, $locverb, @$salvagetarget.class, @$salvagetarget.knownname, @$salvagetarget.sector.knownname, this.assignedcontrolled.gatedistance.{$salvagetarget}]" chance="$debugchance"/>
          <remove_value name="$pos_sector"/>
          <remove_value name="$sector"/>
          <remove_value name="$locverb"/>
          <remove_value name="$potentialtargets"/>
          <resume label="execute"/>
        </do_if>

        <wait min="2s" max="5s"/>
      </do_for_each>
    </do_if>
  </add>
</diff>
aiscripts/order.salvage.routine.xml 3832 1778056129 79137d9cc6bf3ca89ca88f08f9ef2f08
<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/aiscript/attention/actions/set_command_action[@commandaction='commandaction.searchingresources']" pos="after">

    <do_if value="this.isplayerowned and $mode == 'tug'">
      <debug_text text="'[n1911_better_scrap_ship_ai] player owned tug (%s %s %s) is searching for Scrap Cubes'.[@this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled]" chance="$debugchance"/>
      <do_for_each name="$space" in="$spaces">
        <do_if value="($range gt 0) and (($space.hashazardousregion and not $space.containsthewave and this.assignedcontrolled.takesregiondamage) or this.hasrelation.enemy.{$space.owner})">
          <continue/>
        </do_if>

        <find_object name="$potentialtargets" macro="macro.recyclable_gen_m_scrapcube_01_macro" space="$space" canbetowed="true" checkoperational="false" knownto="if this.isplayerowned then faction.player else null" sortbydistanceto="this.assignedcontrolled" multiple="true"/>
        <debug_text text="'[n1911_better_scrap_ship_ai] tug found %s potential targets in sector %s'.[$potentialtargets.count, $space.knownname]" chance="$debugchance"/>
        <do_if value="$potentialtargets.count">
          <do_for_each name="$locobject" in="$potentialtargets">
            <debug_text text="'[n1911_better_scrap_ship_ai] found %s %s, state: %s'.[$locobject.class, $locobject.knownname, $locobject.state]" chance="$debugchance"/>
            <do_if value="$locobject.canbetowed and not @$locobject.tugship and (not @$locobject.salvageclaimants.count or $locobject.salvageclaimants.indexof.{this.assignedcontrolled}) and @$locobject.recyclingwares.remaining.count">
              <do_for_each name="$locware" in="$locobject.recyclingwares.remaining.list">
                <do_if value="$warebasket.indexof.{$locware}">
                  <debug_text text="'[n1911_better_scrap_ship_ai] acquiring salvagetarget %s %s'.[$locobject.class, $locobject.knownname]" chance="$debugchance"/>
                  <assign_tow_target ship="this.assignedcontrolled" object="$locobject"/>
                  <do_if value="$locobject.salvageclaimants.indexof.{this.assignedcontrolled}">
                    <set_value name="$salvagetarget" exact="$locobject"/>
                    <set_value name="$locverb" exact="'collecting'"/>
                    <break/>
                  </do_if>
                </do_if>
              </do_for_each>
              <do_if value="@$salvagetarget.exists">
                <break/>
              </do_if>
            </do_if>
            <do_else>
              <debug_text text="'[n1911_better_scrap_ship_ai] %s %s rejected due to: %s%s%s%s'.[$locobject.class, $locobject.knownname, not $locobject.canbetowed, @$locobject.tugship.exists, (@$locobject.salvageclaimants.count and not $locobject.salvageclaimants.indexof.{this.assignedcontrolled}), @$locobject.recyclingwares.remaining.count == 0]" chance="$debugchance"/>
            </do_else>
          </do_for_each>
        </do_if>

        <do_if value="@$salvagetarget.exists">
          <debug_text text="'[n1911_better_scrap_ship_ai] %s %s %s %s %s %s in sector %s, %s gates away.'.[@this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled, $locverb, @$salvagetarget.class, @$salvagetarget.knownname, @$salvagetarget.sector.knownname, this.assignedcontrolled.gatedistance.{$salvagetarget}]" chance="$debugchance"/>
          <remove_value name="$pos_sector"/>
          <remove_value name="$sector"/>
          <remove_value name="$locverb"/>
          <remove_value name="$potentialtargets"/>
          <resume label="execute"/>
        </do_if>

        <wait min="2s" max="5s"/>
      </do_for_each>
    </do_if>
  </add>
</diff>
<?xml version="1.0" encoding="utf-8"?>
<content id="" name="" description="" author="neutrino1911" version="015" date="2026-05-06" save="0" lastupdate="">
  <dependency version="760"/>
  <dependency id="ego_dlc_split" version="760" optional="true" name="Split Vendetta"/>
  <dependency id="ego_dlc_terran" version="760" optional="true" name="Cradle of Humanity"/>
  <dependency id="ego_dlc_pirate" version="760" optional="true" name="Tides of Avarice"/>
  <dependency id="ego_dlc_boron" version="760" optional="true" name="Kingdom End"/>
  <dependency id="ego_dlc_timelines" version="760" optional="true" name="Timelines"/>
  <dependency id="ego_dlc_mini_01" version="760" optional="true" name="Hyperion Pack"/>
</content>
