That looks nice, thanks for the tip Have to look in to that, some speed hacks would be great for testing.
Actually got in sector boosting working relatively reliably yesterday Only challenge now is to force the get_safe_pos to give a consistent output. Trying to force it to return a point in space from the target toward ship which is ca 13KM away from target with:
Code: Select all
<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
The direction statement is not often used in the vanilla code so not much to go on, only in the undock code IIRC.
Here is the current codesnippet if someone want to play with it over the weekend. Have cleaned up some of my debugging stuff to help readability.
The forceposition="false" in boost move is important, without it the game will throw the ships around wildly on arrival. Have the minimum range for IS boost set to 20KM here.
Code: Select all
<do_if value="this.ship.distanceto.{$target} gt 20000 and this.ship.isplayerowned" >'
<!--Stop and hold position/rotate to target-->
<create_orientation name="$targetvector" refobject="$target" orientation="look_at">
<position object="this.ship" space="this.ship.zone" />
</create_orientation>
<move_to destination="this.zone" object="this.ship" >
<position object="this.ship" z="5m" />
<rotation value="$targetvector" />
<interrupt_after_time time="60s" />
<interrupt>
<conditions>
<check_any>
<event_object_destroyed object="$target"/>
<event_boost_started object="$target" />
</check_any>
</conditions>
</interrupt>
</move_to>
<!--Find safe pos ca 13KM from target in direction of this ship-->
<set_avoid_collisions object="this.ship" enabled="false" />
<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
<set_value name="$counter" exact="1"/>
<!--HACK!: position sanity validation/force rechecks, max 30 retries to avoid infinite loop lockup...-->
<do_while value="(this.ship.distanceto.{$target} - this.ship.distanceto.{$pos}) le 7000">
<get_safe_pos object="$target" zone="this.zone" directionobject="this.ship" angle="35deg" min="12500" max="13500" radius="this.ship.size" result="$pos" allowyaxis="false"/>
<set_value name="$counter" exact="$counter + 1"/>
<do_if value="$counter ge 30">
<break />
</do_if>
</do_while>
<set_value name="$posY" exact="$target.position.y"/>
<do_if value="$isstation">
<set_value name="$posY" exact="$pos.y"/>
</do_if>
<do_if value="player.ship == this.ship">
<speak actor="this" line="1029" comment="Engaging boosters." />
</do_if>
<start_boost object="this.ship" />
<move_to destination="this.zone" object="this.ship" forceposition="false" finishonapproach="true" usehighways="false">
<position x="$pos.x" y="$posY" z="$pos.z" />
<rotation value="$targetvector" />
<interrupt_after_time time="$updatetime" />
<interrupt>
<conditions>
<check_any>
<event_object_destroyed object="$target"/>
<event_boost_started object="$target" />
<check_all>
<event_boost_charging_started object="$target" />
<check_value value="this.ship.distanceto.{$target} le 15km" />
</check_all>
</check_any>
</conditions>
</interrupt>
</move_to>
<stop_boost object="this.ship" />
<set_avoid_collisions object="this.ship" enabled="true" />
</do_if>