Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
ambush_scan.py
Go to the documentation of this file.
1 import ambush
2 import VS
3 import Director
4 import directions_mission
6  def __init__(self,savevar,systems,delay,faction,numenemies,dyntype='',dynfg='',greetingText=["You have been scanned and contraband has been found in your hold.","You should have dumped it while you had the chance.","Now you die!"], directions=[], destination='',AdjustFaction=True,cargotype="Brilliance",altGreetingText=["Thank you for delivering the cargo to us instead.","We appreciate your candor in this matter."]):
7  ambush.ambush.__init__(self,savevar,systems,delay,faction,numenemies,dyntype,dynfg,greetingText,directions,destination,AdjustFaction)
8  self.altGreetingText=altGreetingText
9  self.cargotype=cargotype
10  self.counter=0
11  def FriendlyLaunch(self):
12  self.havelaunched=1
13  import launch
14  L=launch.Launch()
15  L.fg="Shadow"
16 
17  if(self.dyntype==""):
18  import faction_ships
20  L.type=self.dyntype
21  L.dyntype=self.dyntype
22  L.num=self.numenemies
23  L.faction=self.faction
24  L.minradius=3000
25  L.maxradius=4000
26  try:
27  import faction_ships
28  L.minradius*=faction_ships.launch_distance_factor
29  L.maxradius*=faction_ships.launch_distance_factor
30  except:
31  pass
32  you=VS.getPlayerX(self.cp)
33  friendly=L.launch(you)
34  import universe
35  universe.greet(self.altGreetingText,friendly,you);
36 
37  def Execute(self):
39  if(self.inescapable):
40  you=VS.getPlayerX(self.cp)
41  if you.getUnitSystemFile()==self.systems[0]:
42  self.timer=VS.GetGameTime();
43  if you.GetCargo(self.cargotype).GetQuantity()==0:
44  self.inescapable=0
45  un=VS.getUnit(self.counter)
46  if(un):
47  if un.getName()==self.cargotype or un.getName()=="Mission_Cargo":
48  self.counter=0
49  un=VS.getUnit(0)
50  while(un):
51  self.counter+=1
52  un=VS.getUnit(self.counter)
53  while (self.counter>0):
54  self.counter-=1
55  un=VS.getUnit(self.counter)
56  if (un):
57  if un.getName()==self.cargotype or un.getName()=="Mission_Cargo":
58  un.Kill()
59  if not self.havelaunched:
60  self.FriendlyLaunch()
61 
62  else:
63  #print self.cargotype +" not matched with "+un.getName()
64  self.counter+=1
65 
66  else:
67  self.counter=0