Skip to content

Commit 6ab59d7

Browse files
committed
v7.5RC2
Fixed some debug errors with unfinished submod. Fixed missing blueprints in station calculator.
1 parent 0d97e04 commit 6ab59d7

File tree

4 files changed

+987
-1
lines changed

4 files changed

+987
-1
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<aiscript name="order.da.infestation.protectposition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="aiscripts.xsd">
3+
<order id="DAInfestationShipScript" name="{33232474, 2441}" description="{33232474, 2442}" category="internal" allowinloop="false">
4+
<params>
5+
<param name="destination" type="position" text="{1041, 10027}" comment="Area to protect. Position">
6+
<input_param name="class" value="class.sector"/>
7+
</param>
8+
<param name="goalsector" type="object" default="null" text="{1041, 10117}"/>
9+
<param name="goalkey" type="number" default="null" text="{1041, 10126}"/>
10+
<param name="localdebug" type="bool" text="{1041, 10086}" default="0" advanced="true" comment="Print debug output">
11+
<input_param name="truevalue" value="100"/>
12+
</param>
13+
</params>
14+
<requires>
15+
<match shiptype="shiptype.lasertower" negate="true"/>
16+
<match class="class.spacesuit" negate="true"/>
17+
<match trueowner="faction.khaak"/>
18+
</requires>
19+
<location object="$destination.{1}" position="$destination.{2}" radius="this.ship.maxradarrange"/>
20+
</order>
21+
<interrupts>
22+
<handler ref="SectorChangeHandler"/>
23+
<handler ref="ScannedHandler"/>
24+
<handler ref="InspectedHandler"/>
25+
<handler ref="TargetInvalidHandler"/>
26+
</interrupts>
27+
<init>
28+
<set_command command="command.patrol"/>
29+
<do_if value="$destination.{1}.isclass.sector">
30+
<set_value name="$targetsector" exact="$destination.{1}"/>
31+
</do_if>
32+
<do_else>
33+
<debug_text text="'Input destination is not in a valid space. Destination Space: %1 (%2), Position: %3'.[@$destination.{1}.knownname, $destination.{1}, $destination.{2}]" filter="error"/>
34+
<set_value name="$abort"/>
35+
</do_else>
36+
<do_if value="not $position?">
37+
<set_value name="$position" exact="$destination.{2}"/>
38+
</do_if>
39+
<set_value name="$inittime" exact="player.age"/>
40+
</init>
41+
<attention min="unknown">
42+
<actions>
43+
<do_if value="$abort?">
44+
<resume label="finish"/>
45+
</do_if>
46+
<label name="start"/>
47+
<!-- if different zone, go there -->
48+
<do_if value="(this.sector != $targetsector) or (this.ship.distanceto.[$targetsector, $position] gt this.ship.maxradarrange)">
49+
<run_script name="'move.generic'" result="$movesuccess">
50+
<param name="destination" value="$targetsector"/>
51+
<param name="position" value="$position"/>
52+
<param name="recallsubordinates" value="false"/>
53+
</run_script>
54+
<do_if value="not $movesuccess">
55+
<do_if value="@this.assignedcontrolled.order.isrunning">
56+
<set_order_failed order="this.assignedcontrolled.order" text="{1045, 101}" comment="Unable to reach destination."/>
57+
</do_if>
58+
<debug_text text="'Unable to reach destination. Aborting.'" chance="$debugchance"/>
59+
<resume label="finish"/>
60+
</do_if>
61+
</do_if>
62+
<label name="insector"/>
63+
<get_zone_at_position name="$targetzone" sector="$targetsector" value="$position"/>
64+
<do_if value="not $targetzone">
65+
<!-- If there is still no zone at the position, the position is unobstructed and we are fairly close. Move straight there. -->
66+
<move_to object="this.ship" destination="$targetsector" uselocalhighways="false" finishonapproach="true">
67+
<position value="$position"/>
68+
</move_to>
69+
<!-- at this point, we should be at the destination, so there should now be a zone. -->
70+
<get_zone_at_position name="$targetzone" sector="$targetsector" value="$position"/>
71+
<do_if value="not $targetzone.exists">
72+
<debug_text text="'Error: %1 (%2) should be at the destination zone, but there still is no zone at the destination. present location: %3, %4, %5. destination: %6'.[this.ship.knownname, this.ship, this.ship.zone.knownname, this.ship.sector.knownname, this.ship.cluster.knownname, $destination]" filter="error"/>
73+
<resume label="finish"/>
74+
</do_if>
75+
</do_if>
76+
<!-- Translate sector coordinates to zone coordinates. Dealing with zones is still necessary due to needing a safepos further down. -->
77+
<do_if value="$targetzone">
78+
<!-- Input: $position relative to $targetsector. Output: $zoneposition relative to $targetzone. -->
79+
<create_position name="$zoneposition" space="$targetzone" value="$position" object="$targetsector"/>
80+
<debug_text text="'%1 (%2) destination coordinates are now: %3 in %4 (%5), %6, %7'.[this.ship.knownname, this.ship, $zoneposition, $targetzone.knownname, $targetzone.macro, $targetzone.sector.knownname, $targetzone.cluster.knownname]" chance="$debugchance"/>
81+
</do_if>
82+
<set_order_syncpoint_reached order="this.ship.order"/>
83+
<do_if value="$targetzone.exists">
84+
<signal_objects object="$targetsector" param="'DAInfestationArrived'" param2="this.assignedcontrolled" param3="[$goalsector,$goalkey]"/>
85+
</do_if>
86+
<do_while value="$targetzone.exists">
87+
<!-- initial random position in zone -->
88+
<get_safe_pos result="$pos" zone="$targetzone" radius="this.ship.size/2f" max="this.ship.maxradarrange" value="$zoneposition"/>
89+
<run_script name="'move.seekenemies'">
90+
<param name="destination" value="$targetzone"/>
91+
<param name="pos" value="$pos"/>
92+
<param name="pursuetargets" value="false"/>
93+
<param name="pursuedistance" value="$radius"/>
94+
<param name="targetclasses" value="[class.ship,class.station,class.satellite]"/>
95+
<param name="radius" value="this.ship.maxradarrange"/>
96+
<param name="radiusanchorpos" value="$position"/>
97+
<param name="radiusanchorspace" value="$targetsector"/>
98+
<param name="engageonsight" value="true"/>
99+
<param name="enforceradius" value="true"/>
100+
<param name="internalorder" value="true"/>
101+
<param name="debugchance" value="$debugchance"/>
102+
</run_script>
103+
<wait exact="500ms"/>
104+
</do_while>
105+
<do_if value="not $targetzone.exists">
106+
<debug_text text="'targetzone of %s %s %s %s no longer exists.'.[@this.assignedcontrolled.job, @this.assignedcontrolled.idcode, @this.assignedcontrolled.knownname, this.assignedcontrolled]" chance="$debugchance"/>
107+
<resume label="start"/>
108+
</do_if>
109+
<!-- Required for sync point handler -->
110+
<label name="finish"/>
111+
<do_if value="(this.sector != $targetsector) and (this.assignedcontrolled.gatedistance.{$targetsector} gt 0)">
112+
<resume label="start"/>
113+
</do_if>
114+
<do_elseif value="(this.sector == $targetsector) and (this.ship.distanceto.[$targetsector, $position] gt this.ship.maxradarrange)">
115+
<resume label="start"/>
116+
</do_elseif>
117+
<do_else>
118+
<!-- There was an issue, die -->
119+
<cancel_all_orders object="this.assignedcontrolled"/>
120+
<destroy_object object="this.assignedcontrolled" explosion="false"/>
121+
</do_else>
122+
</actions>
123+
</attention>
124+
<on_abort>
125+
<destroy_object object="this.assignedcontrolled" explosion="false"/>
126+
</on_abort>
127+
</aiscript>

0 commit comments

Comments
 (0)