Created
May 21, 2023 06:42
-
-
Save temetvince/c6a37d3c0d13931dff34a12185c9113f to your computer and use it in GitHub Desktop.
Adds Boron, Terran, Pirate DLCs to Mobile Repair Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="iso-8859-1" ?> | |
<aiscript name="mobilerepairservice" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="aiscripts.xsd" version="1"> | |
<order id="MobileRepairService" name="Mobile Repair Service" description="Mobile Repair Service" category="trade" infinite="true"> | |
<params> | |
<param name="mrs_space" default="null" type="sector" required="true" text="Home sector"/> | |
<param name="mrs_follow" default="null" type="object" required="false" text="Follow Ship"> | |
<input_param name="class" value="[class.ship_m,class.ship_l,class.ship_xl]"/> | |
</param> | |
<param name="mrs_player_only" default="false" type="bool" text="Player only repairs"/> | |
<param name="mrs_ignore_shield" default="true" type="bool" text="Ignore shield level checks"/> | |
<param name="fs_argon" type="bool" default="false" text="Ignore {20203,201}"/> | |
<param name="fs_antigone" type="bool" default="false" text="Ignore {20203,301}"/> | |
<param name="fs_teladi" type="bool" default="false" text="Ignore {20203,601}"/> | |
<param name="fs_ministry" type="bool" default="false" text="Ignore {20203,701}"/> | |
<param name="fs_paranid" type="bool" default="false" text="Ignore {20203,401}"/> | |
<param name="fs_holyorder" type="bool" default="false" text="Ignore {20203,501}"/> | |
<param name="fs_alliance" type="bool" default="false" text="Ignore {20203,801}"/> | |
<param name="fs_trinity" type="bool" default="false" text="Ignore {20203,2301}"/> | |
<param name="fs_split" type="bool" default="false" text="Ignore {20203,2001}"/> | |
<param name="fs_freesplit" type="bool" default="false" text="Ignore {20203,1601}"/> | |
<param name="fs_court" type="bool" default="false" text="Ignore {20203,1801}"/> | |
<param name="fs_terran" type="bool" default="false" text="Ignore {20203,3001}"/> | |
<param name="fs_pioneers" type="bool" default="false" text="Ignore {20203,2901}"/> | |
<param name="fs_yaki" type="bool" default="false" text="Ignore {20203,2801}"/> | |
<param name="fs_loanshark" type="bool" default="false" text="Ignore {20203,3301}"/> | |
<param name="fs_scavenger" type="bool" default="false" text="Ignore {20203,3201}"/> | |
<param name="fs_boron" type="bool" default="false" text="Ignore {20203,1301}"/> | |
<param name="fs_buccaneers" type="bool" default="false" text="Ignore {20203,2401}"/> | |
<param name="fs_fallensplit" type="bool" default="false" text="Ignore {20203,1701}"/> | |
<param name="fs_hatikvah" type="bool" default="false" text="Ignore {20203,901}"/> | |
<param name="fs_scaleplate" type="bool" default="false" text="Ignore {20203,1001}"/> | |
</params> | |
<requires> | |
<match shiptype="shiptype.lasertower" negate="true"/> | |
</requires> | |
<location object="$mrs_space" condition="$mrs_space.zone.exists" /> | |
</order> | |
<interrupts> | |
<handler ref="SectorChangeHandler"/> | |
<handler ref="AttackHandler" /> | |
<handler ref="MissileLockHandler" /> | |
<handler ref="ScannedHandler" /> | |
<handler ref="InspectedHandler"/> | |
<handler ref="FoundAbandonedHandler"/> | |
<handler ref="FoundLockboxHandler"/> | |
<handler ref="ResupplyHandler" /> | |
<handler ref="TargetInvalidHandler"/> | |
</interrupts> | |
<init> | |
<set_order_syncpoint_reached order="this.ship.order"/> | |
<set_command_action commandaction="commandaction.standingby"/> | |
<do_if value="$mrs_space == null"> | |
<set_value name="$mrs_space" exact="this.ship.zone"/> | |
<edit_order_param order="this.assignedcontrolled.defaultorder" param="'mrs_space'" value="$mrs_space.sector"/> | |
</do_if> | |
<do_if value="$mrs_space.isclass.sector"> | |
<find_zone name="$mrs_space" space="$mrs_space" normalzone="true"/> | |
</do_if> | |
<set_value name="$fs_factions" exact="[]"/> | |
<do_if value="$fs_argon"> | |
<append_to_list name="$fs_factions" exact="faction.argon"/> | |
</do_if> | |
<do_if value="$fs_antigone"> | |
<append_to_list name="$fs_factions" exact="faction.antigone"/> | |
</do_if> | |
<do_if value="$fs_paranid"> | |
<append_to_list name="$fs_factions" exact="faction.paranid"/> | |
</do_if> | |
<do_if value="$fs_holyorder"> | |
<append_to_list name="$fs_factions" exact="faction.holyorder"/> | |
</do_if> | |
<do_if value="$fs_alliance"> | |
<append_to_list name="$fs_factions" exact="faction.alliance"/> | |
</do_if> | |
<do_if value="$fs_trinity"> | |
<append_to_list name="$fs_factions" exact="faction.trinity"/> | |
</do_if> | |
<do_if value="$fs_teladi"> | |
<append_to_list name="$fs_factions" exact="faction.teladi"/> | |
</do_if> | |
<do_if value="$fs_ministry"> | |
<append_to_list name="$fs_factions" exact="faction.ministry"/> | |
</do_if> | |
<do_if value="$fs_split"> | |
<append_to_list name="$fs_factions" exact="faction.split"/> | |
</do_if> | |
<do_if value="$fs_freesplit"> | |
<append_to_list name="$fs_factions" exact="faction.freesplit"/> | |
</do_if> | |
<do_if value="$fs_court"> | |
<append_to_list name="$fs_factions" exact="faction.court"/> | |
</do_if> | |
<do_if value="$fs_hatikvah"> | |
<append_to_list name="$fs_factions" exact="faction.hatikvah"/> | |
</do_if> | |
<do_if value="$fs_scaleplate"> | |
<append_to_list name="$fs_factions" exact="faction.scaleplate"/> | |
</do_if> | |
<do_if value="$fs_buccaneers"> | |
<append_to_list name="$fs_factions" exact="faction.buccaneers"/> | |
</do_if> | |
<do_if value="$fs_fallensplit"> | |
<append_to_list name="$fs_factions" exact="faction.fallensplit"/> | |
</do_if> | |
<do_if value="$fs_boron"> | |
<append_to_list name="$fs_factions" exact="faction.boron"/> | |
</do_if> | |
<do_if value="$fs_terran"> | |
<append_to_list name="$fs_factions" exact="faction.terran"/> | |
</do_if> | |
<do_if value="$fs_pioneers"> | |
<append_to_list name="$fs_factions" exact="faction.pioneers"/> | |
</do_if> | |
<do_if value="$fs_loanshark"> | |
<append_to_list name="$fs_factions" exact="faction.loanshark"/> | |
</do_if> | |
<do_if value="$fs_scavenger"> | |
<append_to_list name="$fs_factions" exact="faction.scavenger"/> | |
</do_if> | |
<do_if value="$fs_yaki"> | |
<append_to_list name="$fs_factions" exact="faction.yaki"/> | |
</do_if> | |
<set_value name="$mrs_home" exact="$mrs_space"/> | |
</init> | |
<attention min="unknown"> | |
<actions> | |
<!-- START ******************************************************************************* --> | |
<label name="start"/> | |
<do_if value="not $mrs_home? or not $mrs_home.isclass.zone"> | |
<set_value name="$mrs_home" exact="this.ship.zone"/> | |
<write_to_logbook category="general" title="{314152, 1}" text="{314152, 7}.[this.ship.name, $mrs_home.sector.knownname]"/> | |
<wait min="1s" max="2s"/> | |
</do_if> | |
<!-- SEARCH ******************************************************************************* --> | |
<label name="search"/> | |
<do_if value="not $mrs_home? or not $mrs_home.isclass.zone"> | |
<resume label="start"/> | |
</do_if> | |
<set_value name="$mrs_time" exact="player.age"/> | |
<set_value name="$mrs_target" exact="null"/> | |
<set_value name="$mrs_findsafety" exact="true"/> | |
<do_if value="$mrs_home? and $mrs_home.sector != this.ship.sector"> | |
<resume label="home"/> | |
</do_if> | |
<!-- SEARCH_LOOP ************************************************************************** --> | |
<label name="search_loop"/> | |
<do_if value="not $mrs_home? or not $mrs_home.isclass.zone"> | |
<resume label="start"/> | |
</do_if> | |
<do_if value="$mrs_follow != null"> | |
<do_if value="$mrs_follow.isoperational"> | |
<do_if value="$mrs_home.sector != $mrs_follow.sector"> | |
<set_value name="$mrs_home" exact="$mrs_follow.zone"/> | |
<resume label="start"/> | |
</do_if> | |
</do_if> | |
<do_else> | |
<set_value name="$mrs_follow" exact="null"/> | |
<do_if value="$mrs_space == null"> | |
<set_value name="$mrs_home" exact="this.ship.zone"/> | |
<resume label="start"/> | |
</do_if> | |
<do_if value="$mrs_space.sector != $mrs_home.sector"> | |
<find_zone name="$mrs_home" space="$mrs_space" normalzone="true"/> | |
<resume label="start"/> | |
</do_if> | |
</do_else> | |
</do_if> | |
<set_command command="command.patrol"/> | |
<set_command_action commandaction="commandaction.standingby"/> | |
<set_value name="$mrs_time" exact="player.age"/> | |
<wait min="5s" max="10s"/> | |
<set_value name="$target" exact="null"/> | |
<set_value name="$distance" exact="-1"/> | |
<set_value name="$npc_target" exact="null"/> | |
<set_value name="$npc_distance" exact="-1"/> | |
<create_list name="$ships"/> | |
<find_ship name="$ships" space="this.ship.sector" recursive="true" multiple="true"/> | |
<do_all exact="$ships.count" counter="$si"> | |
<set_value name="$ship" exact="$ships.{$si}"/> | |
<do_if value="(not $ship.iswreck) and ($ship.isoperational) and ($ship.pilot.exists) and ($ship.hullpercentage lt 100) and (($ship.shieldpercentage gt 20) or $mrs_ignore_shield)"> | |
<do_if value="$ship == this.ship"> | |
<set_value name="$target" exact="$ship"/> | |
<resume label="maintenance"/> | |
</do_if> | |
<do_else> | |
<do_if value="$ship.pilot.$mrs_skip?"> | |
<do_if value="player.age gt $ship.pilot.$mrs_skip"> | |
<remove_value name="$ship.pilot.$mrs_skip"/> | |
</do_if> | |
</do_if> | |
<do_elseif value="this.ship.owner == $ship.owner"> | |
<set_value name="$dist" exact="this.ship.distanceto.{$ship}"/> | |
<do_if value="($distance lt 0) or ($dist lt $distance)"> | |
<set_value name="$target" exact="$ship"/> | |
<set_value name="$distance" exact="$dist"/> | |
</do_if> | |
</do_elseif> | |
<do_elseif value="($ship.relationto.{faction.player} ge 0) and not $mrs_player_only"> | |
<set_value name="$allowed" exact="true"/> | |
<do_if value="$fs_factions.count gt 0"> | |
<do_all exact="$fs_factions.count" counter="$fi"> | |
<do_if value="$ship.owner == $fs_factions.{$fi}"> | |
<set_value name="$allowed" exact="false"/> | |
<break/> | |
</do_if> | |
</do_all> | |
</do_if> | |
<do_if value="$allowed"> | |
<set_value name="$dist" exact="this.ship.distanceto.{$ship}"/> | |
<do_if value="($npc_distance lt 0) or ($dist lt $npc_distance)"> | |
<set_value name="$npc_target" exact="$ship"/> | |
<set_value name="$npc_distance" exact="$dist"/> | |
</do_if> | |
</do_if> | |
</do_elseif> | |
</do_else> | |
</do_if> | |
</do_all> | |
<do_if value="$distance ge 0"> | |
<set_value name="$mrs_distance" exact="$distance"/> | |
<set_value name="$mrs_target" exact="$target"/> | |
<set_value name="$mrs_time" exact="player.age"/> | |
<resume label="approach_loop"/> | |
</do_if> | |
<do_if value="$npc_distance ge 0"> | |
<set_value name="$mrs_distance" exact="$npc_distance"/> | |
<set_value name="$mrs_target" exact="$npc_target"/> | |
<set_value name="$mrs_time" exact="player.age"/> | |
<resume label="approach_loop"/> | |
</do_if> | |
<do_if value="not $mrs_findsafety? or $mrs_findsafety"> | |
<set_value name="$mrs_findsafety" exact="false"/> | |
<find_object name="$fs_targets" space="this.ship.sector" class="[class.station]" multiple="true"> | |
<match_relation_to object="this.ship" relation="friend" comparison="ge"/> | |
</find_object> | |
<set_value name="$fs_closest" exact="-1"/> | |
<do_all exact="$fs_targets.count" counter="$ti"> | |
<set_value name="$fs_distance" exact="$fs_targets.{$ti}.distanceto.{this.ship}"/> | |
<do_if value="$fs_closest lt 0 or $fs_distance lt $fs_closest"> | |
<set_value name="$fs_closest" exact="$fs_distance"/> | |
<set_value name="$fs_target" exact="$fs_targets.{$ti}"/> | |
</do_if> | |
</do_all> | |
<do_if value="$fs_closest gt 0"> | |
<set_command_action commandaction="commandaction.flyingto" param="$fs_target"/> | |
<get_safe_pos result="$finalpos" object="$fs_target" zone="$fs_target.zone" radius="this.size/2.0" ignored="this.ship"/> | |
<move_to object="this.ship" destination="$fs_target.zone" abortpath="true" forcerotation="true" forceposition="true" uselocalhighways="false" boost="false" travel="true"> | |
<position value="$finalpos"/> | |
<interrupt_after_time time="600s"/> | |
</move_to> | |
</do_if> | |
</do_if> | |
<resume label="search_loop"/> | |
<!-- APPROACH_LOOP ************************************************************************ --> | |
<label name="approach_loop"/> | |
<do_if value="not $mrs_home? or not $mrs_home.isclass.zone"> | |
<resume label="start"/> | |
</do_if> | |
<set_value name="$target" exact="$mrs_target"/> | |
<do_if value="(not $target.exists) or ($target.zone.isclass.highway) or ($target.sector != this.ship.sector)"> | |
<resume label="search"/> | |
</do_if> | |
<set_value name="$distance" exact="this.ship.distanceto.{$target}"/> | |
<do_if value="player.age gt ($mrs_time + 120)"> | |
<set_value name="$mrs_time" exact="player.age"/> | |
<set_value name="$mrs_distance" exact="$mrs_distance * 0.75"/> | |
<do_if value="$distance gt $mrs_distance"> | |
<set_value name="$target.pilot.$mrs_skip" exact="player.age + 120"/> | |
<resume label="search"/> | |
</do_if> | |
</do_if> | |
<set_value name="$limit" exact="750 + this.ship.size + $target.size"/> | |
<do_if value="$distance gt $limit"> | |
<set_command_action commandaction="commandaction.flyingto" param="$target"/> | |
<get_safe_pos object="$target" zone="$target.zone" radius="this.ship.size / 2.0" allowyaxis="true" result="$pos" ignored="this.ship"/> | |
<set_value name="$destination" exact="$pos"/> | |
<move_to object="this.ship" destination="$target.zone" boost="true" travel="true" forceposition="false" finishonapproach="true" commandaction="false"> | |
<position value="$destination" max="this.ship.size + $target.size"/> | |
<interrupt_after_time time="5s"/> | |
</move_to> | |
<resume label="approach_loop"/> | |
</do_if> | |
<!-- MAINTENANCE ************************************************************************ --> | |
<label name="maintenance"/> | |
<stop_moving object="this.ship"/> | |
<set_command command="command.repair"/> | |
<set_command_action commandaction="commandaction.flying"/> | |
<set_value name="$cph_v" exact="[(this.ship.pilot.skill.management + this.ship.pilot.skill.engineering) / 2f, 15f].min"/> | |
<set_value name="$cph_pc" exact="6f - $cph_v / 3f"/> | |
<set_value name="$cph_npc" exact="6f + $cph_v"/> | |
<set_value name="$hp" exact="$target.maxhull - $target.hull"/> | |
<do_if value="$hp gt 0"> | |
<set_value name="$experience" exact="0"/> | |
<set_value name="$hulldamage" exact="0"/> | |
<set_value name="$hullcosts" exact="0"/> | |
<set_value name="$partdamage" exact="0"/> | |
<set_value name="$partcosts" exact="0"/> | |
<set_value name="$partlist" exact="''"/> | |
<do_if value="this.ship.owner == $target.owner"> | |
<set_value name="$credits" exact="($hp * $cph_pc)i * 1Cr"/> | |
<do_if value="player.money ge $credits"> | |
<reward_player money="-$credits"/> | |
</do_if> | |
<do_else> | |
<set_value name="$hp" exact="0"/> | |
</do_else> | |
</do_if> | |
<do_else> | |
<set_value name="$credits" exact="($hp * $cph_npc)i * 1Cr"/> | |
<reward_player money="$credits"/> | |
</do_else> | |
<do_if value="$hp gt 0"> | |
<set_value name="$hulldamage" exact="$hp"/> | |
<set_value name="$hullcosts" exact="$credits"/> | |
<set_value name="$experience" exact="$experience + 1"/> | |
<set_object_hull object="$target" exact="100"/> | |
</do_if> | |
<find_object_component name="$damagedcomponents" object="$target" class="[class.engine, class.weapon, class.shieldgenerator, class.turret]" checkoperational="false" multiple="true"/> | |
<do_if value="$damagedcomponents.count gt 0"> | |
<do_all exact="$damagedcomponents.count" counter="$i"> | |
<set_value name="$damagedcomponent" exact="$damagedcomponents.{$i}"/> | |
<set_value name="$hp" exact="$damagedcomponent.maxhull - $damagedcomponent.hull"/> | |
<do_if value="$hp gt 0"> | |
<do_if value="this.ship.owner == $target.owner"> | |
<set_value name="$credits" exact="($hp * $cph_pc * 3f)i * 1Cr"/> | |
<do_if value="player.money ge $credits"> | |
<reward_player money="-$credits"/> | |
</do_if> | |
<do_else> | |
<set_value name="$hp" exact="0"/> | |
</do_else> | |
</do_if> | |
<do_else> | |
<set_value name="$credits" exact="($hp * $cph_npc * 3f)i * 1Cr"/> | |
<reward_player money="$credits"/> | |
</do_else> | |
<do_if value="$hp gt 0"> | |
<set_value name="$partlist" exact="$partlist + {314152, 5}.[$damagedcomponent.knownname, ($hp)i, $credits/100]"/> | |
<set_value name="$partdamage" exact="$partdamage + $hp"/> | |
<set_value name="$partcosts" exact="$partcosts + $credits"/> | |
<set_value name="$experience" exact="$experience + 1"/> | |
<set_object_hull object="$damagedcomponent" exact="100"/> | |
</do_if> | |
</do_if> | |
</do_all> | |
</do_if> | |
<set_value name="$credits" exact="$partcosts + $hullcosts"/> | |
<set_value name="$message" exact="{314152, 2}.[$target.name, this.ship.name, $credits/100, ($hulldamage)i, $hullcosts/100, $partlist]"/> | |
<do_if value="this.ship.owner == $target.owner"> | |
<write_to_logbook category="general" title="{314152, 1}" text="$message"/> | |
</do_if> | |
<do_else> | |
<write_to_logbook category="general" title="{314152, 1}" money="$credits" text="$message"/> | |
</do_else> | |
<apply_experience entity="this.ship.pilot" experience="'mrs'" factor="1.0"/> | |
<wait min="(35 - [this.ship.pilot.skill.engineering * 2f, 30f].min)s" max="(37 - [this.ship.pilot.skill.engineering * 2f, 30f].min)s"/> | |
</do_if> | |
<wait min="(16 - [this.ship.pilot.skill.piloting, 15f].min)s" max="(18 - [this.ship.pilot.skill.piloting, 15f].min)s"/> | |
<do_if value="$target.exists and $target.pilot.exists"> | |
<set_value name="$target.pilot.$mrs_skip" exact="player.age + 120"/> | |
</do_if> | |
<resume label="search"/> | |
<!-- HOME ********************************************************************************* --> | |
<label name="home" /> | |
<do_if value="not $mrs_home? or not $mrs_home.isclass.zone"> | |
<resume label="start"/> | |
</do_if> | |
<set_command command="command.movetozone" param="$mrs_home"/> | |
<set_command_action commandaction="commandaction.flying"/> | |
<write_to_logbook category="general" title="{314152, 1}" text="{314152, 6}.[this.ship.name, $mrs_home.sector.knownname]"/> | |
<get_safe_pos result="$pos" zone="$mrs_home" radius="this.ship.size" min="1km" max="35km"/> | |
<set_value name="$destination" exact="$pos"/> | |
<move_to object="this.ship" destination="$mrs_home" travel="true" forceposition="false" finishonapproach="true" commandaction="false"> | |
<position value="$destination" min="5km" max="6km"/> | |
</move_to> | |
<wait min="4s" max="5s"/> | |
<resume label="search"/> | |
</actions> | |
</attention> | |
</aiscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment