Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
total_jump.py
Go to the documentation of this file.
1 import vsrandom
2 import launch
3 import faction_ships
4 import VS
5 import Briefing
6 import universe
7 import unit
8 import Director
9 class total_jump:
10  def __init__(self):
11  VS.SetDifficulty(.1)
12  self.lasttime=-1000
13  self.waittime=5.0
14  def launch_new_wave(self):
15  un = VS.getPlayer()
16  if (vsrandom.randrange(0,4)==0):
17  if (un):
18  currentsystem = VS.getSystemFile()
19  numadj=VS.GetNumAdjacentSystems(currentsystem)
20  if (numadj):
21  cursys=VS.GetAdjacentSystem(currentsystem,vsrandom.randrange(0,numadj))
22  else:
23  cursys = 'enigma_sector/heavens_gate'
24  print "TJ: jumping to "+cursys
25  un.JumpTo(cursys)
26  else:
27  print "TJ: jumping to [ERROR: you are null]"
28  return
29  else:
31  if len(siglist)==0:
32  print "TJ: siglist empty"
33  return
34  sig=siglist[vsrandom.randrange(0,len(siglist))]
35  if (not sig):
36  print "TJ: sig null"
37  return
38  print "TJ: autopiloting to "+sig.getName()
39  un.AutoPilotTo(sig,True)
40  un.SetTarget(sig)
41 
42 ## side = vsrandom.randrange(0,2)
43 ## faction="confed"
44 ## ai = vsrandom.randrange(0,2)
45 ## if (ai==0):
46 ## ai = "printhello.py"
47 ## else:
48 ## ai = "default"
49 ## if (side==0):
50 ## faction=faction_ships.get_enemy_of("confed")
51 ## else:
52 ## faction=faction_ships.get_friend_of("confed")
53 ## launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,10),100.0,2000.0,VS.getPlayer(),'')
54 ## if (vsrandom.randrange(0,10)==0):
55 ## launch.launch_wave_around_unit ("ShadowCap",faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')
56  def Execute (self):
57 # un=VS.getUnit(0);
58 # i=0
59 # while (un):
60 # print un.getName()
61 # i+=1
62 # un= VS.getUnit(i)
63  time = VS.GetGameTime()
64  if (time-self.lasttime>self.waittime):
65  self.launch_new_wave()
66  self.waittime=vsrandom.randrange(10.0,30.0)
67  self.lasttime=time
68  def initbriefing(self):
69  print "ending briefing"
70  def loopbriefing(self):
71  print "loop briefing"
72  Briefing.terminate();
73  def endbriefing(self):
74  print "ending briefing"