Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
patrol_ambush Class Reference
Inheritance diagram for patrol_ambush:
ambush directions_mission

Public Member Functions

def __init__
 
def terminate
 
def SuccessMission
 
def GeneratePatrolList
 
def DeletePatrolPoint
 
def FinishedPatrol
 
def Execute
 
- Public Member Functions inherited from ambush
def privateSetupPlayer
 
def __init__
 
def setupPlayer
 
def Launch
 
def terminate
 
def Execute
 
- Public Member Functions inherited from directions_mission
def dir_privateSetupPlayer
 
def setupPlayer
 
def __init__
 
def takeCargoAndTerminate
 
def findUnit
 
def getCargo
 
def checkCargo
 
def Execute
 

Data Fields

 jnum
 
 cred
 
 patrolpoints
 
 objectives
 
 distance
 
 quantity
 
 mplay
 
 AdjustFaction
 
- Data Fields inherited from ambush
 timer
 
 inescapable
 
 havelaunched
 
 terminated
 
 faction
 
 systems
 
 numenemies
 
 dyntype
 
 dynfg
 
 greetingText
 
 cp
 
 delay
 
 AdjustFaction
 
 enemy
 
- Data Fields inherited from directions_mission
 arrived
 
 wasnull
 
 you
 
 adjsys
 
 var
 
 savedCargo
 
 jumps
 
 cp
 
 base
 
 destination
 
 mplay
 
 obj
 

Detailed Description

Definition at line 12 of file patrol_ambush.py.

Constructor & Destructor Documentation

def __init__ (   self,
  num_significants_to_patrol,
  distance_from_base,
  creds,
  savevar,
  systems,
  delay,
  faction,
  numenemies,
  dyntype = '',
  dynfg = '',
  greetingText = ["Hello there,
  smuggler,
  Prepare,
  to,
  die,
  The,
  price,
  on,
  your,
  head,
  is,
  big,
  enough,
  that,
  I,
  missed,
  my,
  lunch,
  directions = [],
  destination = '' 
)

Definition at line 13 of file patrol_ambush.py.

References ambush.__init__().

13 
14  def __init__ (self, num_significants_to_patrol, distance_from_base, creds, savevar,systems,delay,faction,numenemies,dyntype='',dynfg='',greetingText=["Hello there, smuggler. Prepare to die!", "The price on your head is big enough that I missed my lunch"],directions=[],destination=''):
15  ambush.ambush.__init__(self,savevar,systems,delay,faction,numenemies,dyntype,dynfg,greetingText,directions,destination)
16  self.jnum=0
17  self.cred=creds
18  self.patrolpoints = []
19  self.objectives = []
20  self.distance = distance_from_base
21  you = VS.getPlayer()
22  self.quantity=num_significants_to_patrol
23  name = you.getName ()
25  self.AdjustFaction=False

Member Function Documentation

def DeletePatrolPoint (   self,
  num,
  nam 
)

Definition at line 65 of file patrol_ambush.py.

References patrol.jnum, patrol_ambush.jnum, defend.mplay, bounty.mplay, directions_mission.mplay, cargo_mission.mplay, patrol.objectives, patrol_ambush.objectives, patrol.patrolpoints, and patrol_ambush.patrolpoints.

65 
66  def DeletePatrolPoint (self,num,nam):
67  VS.IOmessage (0,"patrol",self.mplay,"[Computer] %s scanned, data saved..."%nam)
68  VS.setCompleteness(self.objectives[self.jnum],1.0)
69  del self.objectives[self.jnum]
del self.patrolpoints[self.jnum]
def Execute (   self)

Definition at line 84 of file patrol_ambush.py.

References ambush.cp, ambush.Execute(), patrol_ambush.FinishedPatrol(), patrol.FinishedPatrol(), patrol_ambush.GeneratePatrolList(), patrol.GeneratePatrolList(), ambush.havelaunched, ambush.inescapable, defend.quantity, patrol_ambush.quantity, patrol.quantity, escort_local.quantity, cargo_mission.quantity, cleansweep.SuccessMission(), patrol.SuccessMission(), patrol_ambush.SuccessMission(), defend.SuccessMission(), and escort_local.SuccessMission().

84 
85  def Execute (self):
87  playa=VS.getPlayerX(self.cp)
88  if (playa.isNull()):
89  return
90  if (self.inescapable):
91  if (self.quantity>0):
92  self.GeneratePatrolList ()
93  else:
94  if (self.FinishedPatrol(playa)):
95  self.SuccessMission()
96  if (self.havelaunched):
97  if (not self.enemy.isNull()):
98  if (self.enemy.getUnitSystemFile()==playa.getUnitSystemFile()):
99  self.enemy.SetTarget(playa)
def FinishedPatrol (   self,
  playa 
)

Definition at line 70 of file patrol_ambush.py.

References cleansweep.DeletePatrolPoint(), cleansweep_escort.DeletePatrolPoint(), patrol_ambush.DeletePatrolPoint(), patrol.DeletePatrolPoint(), patrol.distance, patrol_ambush.distance, patrol_ambush.jnum, patrol.jnum, patrol.objectives, patrol_ambush.objectives, patrol_ambush.patrolpoints, and patrol.patrolpoints.

70 
71  def FinishedPatrol (self,playa):
72  if (self.jnum<len(self.patrolpoints)):
73  jpoint =self.patrolpoints[self.jnum]
74  VS.setOwner(self.objectives[self.jnum],playa)
75  if (jpoint.isNull()):
76  self.DeletePatrolPoint(self.jnum,"Debris")
77  else:
78  if (playa.getSignificantDistance (jpoint)<self.distance):
79  self.DeletePatrolPoint(self.jnum,jpoint.getName())
80  else:
81  self.jnum+=1
82  else:
83  self.jnum=0
return (len(self.patrolpoints)==0)
def GeneratePatrolList (   self)

Definition at line 34 of file patrol_ambush.py.

References ambush.cp, patrol.distance, patrol_ambush.distance, defend.mplay, bounty.mplay, directions_mission.mplay, cargo_mission.mplay, patrol_ambush.objectives, patrol.objectives, patrol.patrolpoints, patrol_ambush.patrolpoints, patrol_ambush.quantity, patrol.quantity, defend.quantity, escort_local.quantity, and cargo_mission.quantity.

34 
35  def GeneratePatrolList (self):
36  VS.IOmessage (0,"patrol",self.mplay,"You must get within %f klicks of" % self.distance)
37  count=self.quantity*2
38  str=""
39  while (self.quantity>0 and count > 0):
40  count -= 1
41  sig = unit.getSignificant (vsrandom.randrange (0,128),0,0)
42  if (not sig.isNull()):
43  if (not (sig in self.patrolpoints)):
44  self.patrolpoints += [sig]
45  self.quantity=self.quantity-1
46  fac =sig.getFactionName()
47  nam =sig.getName ()
48  if (fac!="neutral"):
49  obj=VS.addObjective ("Scan %s's %s"% (fac,nam))
50  VS.IOmessage (0,"patrol",self.mplay,"%s owned %s " % (fac,nam))
51  else:
52  if (sig.isPlanet()):
53  if (sig.isJumppoint()):
54  obj=VS.addObjective ("Scan Jumppoint %s" % nam)
55  else:
56  obj=VS.addObjective ("Scan Planet %s" % nam)
57  else:
58  obj=VS.addObjective ("Scan Natural Phenomenon: %s" % nam)
59  VS.IOmessage (0,"patrol",self.mplay,"The object %s " % nam)
60  VS.setOwner(int(obj),VS.getPlayerX(self.cp))
61  VS.setCompleteness(int(obj),-1.0)
62  self.objectives+=[int(obj)]
63 
64  self.quantity=0
def SuccessMission (   self)

Definition at line 29 of file patrol_ambush.py.

References quest.checkSaveValue(), ambush.cp, patrol.cred, patrol_ambush.cred, bounty.cred, defend.cred, escort_local.cred, cargo_mission.cred, directions_mission.var, and SaveVariableGreaterScript.var.

29 
30  def SuccessMission (self):
31  if (quest.checkSaveValue(self.cp,self.var,0) or quest.checkSaveValue(self.cp,self.var,-1) or quest.checkSaveValue(self.cp,self.var,1)):
32  VS.getPlayerX(self.cp).addCredits (self.cred)
33  VS.terminateMission(0)
def terminate (   self)

Definition at line 26 of file patrol_ambush.py.

References quest.checkSaveValue(), ambush.cp, ambush.terminate(), directions_mission.var, and SaveVariableGreaterScript.var.

26 
27  def terminate(self):
28  if (quest.checkSaveValue(self.cp,self.var,0) or quest.checkSaveValue(self.cp,self.var,-1)):
ambush.ambush.terminate(self)

Field Documentation

AdjustFaction

Definition at line 24 of file patrol_ambush.py.

cred

Definition at line 16 of file patrol_ambush.py.

distance

Definition at line 19 of file patrol_ambush.py.

jnum

Definition at line 15 of file patrol_ambush.py.

mplay

Definition at line 23 of file patrol_ambush.py.

objectives

Definition at line 18 of file patrol_ambush.py.

patrolpoints

Definition at line 17 of file patrol_ambush.py.

quantity

Definition at line 21 of file patrol_ambush.py.


The documentation for this class was generated from the following file: