XRWS           FÛ   ì  Eïext_01.cat ext_01.dat aiscripts/build.shiptrader.xml 358 1724054337 2de5e3bbf9b17c3586bdb830bc981e7d
aiscripts/interrupt.restock.xml 17118 1735564655 05376d2214a1dea2db62687f94cf0f32
aiscripts/order.supply.xml 427 1724054337 73d41a437b7ebec12cb3fef8c6d1000f
<?xml version="1.0" encoding="utf-8"?>
<diff>
<add sel="/aiscript/interrupts/handler//do_if[@value='event.param3.isshipbuild']">
                <do_if value="$object.type == shiptype.resupplier or $object.type == shiptype.carrier">
                  <set_tradeoffers_enabled object="$object" enabled="true"/>
                </do_if>
</add>
</diff>
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="/aiscript/interrupts/library/actions[@name='ResupplyCheck']//do_all[@exact='3']">
              <set_value name="$resupplystations_nores_interrupt" exact="[]" />
              <set_value name="$state_interrupt" exact="'local'" />
              <set_value name="$pass_interrupt" exact="8" />
              <do_while value="$state_interrupt != 'end' and $pass_interrupt gt 0">
<!--                <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s : Find station, pass %s, state %s, repair %s, resupply_ammo %s, resupply_units %s.'.[player.age, $pass_interrupt, $state_interrupt, $repair, $resupply_ammo, $resupply_units]" />-->
                <set_value name="$pass_interrupt" operation="subtract" /> <!--Ð·Ð°Ñ‰Ð¸Ñ‚Ð° Ð¾Ñ‚ Ð·Ð°Ñ†Ð¸ÐºÐ»Ð¸Ð²Ð°Ð½Ð¸Ñ-->
                <!--Ð•ÑÐ»Ð¸ Ð´Ð»Ñ ÑÐ½Ð°Ð±Ð¶ÐµÐ½Ð¸Ñ ÑÑ‚Ð°Ð½Ñ†Ð¸Ñ Ð´ÐµÐ¹ÑÑ‚Ð²Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð¾ Ð½ÑƒÐ¶Ð½Ð°. Ð”Ð»Ñ $restock_subordinates Ð¾Ð½Ð° Ð½Ðµ Ð½ÑƒÐ¶Ð½Ð°.-->
                <do_if value="not $repair and not $resupply_ammo and not $resupply_units">
                  <break />
                </do_if>

                <remove_value name="$resupplystations_interrupt" />
                <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ Ð±Ð»Ð¸Ð·ÐºÐ¾ Ð¿Ð¾ Ð¼ÐµÑÑ‚Ñƒ.-->
                <do_if value="$state_interrupt == 'local'">
                  <do_if value="$resupplystations_local_interrupt?">
                    <set_value name="$resupplystations_interrupt" exact="$resupplystations_local_interrupt" />
                  </do_if>
                  <do_else>
                    <set_value name="$resupplystations_interrupt" exact="[]" />
                    <!--Ð”Ð¾Ð±Ð°Ð²Ð¸Ñ‚ÑŒ Ð¶ÐµÐ»Ð°ÐµÐ¼ÑƒÑŽ ÑÑ‚Ð°Ð½Ñ†Ð¸ÑŽ Ð¸Ð»Ð¸ ÐºÐ¾Ñ€Ð°Ð±Ð»ÑŒ.-->
                    <do_if value="@$param_station.isoperational">
                      <append_to_list name="$resupplystations_interrupt" exact="$param_station"/>
                    </do_if>
                    <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ ÑÐ²Ð¾Ð¹ Ñ„Ð»Ð¾Ñ‚.-->
                    <do_if value="this.assignedcontrolled.commander">
                      <do_for_each name="$locsub" in="this.assignedcontrolled.toplevelcommander.allsubordinates">
                        <do_if value="$locsub.cansupplyclass.{this.assignedcontrolled.class}">
                          <append_to_list name="$resupplystations_interrupt" exact="$locsub"/>
                        </do_if>
                      </do_for_each>
                    </do_if>
                    <do_if value="this.sector">
                      <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ ÐºÐ¾Ñ€Ð°Ð±Ð»Ð¸ ÑÐ½Ð°Ð±Ð¶ÐµÐ½Ð¸Ñ Ð² ÑÐµÐºÑ‚Ð¾Ñ€Ðµ.-->
                      <find_ship_by_true_owner name="$resupplystations_interrupt" cansupplyclass="this.assignedcontrolled.class" faction="this.trueowner" space="this.sector" multiple="true" append="true"/>
                      <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ ÑÑ‚Ð°Ð½Ñ†Ð¸Ð¸ ÑÐ½Ð°Ð±Ð¶ÐµÐ½Ð¸Ñ Ð² ÑÐµÐºÑ‚Ð¾Ñ€Ðµ.-->
                      <do_if value="$isplayerowned">
                        <find_station name="$resupplystations_interrupt" canequipclass="this.assignedcontrolled.class" trueowner="this.owner" hascontrolentity="controlpost.shiptrader" space="this.sector" multiple="true" append="true" />
                      </do_if>
                      <do_else>
                        <find_station name="$resupplystations_interrupt" canequipclass="this.assignedcontrolled.class" canbuildfor="this.owner" hascontrolentity="controlpost.shiptrader" space="this.sector" multiple="true" append="true">
                          <match_relation_to object="this.assignedcontrolled" relation="dock" comparison="ge"/>
                        </find_station>
                      </do_else>
                    </do_if>
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  local suppliers, list %s.'.[player.age, $resupplystations_interrupt]" />-->
                    <set_value name="$resupplystations_local_interrupt" exact="$resupplystations_interrupt.clone" />
                  </do_else>
                </do_if>
                <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ Ñ€ÑÐ´Ð¾Ð¼.-->
                <do_elseif value="$state_interrupt == 'near'">
                  <do_if value="$resupplystations_near_interrupt?">
                    <set_value name="$resupplystations_interrupt" exact="$resupplystations_near_interrupt" />
                  </do_if>
                  <do_else>
                    <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ ÑÑ‚Ð°Ð½Ñ†Ð¸Ð¸ Ñ€ÑÐ´Ð¾Ð¼ Ð½Ð° 2 ÐºÐ»Ð°ÑÑ‚ÐµÑ€Ð°.-->
                    <find_cluster_in_range name="$localclusters_interrupt" object="this.ship" maxdistance="2" multiple="true"/>
                    <do_if value="$isplayerowned">
                      <find_station name="$resupplystations_interrupt" canequipclass="this.assignedcontrolled.class" trueowner="this.owner" hascontrolentity="controlpost.shiptrader" space="$localclusters_interrupt" multiple="true" />
                    </do_if>
                    <do_else>
                      <find_station name="$resupplystations_interrupt" canequipclass="this.assignedcontrolled.class" canbuildfor="this.owner" hascontrolentity="controlpost.shiptrader" space="$localclusters_interrupt" multiple="true">
                        <match_relation_to object="this.assignedcontrolled" relation="dock" comparison="ge"/>
                      </find_station>
                    </do_else>
                    <remove_value name="$localclusters_interrupt"/>
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  near suppliers, list %s.'.[player.age, $resupplystations_interrupt]" />-->
                    <set_value name="$resupplystations_near_interrupt" exact="$resupplystations_interrupt.clone" />
                  </do_else>
                </do_elseif>
                <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ Ñ…Ð¾Ñ‚ÑŒ Ð³Ð´Ðµ Ð½Ð¸Ð±ÑƒÐ´ÑŒ.-->
                <do_elseif value="$state_interrupt == 'far'">
                  <do_if value="$resupplystations_far_interrupt?">
                    <set_value name="$resupplystations_interrupt" exact="$resupplystations_far_interrupt" />
                  </do_if>
                  <do_else>
                    <find_station name="$resupplystations_interrupt" canequipclass="this.assignedcontrolled.class" canbuildfor="this.owner" hascontrolentity="controlpost.shiptrader" space="player.galaxy" multiple="true">
                      <match_relation_to object="this.assignedcontrolled" relation="dock" comparison="ge"/>
                    </find_station>
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  far suppliers, list %s.'.[player.age, $resupplystations_interrupt]" />-->
                    <set_value name="$resupplystations_far_interrupt" exact="$resupplystations_interrupt.clone" />
                  </do_else>
                </do_elseif>
                <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ Ñ€Ð°Ð½Ð½ÐµÐµ Ð¾Ñ‚ÑÐµÑÐ½Ñ‹Ðµ, Ñƒ ÐºÐ¾Ñ‚Ð¾Ñ€Ñ‹Ñ… Ð½ÐµÑ‚ Ð½ÑƒÐ¶Ð½Ñ‹Ñ… Ñ€ÐµÑÑƒÑ€ÑÐ¾Ð². Ð‘ÑƒÐ´ÐµÑ‚ Ð¶Ð´Ð°Ñ‚ÑŒ Ð¿Ñ€Ð¸Ð²Ð¾Ð· Ñ€ÐµÑÑƒÑ€ÑÐ¾Ð² Ð¸Ð»Ð¸ ÐÐÐŸÐžÐœÐ˜ÐÐÐÐ˜Ð•/ÐšÐžÐ¡Ð¯Ðš Ð¿Ñ€Ð¸ Ð´Ñ€ÑƒÐ³Ð¾Ð¼ (Ð½Ðµ universal) Ð¼ÐµÑ‚Ð¾Ð´Ðµ Ð¿Ñ€Ð¾Ð¸Ð·Ð²Ð¾Ð´ÑÑ‚Ð²Ð° Ñ€ÐµÑÑƒÑ€ÑÑ‹ Ð²Ð¿Ð¾Ð»Ð½Ðµ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ ÐµÑÑ‚ÑŒ.-->
                <do_elseif value="$state_interrupt == 'nores'">
                  <set_value name="$resupplystations_interrupt" exact="$resupplystations_nores_interrupt" />
                </do_elseif>

                <!--ÐŸÑ€Ð¾Ð²ÐµÑ€Ð¸Ñ‚ÑŒ ÑÐ¿Ð¸ÑÐ¾Ðº Ð½Ð°Ð¹Ð´ÐµÐ½Ð½Ñ‹Ñ… ÑÑ‚Ð°Ð½Ñ†Ð¸Ð¹/ÐºÐ¾Ñ€Ð°Ð±Ð»ÐµÐ¹ Ð½Ð° Ð¿Ð¾Ð´Ñ…Ð¾Ð´ÑÑ‰ÐµÑÑ‚ÑŒ.-->
                <do_all exact="$resupplystations_interrupt.count" counter="$counter_lib_resupplystations" reverse="true">
                  <set_value name="$station_interrupt" exact="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
<!--                  <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  check supplier, station %s (%s).'.[player.age, $station_interrupt.knownname, $station_interrupt.idcode]" />-->
                  <do_if value="$blacklist_stations.count and $blacklist_stations.indexof.{$station_interrupt}">
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - blacklisted.'.[player.age]" />-->
                    <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                    <continue />
                  </do_if>
                  <do_if value="$station_interrupt == this.assignedcontrolled">
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - self.'.[player.age]" />-->
                    <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                    <continue />
                  </do_if>
                  <do_if value="($param_station != $station_interrupt) and $station_interrupt.istrafficlevel.gridlock">
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - busy.'.[player.age]" />-->
                    <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                    <continue />
                  </do_if>
                  <do_if value="$repair and not $station_interrupt.canequipclass.{this.ship.class} and not $station_interrupt.cansupplyclass.{this.ship.class}">
<!--                    <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - cannot repair.'.[player.age]" />-->
                    <remove_value name="$station_interrupt"/>
                    <continue />
                  </do_if>
                  <do_if value="$resupply_ammo">
                    <do_if value="not $evalammotable?">
                      <set_value name="$evalammotable" exact="table[]"/>
                      <do_all exact="$ammotable_interrupt.keys.count" counter="$int_i">
                        <set_value name="$evalammotable.{$ammotable_interrupt.keys.{$int_i}}" exact="1"/>
                      </do_all>
                    </do_if>
                    <do_if value="not $station_interrupt.canbuildequipment.{$evalammotable.keys.list}">
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - cannot create ammo, evalammo %s.'.[player.age, $evalammotable.keys.list]" />-->
                      <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                      <continue />
                    </do_if>
                    <do_if value="not $station_interrupt.hasresourcesfor.{$evalammotable} and $state_interrupt != 'nores'">
                      <append_to_list name="$resupplystations_nores_interrupt" exact="$station_interrupt" />
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - no resources for ammo, evalammotable %s.'.[player.age, $evalammotable]" />-->
                      <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                      <continue />
                    </do_if>
                  </do_if>
                  <do_if value="$resupply_units">
                    <do_if value="not $evalunittable?">
                      <set_value name="$evalunittable" exact="table[]"/>
                      <do_all exact="$unittable_interrupt.keys.count" counter="$int_i">
                        <set_value name="$evalunittable.{$unittable_interrupt.keys.{$int_i}}" exact="1"/>
                      </do_all>
                    </do_if>
                    <do_if value="not $station_interrupt.canbuildequipment.{$evalunittable.keys.list}">
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - cannot create units, evalunit %s.'.[player.age, $evalunittable.keys.list]" />-->
                      <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                      <continue />
                    </do_if>
                    <do_if value="not $station_interrupt.hasresourcesfor.{$evalunittable} and $state_interrupt != 'nores'">
                      <append_to_list name="$resupplystations_nores_interrupt" exact="$station_interrupt" />
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :   failed - no resources for units, evalunittable %s.'.[player.age, $evalunittable]" />-->
                      <remove_value name="$resupplystations_interrupt.{$counter_lib_resupplystations}" />
                      <continue />
                    </do_if>
                  </do_if>
                </do_all>
                <remove_value name="$station_interrupt" />

                <!--Ð’Ñ‹Ð±Ñ€Ð°Ñ‚ÑŒ Ð±Ð»Ð¸Ð¶Ð°Ð¹ÑˆÑƒÑŽ ÑÑ‚Ð°Ð½Ñ†Ð¸ÑŽ/ÐºÐ¾Ñ€Ð°Ð±Ð»ÑŒ Ð½Ð° ÐºÐ¾Ñ‚Ð¾Ñ€ÑƒÑŽ Ð¼Ð¾Ð¶Ð½Ð¾ ÑÐµÑÑ‚ÑŒ.-->
                <do_for_each name="$station_interrupt" in="$resupplystations_interrupt">
                  <do_if value="$station_interrupt.dockingallowed.{this.assignedcontrolled} or (@$station_interrupt.type == shiptype.resupplier)">
                    <do_if value="not $destination_station_interrupt? or $station_interrupt.distanceto.{this.ship} lt $destination_station_interrupt.distanceto.{this.ship}">
                      <set_value name="$destination_station_interrupt" exact="$station_interrupt"/>
                    </do_if>
                  </do_if>
                </do_for_each>
<!--                <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  destination, station %s (%s).'.[player.age, @$destination_station_interrupt.knownname, @$destination_station_interrupt.idcode]" />-->
                <do_if value="$destination_station_interrupt?">
                  <break />
                </do_if>

                <!--ÐŸÐ¾Ð¿Ñ€Ð¾Ð±Ð¾Ð²Ð°Ñ‚ÑŒ Ð¿Ð¾Ð¸ÑÐºÐ°Ñ‚ÑŒ Ð´Ð°Ð»ÑŒÑˆÐµ.-->
                <do_if value="$state_interrupt == 'local'">
                  <set_value name="$state_interrupt" exact="'near'" />
                </do_if>
                <do_elseif value="$state_interrupt == 'near'">
                  <set_value name="$state_interrupt" exact="if not $isplayerowned and @$urgent then 'far' else 'nores'" />
                </do_elseif>
                <do_elseif value="$state_interrupt == 'far'">
                  <set_value name="$state_interrupt" exact="'nores'" />
                </do_elseif>
                <do_elseif value="$state_interrupt == 'nores'">
                  <set_value name="$state_interrupt" exact="'end'"/>
                  <do_if value="$repair">
                    <!--Ð£Ð¼ÐµÐ½ÑŒÑˆÐ¸Ñ‚ÑŒ Ð¾Ð´Ð½Ð¾Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ñ‹Ðµ Ñ…Ð¾Ñ‚ÐµÐ»ÐºÐ¸ Ð¸ Ð¿Ð¾Ð¿Ñ€Ð¾Ð±Ð¾Ð²Ð°Ñ‚ÑŒ Ð½Ð°Ð¹Ñ‚Ð¸ Ð¼ÐµÑÑ‚Ð¾ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ Ð´Ð»Ñ Ñ€ÐµÐ¼Ð¾Ð½Ñ‚Ð°.-->
                    <do_if value="$resupply_ammo or $resupply_units">
                      <set_value name="$resupply_ammo" exact="false"/>
                      <set_value name="$resupply_units" exact="false"/>
                      <set_value name="$state_interrupt" exact="'local'"/>
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  shrink demand, repair only.'.[player.age]" />-->
                    </do_if>
                  </do_if>
                  <do_elseif value="$resupply_ammo">
                    <!--Ð£Ð¼ÐµÐ½ÑŒÑˆÐ¸Ñ‚ÑŒ Ð¾Ð´Ð½Ð¾Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ñ‹Ðµ Ñ…Ð¾Ñ‚ÐµÐ»ÐºÐ¸ Ð¸ Ð¿Ð¾Ð¿Ñ€Ð¾Ð±Ð¾Ð²Ð°Ñ‚ÑŒ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ Ð¿ÐµÑ€ÐµÐ·Ð°Ñ€ÑÐ´Ð¸Ñ‚ÑŒ ÑÐ½Ð°Ñ€ÑÐ´Ñ‹.-->
                    <do_if value="$resupply_units">
                      <set_value name="$resupply_units" exact="false"/>
                      <set_value name="$state_interrupt" exact="'local'"/>
<!--                      <debug_to_file directory="'bettersupply'" name="'restock %s.txt'.[this.ship.idcode]" text="'%.3s :  shrink demand, ammo only.'.[player.age]" />-->
                    </do_if>
                  </do_elseif>
                </do_elseif>
              </do_while>
              <remove_value name="$state_interrupt" />
              <remove_value name="$resupplystations_nores_interrupt" />
              <remove_value name="$resupplystations_local_interrupt" />
              <remove_value name="$resupplystations_near_interrupt" />
              <remove_value name="$resupplystations_far_interrupt" />
              <remove_value name="$evalammotable" />
              <remove_value name="$evalunittable" />
</replace>
</diff>
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="/aiscript/order/requires/match">
      <match_any>
        <match shiptype="shiptype.resupplier"/>
        <match shiptype="shiptype.carrier"/>
      </match_any>
</replace>
<replace sel="/aiscript/attention/actions/set_tradeoffers_enabled/@enabled">true</replace>
<replace sel="/aiscript/on_abort//set_tradeoffers_enabled/@enabled">true</replace>
</diff>
<?xml version="1.0" encoding="utf-8"?>
<content id="" name="" description="" author="Arshiba" version="101" save="false" date="2024-12-30" lastupdate="">
  <dependency version="710"/>
</content>
