Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion Deep Space Pirates

Content

Warnings

  1. License not specified
  2. Unknown key 'licence' at https://wiki.alioth.net/img_auth.php/5/57/DeepSpacePirates-1.9.oxz!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds aditional pirates outside the mail trading lanes. Adds aditional pirates outside the mail trading lanes.
Identifier oolite.oxp.EricWalch.DeepSpacePirates oolite.oxp.EricWalch.DeepSpacePirates
Title Deep Space Pirates Deep Space Pirates
Category Activities Activities
Author Eric Walch Eric Walch
Version 1.9 1.9
Tags pirates pirates
Required Oolite Version
Maximum Oolite Version
Required Expansions
  • oolite.oxp.Svengali.Library:1.7.1
  • oolite.oxp.Svengali.Library:1.7.1
  • Optional Expansions
    Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/DeepSpacePirates n/a
    Download URL https://wiki.alioth.net/img_auth.php/5/57/DeepSpacePirates-1.9.oxz n/a
    License
    File Size n/a
    Upload date 1610873301

    Documentation

    Also read http://wiki.alioth.net/index.php/Deep%20Space%20Pirates

    DeepSpacePirates readMe.rtf

    {\rtf1\ansi\deff3\adeflang1025
    {\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f4\froman\fprq2\fcharset0 Liberation Sans{\*\falt Arial};}{\f5\froman\fprq2\fcharset0 Helvetica{\*\falt Arial};}{\f6\fnil\fprq2\fcharset0 Lohit Devanagari;}{\f7\fnil\fprq2\fcharset0 Helvetica{\*\falt Arial};}{\f8\fnil\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}}
    {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
    {\stylesheet{\s0\snext0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046 Normal;}
    {\s15\sbasedon0\snext16\ql\nowidctlpar\hyphpar0\sb240\sa120\keepn\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f4\fs28 Heading;}
    {\s16\sbasedon0\snext16\sl276\slmult1\ql\nowidctlpar\hyphpar0\sb0\sa140\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24 Text Body;}
    {\s17\sbasedon16\snext17\sl276\slmult1\ql\nowidctlpar\hyphpar0\sb0\sa140\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24 List;}
    {\s18\sbasedon0\snext18\ql\nowidctlpar\hyphpar0\sb120\sa120\ltrpar\cf1\i\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24 Caption;}
    {\s19\sbasedon0\snext19\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24 Index;}
    }{\*\generator LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3}{\info{\creatim\yr0\mo0\dy0\hr0\min0}{\author Dybal }{\revtim\yr2020\mo8\dy1\hr14\min24}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab720
    \hyphauto0\viewscale110
    {\*\pgdsctbl
    {\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\pgdscnxt0 Default Style;}}
    \formshade{\*\pgdscno0}\paperh16838\paperw11906\margl1440\margr1440\margt1440\margb1440\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
    {\*\ftnsep\chftnsep}\pgndec\pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs42\loch\f5\hich\af5
    Deep space pirates }
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    version 1.5 by Eric Walch}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Minimum version requirement Oolite 1.80}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    This is just a basic oxp that increases the chance of an encounter with pirates outside the space lanes and in deep space. This is the area were the pirates start their career and do their combat practice. Some of these pirates still have a clean status as they never have been caught in the action by an official copper or never let a victim escape to report the crime. }
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Little Bear's famous words:}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    "Even pirates need to sleep / rest / make repaires etc. As they're offenders or fugitives, it make sense for them to park up outside the space lanes once they've filled their holds. The Captain of a pirate Python may perhaps have a fixed 'meeting point' way outside the space lanes. He may meet up with felow criminals who have Clean records. The booty is transfered and the 'fence' takes it to the station in return for a cut of the profits. Natrually you don't want to do this sort of thing in the Space Lanes were a passing Cop might notice and give the 'fence' an offender tag (ruining his usefulness). A pirate might also have to shut down his main reacter to fix battle damage. It would be suicide to do that the space lanes where any passing Cop or Hunter might blast your helpless craft apart. I'd vote for quite a few pirates outside the space lanes. This explains why traders tend to stick to the space lanes. At least they are patroled by Cops. Even in an Anarchy there at least a chance that a bounty hunter might help you out or a fellow trader hear your distress call and come to your hail. But outside the space lanes, if you do run into a band of ruffians , there's nobody about to hear your screams..."}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Background of this oxp}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    The original Elite was written for slow computers that could not cope with too much action. So ships were only added near the player's location. When the player left them behind they were removed from the system. (Player-centred game.)}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Oolite was developed for much faster computers. Initially the system is populated. Then the player is put in the middle of it. A lot of action happens in places the player cannot see.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    But more ships mean more calculations, so a choice was made to place ships along the routes a player is likely to travel (i.e., the space lanes: from the witch point beacon to the planet, and, to a lesser extent, from the planet to the sun.) Outside the lanes space is normally quite empty. (Ships spotted outside the lanes were probably added by some other OXP.)}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    DeepSpacePirates.OXP was designed to add ships outside the space lanes--based on the player's location, direction and speed. Random ships can be encountered anywhere in the universe, bringing a realism to the player's experience.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Without this OXP the area outside the space lanes is free of piracy. Players often make a small detour and leave the lanes to avoid lurking pirates within.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    This OXP makes travel within the lanes a better option by increasing the player's chance of getting assistance from GalCop (the police) and/or from bounty hunters who are only too willing to make a kill. Leaving the lanes is more like a short-cut through a dark alley: no more guarantees of a risk-free flight.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Encounters}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Currently it adds pirates and asteroids. Frequency of adding depends on government type and distance to the spacelane. The chance of adding is much higher just outside the lanes than in deep space. }
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Technical stuff about the oxp.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    The script only generates pirates from the pool of existing ships in your addOns folder. It has no ships of his own. Also the code is very basic. From  a certain distance on from the centre of space lanes (100 km = about 4x scanner range) it starts adding pirates when certain conditions are met. The lanes planet-witchpoint and planet-sun are save zones as they are officially controlled by GalCop. Here no additions take place by the oxp. The spacelane witchpoint-sun is not controlled by GalCop and here additions can take place. Further away in deep space the frequency of adding decreases but will never reach zero. To prevent interfering with stations, this oxp also doesn't adds ships to near stations.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    To get the player a feeling about dimensions: Planetary radii are roughly between 3000 and 6000 km as given in the data screen. For the internal used values one should divide this value by 100. Internally the main-planet radius is about 30-60 km. The main station is always 2 planetary radii away from the planet centre: 60-120 km. This gives a rough idea when this oxp comes into action.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Anyone that wants to invest time to make it a real oxp with new ships and a story: feel free to use this code as a base for your work.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\cf1\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\ab0\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    Version history}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.7    Removal of derelicts and asteroids created by the OXP can be controlled by Library OXP Interfaces Screen (F4) Config for AddOns}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.6\tab Don\u8217\'92t remove derelicts when out of player\u8217\'92s view.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.5\tab Raised minimum Oolite to 1.80.  The AI didn't work correct since Oolite 1.80 because of the changed pirateAI name for default pirates.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab Now also adds an occasional hunter/trader/viper instead of asteroids. The count of added ships stays the same.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab Removes all added ships when out of player view. Not only the pirates as before.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.4\tab Raised minimum Oolite to 1.77. No functional changes. }
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.3\tab Raised minimum Oolite to 1.74. Replaced all the 'legacy_addShip' commands by the new 1.74 commands. No functional changes. }
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.2\tab Raised minimum Oolite to 1.73. Pirates are now added with a group definition.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.1\tab No more pirate adding in direct player laser path.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab Added internal timer instead of Oolite's own.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab Cargo is now transferred to the clean ships.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab Escorts become pirates when mom dies and no other pirate accepts them as as escort.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab More pirates in unstable systems.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab More pirates based on the overall ds-pirate kill. (ds-Kiils are saved now).}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    \tab ds-Pirates are removed from the system when the player is 10 scanner ranges away.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    1.0\tab First release for Oolite 1.72.}
    \par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf1\kerning1\dbch\af6\langfe1081\dbch\af8\afs24\alang1046\loch\f3\fs24\lang1046\ql\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803{\cf1\b0\kerning1\dbch\af6\langfe1081\dbch\af7\afs24\alang1046\rtlch \ltrch\loch\fs24\loch\f5\hich\af5
    0.x\tab Test releases for Oolite 1.71}
    \par }

    Readme.txt

    Deep Space Pirates 
    ------------------
    v1.9, by Eric Walch
    
    Minimum version requirement Oolite 1.80
    
    This is just a basic oxp that increases the chance of an encounter with pirates outside the space lanes and in deep space. This is the area were the pirates start their career and do their combat practice. Some of these pirates still have a clean status as they never have been caught in the action by an official copper or never let a victim escape to report the crime. 
    
    Little Bear's famous words:
    "Even pirates need to sleep / rest / make repaires etc. As they're offenders or fugitives, it make sense for them to park up outside the space lanes once they've filled their holds. The Captain of a pirate Python may perhaps have a fixed 'meeting point' way outside the space lanes. He may meet up with felow criminals who have Clean records. The booty is transfered and the 'fence' takes it to the station in return for a cut of the profits. Natrually you don't want to do this sort of thing in the Space Lanes were a passing Cop might notice and give the 'fence' an offender tag (ruining his usefulness). A pirate might also have to shut down his main reacter to fix battle damage. It would be suicide to do that the space lanes where any passing Cop or Hunter might blast your helpless craft apart. I'd vote for quite a few pirates outside the space lanes. This explains why traders tend to stick to the space lanes. At least they are patroled by Cops. Even in an Anarchy there at least a chance that a bounty hunter might help you out or a fellow trader hear your distress call and come to your hail. But outside the space lanes, if you do run into a band of ruffians , there's nobody about to hear your screams..."
    
    Background of this oxp
    ----------------------
    The original Elite was written for slow computers that could not cope with too much action. So ships were only added near the player's location. When the player left them behind they were removed from the system. (Player-centred game.)
    Oolite was developed for much faster computers. Initially the system is populated. Then the player is put in the middle of it. A lot of action happens in places the player cannot see.
    But more ships mean more calculations, so a choice was made to place ships along the routes a player is likely to travel (i.e., the space lanes: from the witch point beacon to the planet, and, to a lesser extent, from the planet to the sun.) Outside the lanes space is normally quite empty. (Ships spotted outside the lanes were probably added by some other OXP.)
    
    DeepSpacePirates.OXP was designed to add ships outside the space lanes--based on the player's location, direction and speed. Random ships can be encountered anywhere in the universe, bringing a realism to the player's experience.
    Without this OXP the area outside the space lanes is free of piracy. Players often make a small detour and leave the lanes to avoid lurking pirates within.
    This OXP makes travel within the lanes a better option by increasing the player's chance of getting assistance from GalCop (the police) and/or from bounty hunters who are only too willing to make a kill. Leaving the lanes is more like a short-cut through a dark alley: no more guarantees of a risk-free flight.
    
    Encounters
    ----------
    Currently it adds pirates and asteroids. Frequency of adding depends on government type and distance to the spacelane. The chance of adding is much higher just outside the lanes than in deep space. 
    
    Technical stuff about the oxp
    -----------------------------
    The script only generates pirates from the pool of existing ships in your addOns folder. It has no ships of his own. Also the code is very basic. From  a certain distance on from the centre of space lanes (100 km = about 4x scanner range) it starts adding pirates when certain conditions are met. The lanes planet-witchpoint and planet-sun are safe zones as they are officially controlled by GalCop. There no additions take place by the oxp. The spacelane witchpoint-sun is not controlled by GalCop and here additions can take place. Further away in deep space the frequency of adding decreases but will never reach zero. To prevent interfering with stations, this oxp also doesn't adds ships too near stations.
    
    To get the player a feeling about dimensions: Planetary radii are roughly between 3000 and 6000 km as given in the data screen. For the internal used values one should divide this value by 100. Internally the main-planet radius is about 30-60 km. The main station is always 2 planetary radii away from the planet centre: 60-120 km. This gives a rough idea when this oxp comes into action.
    
    Anyone that wants to invest time to make it a real oxp with new ships and a story: feel free to use this code as a base for your work.
    
    Version History
    ---------------
    1.9   Changes Library Config for AddOns settings from integer to boolean.
    1.8   Fixes bug when adding pirates. (Dybal)
    1.7   Removal of derelicts and asteroids created by the OXP can be controlled by Library OXP Interfaces Screen (F4) Config for AddOns (Dybal)
    1.6   Don’t remove derelicts when out of player’s view. (Dybal)
    1.5   Raised minimum Oolite to 1.80.  The AI didn't work correct since Oolite 1.80 because of the changed pirateAI name for default pirates.
          Now also adds an occasional hunter/trader/viper instead of asteroids. The count of added ships stays the same.
          Removes all added ships when out of player view. Not only the pirates as before.
    1.4   Raised minimum Oolite to 1.77. No functional changes. 
    1.3   Raised minimum Oolite to 1.74. Replaced all the 'legacy_addShip' commands by the new 1.74 commands. No functional changes. 
    1.2   Raised minimum Oolite to 1.73. Pirates are now added with a group definition.
    1.1   No more pirate adding in direct player laser path.
          Added internal timer instead of Oolite's own.
          Cargo is now transferred to the clean ships.
          Escorts become pirates when mom dies and no other pirate accepts them as as escort.
          More pirates in unstable systems.
          More pirates based on the overall ds-pirate kill. (ds-Kiils are saved now).
          ds-Pirates are removed from the system when the player is 10 scanner ranges away.
    1.0   First release for Oolite 1.72.
    0.x   Test releases for Oolite 1.71
    

    Equipment

    This expansion declares no equipment. This may be related to warnings.

    Ships

    Name
    DSProck-hermit

    Models

    This expansion declares no models. This may be related to warnings.

    Scripts

    Path
    Scripts/deep_space_pirates.js
    "use strict";
    this.name        = "deep_space_pirates"; 
    this.author      = "eric walch"; 
    this.copyright   = "� 2008-2014 Creative Commons: attribution, non-commercial, sharealike."; 
    this.description = "This script places random ships in deep space."; 
    this.version     = "1.9";
    /*
    The script does nothing when in interstellar space or when docked or when under attack.
    The chance of encounters is less when traveling slow. NB jumpSpeed is about 32 * maxSpeed.
    It only add ships when not within "this.spacelaneRadius" meters from the core of: the spacelane planet-witchpoint, the spacelane planet-sun or any station.
    Decrease change of encounters logaritmic with distance.
    */
    
    this.$logging = true;
    this.$debug = false;
    this.$spacelaneRadius = 100E3;
    this.$addition = 0;
    this.$preserveDerelicts = false;
    this.$preserveAsteroids = false;
     // planet radius is between 2816 km and 6912 km on F7 screen, main-station at twice this distance.
     // In calculation Oolite uses internal 28160 til 69120 meters
    
    this.$libConfig = { // for Lib_Config to handle on-station OXP configuration
        Name:   "deep_space_pirates",
        Alias:  "Deep Space Pirates",
        Display:"Config",
        Alive:  "$libConfig",
        Bool:   {
                    B0: {
                            Name:   "$preserveDerelicts",
                            Desc:   "Preserve derelicts",
                            Def:    false, 
                    },
                    B1: {
                            Name:   "$preserveAsteroids",
                            Desc:   "Preserve asteroids",
                            Def:    false,
                    },
                    Info:   "false: remove when out of player's sight; true: preserve"
        }
    }
    
    
    //---------------------------------------------------------------------------------------------//
    this.startUp = function _startUp() {
        var mv = missionVariables;
        if (!mv.deep_space_pirate_kills) mv.deep_space_pirate_kills = 1; // 0 would be a problem with Math.log()
        if (mv.deep_space_pirates_preserve_derelicts == 1) 
            this.$preserveDerelicts = true;
        else
            this.$preserveDerelicts = false;
        if (mv.deep_space_pirates_preserve_asteroids == 1)
            this.$preserveAsteroids = true;
        else
            this.$preserveAsteroids = false;
        this.$additiontime = clock.seconds;
        // With the long range scanner available, also pirates can find the player better.
        if (player.ship.equipmentStatus("EQ_LONG_RANGE_SCANNER") != "EQUIPMENT_UNKNOWN") 
            this.$addition = 10;
        this.$dsGroup = new ShipGroup("DeepSpaceShips"); // start with an empty group
    }
    
    //---------------------------------------------------------------------------------------------//
    this.startUpComplete = function _startUpComplete() {
        if (worldScripts.Lib_Config) {
            this.$missionVars = missionVariables;
            var ret = worldScripts.Lib_Config._registerSet(this.$libConfig);
            if (this.$logging) log(this.name, "Lib Config registerSet returned "+ret);
        }
    }
    
    //---------------------------------------------------------------------------------------------//
    this.shipLaunchedFromStation = this.shipExitedWitchspace = function _startTimer() {
        if (this.$checkTimer)
            this.$checkTimer.start()
        else
            this.$checkTimer = new Timer(this, this.$dsCheck, 30, 10)
    }
    
    //---------------------------------------------------------------------------------------------//
    this.shipWillDockWithStation = this.shipWillEnterWitchspace = function _stopTimer() {
        if (this.$checkTimer && this.$checkTimer.isRunning)
            this.$checkTimer.stop();
    }
    
    //---------------------------------------------------------------------------------------------//
    this.playerWillSaveGame = function _playerWillSaveGame() {
        var mv = missionVariables;
        mv.deep_space_pirates_preserve_derelicts = (this.$preserveDerelicts ? 1 : 0);
        mv.deep_space_pirates_preserve_asteroids = (this.$preserveAsteroids ? 1 : 0);
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsCheck = function _dsCheck() {
        var _ship = player.ship;
        var rnd = Math.random();
        var thresholdSpeed = 20 * _ship.maxSpeed * rnd;
        if (this.$debug) log(this.name, "timer, speed: "+_ship.speed.toFixed(0)+", threshold: "+thresholdSpeed.toFixed(0)+", speed_chk:"+(_ship.speed>thresholdSpeed)+", clock:"+(clock.seconds - this.$additiontime > 120));
        if (!system.isInterstellarSpace 
                && !_ship.docked
                && (_ship.speed > 20 * _ship.maxSpeed * rnd)
                && !player.alertHostiles 
                && (clock.seconds - this.$additiontime > 120)) 
            this.$dsAddPirate();
        
        this.$dsRemoveShips();
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsAddPirate = function _dsAddPirate() {
        var _ship = player.ship;
        var logging = this.$logging;
        var debug = this.$debug;
        var local_name = this.name;
        // first check planet-witchpoint spacelane cylinder.
        var spacelaneRadius = this.$spacelaneRadius;
        var playerPosition = _ship.position;
        var distanceToSpacelane = Math.sqrt(playerPosition.x * playerPosition.x + playerPosition.y * playerPosition.y);
        var chanceFactor = 0.2 / Math.log(distanceToSpacelane / spacelaneRadius); // value is nagative up to this.spacelaneRadius.
    
        // Above this.spacelaneRadius meter distance, chanceFactor starts high but decays gradually.
        if (distanceToSpacelane < 3*spacelaneRadius) chanceFactor *= 3 - system.government/3.5; // varies between 1 and 3
        if (chanceFactor < Math.random()) return; // stop further calculations.
    
        // calculate planet-sun spacelane cylinder.
        var sunSpacelane = new Vector3D(system.mainPlanet.position.subtract(system.sun.position));
        var sunPlayerVector = new Vector3D(playerPosition.subtract(system.sun.position));
        const distanceToSun = sunPlayerVector.magnitude();
        const distanceToSunSpacelane = distanceToSun * Math.sin(sunSpacelane.angleTo(sunPlayerVector));
    
        if (debug) log(this.name, "distance to land WP: "+distanceToSpacelane.toFixed(0)+", distance to lane PS: "+distanceToSunSpacelane.toFixed(0));
        if (distanceToSpacelane > spacelaneRadius && distanceToSunSpacelane > spacelaneRadius) {
            var heading = _ship.heading; 
            var forwardPosition = new Vector3D();
            var rnd = Math.random();
            if (debug) log(this.name, "random: "+rnd+", threshold: "+(0.6 - system.government / 20));
            if (rnd  <  0.6 - system.government / 20) { // 60% chance of pirate in Anarchie, 25% in Corporate State
                if (system.countShipsWithRole("station", _ship, 100E3) > 0) return;
                // no Pirate addition when > 150 or when within 100 000 m of station
                forwardPosition = playerPosition.add(heading.multiply(50E3));
                // var maxShipNumber = 10.5 + Math.log(missionVariables.deep_space_pirate_kills) - system.government/2
                 // Base max is 7, in anarchies up to 3.5 ships extra and 3.2 extra for every decade of kills.
                if (this.$addition>100) this.$addition = 10; // don't let the value grow to large. 
                const maxShipNumber = Math.log(++this.$addition) + Math.log(missionVariables.deep_space_pirate_kills) / 2 + 5.5 - system.government / 2;
                 // Base max is 2, in anarchies up to 3.5 ships extra and 3.2 extra for every decade of kills
                 // + 3.2 extra for every decade of addition during this startup.
                var pirateGroup = system.addGroup("pirate", this.$dsBiasedRandom(maxShipNumber), forwardPosition, 5E3);
                var pirates = pirateGroup.ships;
                pirateGroup.name = "Deep Space Pirates";
                this.$dsAddShipsToQueue(pirateGroup);
                let i = pirates.length;
                while (i--) {
                    if (pirates[i].escortGroup && pirates[i].escortGroup.count>1) {
                        var j = pirates[i].escortGroup.count;
                        while (j--) {
                            var escort = pirates[i].escortGroup.ships[j];
                            if (escort !== pirates[i]) {
                                escort.switchAI("DSPescortAI.plist");
                                escort.script.shipDied = this.$dsPirateDied;
                            }
                        };
                    }
    
                    if (pirates[i].cargoSpaceCapacity > 15 && pirates[i].entityPersonality&7<3) {
                        pirates[i].bounty = 0;
                        pirates[i].script.shipDied = this.$dsPirateDiedWithCargo;
                    }
                    else
                        pirates[i].script.shipDied = this.$dsPirateDied;
                    if (pirates[i].fuel  ===  0) pirates[i].fuel = 7;
                }
                
                // Convert the script of the first ship.
                // Check if it has an old PirateAI.plist or one of the newer "oolite-piratexxxx.js" scripts. Only than change its AI behaviour
                if (pirates[0].AI  ===  "pirateAI.plist" || 
                    (pirates[0].AI  === "nullAI.plist" && pirates[0].AIScript.name.indexOf("Oolite Pirate") > -1)) {
                    var state = (distanceToSpacelane < 800E3) ? "SPACELANE" : "DEEPSPACE";
                    if (pirates.length>10) state = "HIDEOUT";
                    pirates[0].switchAI("DSPpirateAI.plist");
                    pirates[0].AIState = state;
                }
    
                if (logging) log(local_name, "Added "+ pirates.length +" pirates out of a possible "+ Math.ceil(maxShipNumber) + ". Killcounter: " + missionVariables.deep_space_pirate_kills);
                this.$additiontime = clock.seconds;
            } else {
                if (system.countShipsWithRole("station", _ship, 250E3) > 0) return;
                // no when within 250 000 m of station
                var ship;
                var chance = Math.random();
                var count = 1;
                
                if (chance < 0.10)
                    ship = "trader";
                else if (chance < 0.20)
                    ship = "trader-courier";
                else if (chance < 0.30)
                    ship = "trader-smuggler";
                else if (chance < 0.40)
                    ship = "hunter";
                else if (chance < 0.50)
                    ship = system.techLevel < 8 ? "police" : "interceptor";
                else if (chance < 0.99) {
                    ship = "asteroid";
                    count = this.$dsBiasedRandom(6);
                } else
                    ship = "RockHermit";
                
                if (logging) log(local_name, "Adding " + count + " " + ship);
                if (ship != "RockHermit") {
                    forwardPosition = playerPosition.add(heading.multiply(90E3));
                    this.$dsAddShipsToQueue(system.addGroup(ship, count, forwardPosition, 10E3));
                } else {
                    forwardPosition = playerPosition.add(heading.multiply(200E3));
                    this.$dsAddShipsToQueue(system.addGroup("DSProckhermit", 1, forwardPosition, 10E3));
                    this.$dsAddShipsToQueue(system.addGroup("asteroid", 8, forwardPosition, 10E3));
                    // The only reason for using a custom RockHermit is that we had a yellow scansclass in the past
                    // when adding the build-in one. With Oolite 1.80 this is probably no longer needed.
                }
            }
        } else if (debug)
            log(this.name, "Too close to the lanes: "+distanceToSpacelane.toFixed(0)+" to PW, "+distanceToSunSpacelane.toFixed(0)+" to PS");
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsAddShipsToQueue = function _dsAddShipsToQueue(group) {
        if (group && group.count > 0) {
            var i = group.count;
            while (i--) {
                this.$dsGroup.addShip(group.ships[i]);
                if (group.ships[i].escortGroup.count > 1) {
                    var j = group.ships[i].escortGroup.count;
                    while (j--)
                        this.$dsGroup.addShip(group.ships[i].escortGroup.ships[j]);
                }
            }
        }
        if (this.$logging) log(this.name, "Shipgroup: " + this.$dsGroup.ships);
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsRemoveShips = function _dsRemoveShips() {
        var dsGroup = this.$dsGroup;
        var local_name = this.name;
        var logging = this.$logging;
        var mv = missionVariables;
        var removeDerelicts = !this.$preserveDerelicts;
        var removeAsteroids = !this.$preserveAsteroids;
        var i = dsGroup.count;
    
        while (i--) {
            var s = dsGroup.ships[i];
            if (!s.isVisible && (removeDerelicts || !s.isDerelict) && (removeAsteroids || !s.isBoulder)) {
                if (logging) log(local_name, "removing: " + s.primaryRole+" ("+s.displayName+")");
                s.remove(true);
            }
        }
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsBiasedRandom = function _dsBiasedRandom(amount) {
        return Math.ceil(Math.pow(Math.random(), 3) * amount);
    }
    
    // next code is used by ship scripts.
    //---------------------------------------------------------------------------------------------//
    this.$dsPirateDied = function _dsPirateDied(whom) {
        if (whom && whom.isPlayer && !player.ship.isCloaked) missionVariables.deep_space_pirate_kills++;
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsPirateDiedWithCargo = function _dsPirateDiedWithCargo(whom) {
        if (whom && whom.isPlayer && !player.ship.isCloaked) missionVariables.deep_space_pirate_kills++;
        var cargo = Math.ceil(10 * Math.random());
        if (this.ship.cargoSpaceAvailable < 8) cargo = this.ship.cargoSpaceAvailable;
        if (cargo > 0) this.ship.spawn("cargopod", cargo);
    }
    
    //---------------------------------------------------------------------------------------------//
    this.$dsShipAcceptedEscort = function _dsShipAcceptedEscort(escort) {
            if (escort.script.asigned) return; // escort is already initialised by another ds mother that now has died.
            if (escort.bounty === 0) escort.bounty = this.ship.bounty + 5;
            escort.switchAI("DSPescortAI.plist");
            escort.script.shipDied = worldScripts["deep_space_pirates"].dsPirateDied;
            escort.script.asigned = true;
            if (this.$logging) log(this.name, this.ship.displayName+" accepted escort");
    }