Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
go_somewhere_significant Namespace Reference

Data Structures

class  go_somewhere_significant
 

Functions

def moveUnitTo
 
def HaveArrived
 
def SignificantUnit
 
def getSignificantFullName
 
def __init__
 
def Print
 
def DestinationSystem
 
def JumpPoints
 
def Execute
 
def initbriefing
 
def loopbriefing
 
def endbriefing
 

Variables

 obj
 
 showObjective
 
 orbitee
 
 capship
 
 you
 
 arrivedarea
 
 distfrombase
 
 sysfil
 
 significantun
 
 mytime
 
 brief_you
 
 brief_sig
 

Function Documentation

def go_somewhere_significant.__init__ (   self,
  you,
  landable_only,
  distance_away_to_trigger,
  base_only = 0,
  capshipfaction = "",
  dyn_fg = "",
  showObjective = 1,
  forcestarship = 0 
)

Definition at line 31 of file go_somewhere_significant.py.

31 
32  def __init__ (self,you, landable_only, distance_away_to_trigger,base_only=0,capshipfaction="", dyn_fg="", showObjective=1, forcestarship=0):
33  self.obj=0
34  self.showObjective=showObjective
35  self.orbitee=""
36  self.capship=0
37  self.you = you
38  self.arrivedarea=0
39  self.distfrombase=distance_away_to_trigger
40  significant=VS.Unit()
41  aroundthe=""
42  self.sysfil=VS.getSystemFile()
43  if (landable_only or base_only):
44  randint=vsrandom.randrange(0,128)
45  lim=1
46  if landable_only and not base_only:
47  lim=10
48  for i in xrange(lim):
49  significant = unit.getSignificant (randint,landable_only,base_only)
50 
51  if significant.isPlanet():
52  break
53  else:
54  randint+=1
55  if (landable_only and not unit.isLandable(significant)) or forcestarship:
56  self.capship=1
57  if (capshipfaction==""):
58  capshipfaction="merchant"
59  if (self.capship and capshipfaction!=""):
60  if (significant.isNull()):
61  significant=you
62  self.orbitee="%s" % (significant.getName())
63  self.capship=1
64  print "orbitee %s " % self.orbitee
65  if (dyn_fg==""):
66  newship=faction_ships.getRandomCapitol(capshipfaction)
67  found=False
68  near=2000.0
69  far=5000.0
70  try:
71  near*=faction_ships.launch_distance_factor
72  far*=faction_ships.launch_distance_factor
73  except:
74  pass
75 
76  i=VS.getUnitList()
77  while i.notDone():
78  testun = i.current()
79  i.advance()
80  if testun.getFactionName()==capshipfaction and faction_ships.isCapital(testun.getName()):
81  significant=moveUnitTo(testun,significant,near)
82  found=True
83  break
84  if (not found):
85  significant=launch.launch_wave_around_unit("Base",capshipfaction,newship,"sitting_duck",1,near,far,significant,"")
86  else:
87  near=5000.0
88  try:
89  near*=faction_ships.launch_distance_factor
90  except:
91  pass
92  found=False
93  aroundthe=" near "+unit.getUnitFullName(significant,True);
94  i = VS.getUnitList()
95  while i.notDone():
96  testun = i.current()
97  i.advance()
98  if testun.getFactionName()==capshipfaction and faction_ships.isCapital(testun.getName()):
99  significant=moveUnitTo(testun,significant,near)
100  found=True
101  break
102  if (not found):
103  significant=launch_recycle.launch_dockable_around_unit(dyn_fg,capshipfaction,"sitting_duck",near,significant,4*near,'','Base')
104  significant.setFullname(dyn_fg)
105  else:
106  significant = universe.getRandomJumppoint ()
107  if (significant.isNull()):
108  print "ERROR: no significants found in starsystem %s" % (self.sysfil)
109  self.significantun=VS.getPlayer()
110  else:
111  self.significantun=significant
112  self.significantun.setMissionRelevant()
113  #qualifier="the "
114  #if (significant.isPlanet() and significant.isDockableUnit()):
115  # qualifier=""
116  if (self.showObjective):
117  self.obj=VS.addObjective("Visit %s %s" % (self.getSignificantFullName (),aroundthe))
118  VS.setOwner(self.obj,VS.getPlayer())
119 # self.begsigdis=self.you.getSignificantDistance(self.significantun) #see note below
def go_somewhere_significant.DestinationSystem (   self)

Definition at line 125 of file go_somewhere_significant.py.

126  def DestinationSystem(self):
return self.significantun.getUnitSystemFile();
def go_somewhere_significant.endbriefing (   self)

Definition at line 154 of file go_somewhere_significant.py.

155  def endbriefing(self):
156  del self.mytime
157  del self.brief_you
158  del self.brief_sig
def go_somewhere_significant.Execute (   self)

Definition at line 129 of file go_somewhere_significant.py.

130  def Execute(self):
131  if (self.significantun.isNull() or self.you.isNull() or VS.getSystemFile()!=self.DestinationSystem()):
132  return 0
133 # self.frameoffset+=1 #see note below...
134  sigdis=self.you.getSignificantDistance(self.significantun)
135  if (sigdis<=self.distfrombase):
136  self.arrivedarea=1
137  if (self.showObjective):
138  VS.setCompleteness(self.obj,1.0)
139 # if ((not self.arrivedarea) and (self.frameoffset%25)):
140 # VS.setCompleteness(self.obj,(1-(float(sigdis)/float(self.begsigdis)))) #doesn't work too well... for now, it will be 0 until you dock
return self.HaveArrived()
def go_somewhere_significant.getSignificantFullName (   self)

Definition at line 28 of file go_somewhere_significant.py.

References unit.getUnitFullName().

28 
29  def getSignificantFullName(self):
30  return unit.getUnitFullName(self.significantun,False)
def go_somewhere_significant.HaveArrived (   self)

Definition at line 22 of file go_somewhere_significant.py.

22 
23  def HaveArrived (self):
24  return self.arrivedarea
def go_somewhere_significant.initbriefing (   self)

Definition at line 141 of file go_somewhere_significant.py.

142  def initbriefing (self):
143  self.mytime = VS.GetGameTime();
144  faction=self.you.getFactionName();
145  name=self.you.getName()
146  self.brief_you=Briefing.addShip(name,faction,(40.0,0.0,80.0))
147  faction=self.significantun.getFactionName()
148  name = self.significantun.getName()
149  self.brief_sig=Briefing.addShip(name,faction,(-40,0.0,8000.0))
Briefing.enqueueOrder (self.brief_you,(-30,0.0,7900.0),5.0)
def go_somewhere_significant.JumpPoints (   self)

Definition at line 127 of file go_somewhere_significant.py.

128  def JumpPoints (self):
return self.DestinationSystem()
def go_somewhere_significant.loopbriefing (   self)

Definition at line 150 of file go_somewhere_significant.py.

151  def loopbriefing (self):
152  if (VS.GetGameTime()-self.mytime>5):
153  return self.brief_you
return -1
def go_somewhere_significant.moveUnitTo (   un,
  place,
  radius 
)

Definition at line 9 of file go_somewhere_significant.py.

9 
10 def moveUnitTo(un,place,radius):
11  where=place.LocalPosition()
12  print "moving "+un.getName() +" to "+place.getName()
13  prsize=place.rSize();
14  prp = VS.getPlanetRadiusPercent()
15  if (place.isPlanet()):
16  prsize*=1+prp
17  where=(where[0]+un.rSize()+prsize+radius,where[1],where[2]);
18  un.SetPosition(VS.SafeEntrancePoint(where,un.rSize()))
return un
def go_somewhere_significant.Print (   self,
  visitstr,
  fro,
  dockstr = "\0%s",
  time = 0 
)

Definition at line 120 of file go_somewhere_significant.py.

References universe.getMessagePlayer(), and unit.getUnitFullName().

121  def Print(self,visitstr,fro,dockstr="\0%s",time=0):
122  if (self.capship):
123  visitstr+=(dockstr % (self.orbitee))
124  thename=unit.getUnitFullName(self.significantun,True)
VS.IOmessage(time,fro,universe.getMessagePlayer(self.you),visitstr % (thename) )
def go_somewhere_significant.SignificantUnit (   self)

Definition at line 25 of file go_somewhere_significant.py.

25 
26  def SignificantUnit(self):
27  return self.significantun

Variable Documentation

arrivedarea

Definition at line 37 of file go_somewhere_significant.py.

brief_sig

Definition at line 148 of file go_somewhere_significant.py.

brief_you

Definition at line 145 of file go_somewhere_significant.py.

capship

Definition at line 35 of file go_somewhere_significant.py.

distfrombase

Definition at line 38 of file go_somewhere_significant.py.

mytime

Definition at line 142 of file go_somewhere_significant.py.

obj

Definition at line 32 of file go_somewhere_significant.py.

orbitee

Definition at line 34 of file go_somewhere_significant.py.

showObjective

Definition at line 33 of file go_somewhere_significant.py.

significantun

Definition at line 108 of file go_somewhere_significant.py.

sysfil

Definition at line 41 of file go_somewhere_significant.py.

you

Definition at line 36 of file go_somewhere_significant.py.