Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
quest_disappear.py
Go to the documentation of this file.
1 import quest
2 import Vector
3 import VS
4 import unit
5 import vsrandom
7  def __init__ (self):
8  self.sysfile = VS.getSystemFile()
9  self.drone=VS.Unit()
10  self.significants=1
11  self.timer = VS.GetGameTime();
12  VS.cacheAnimation ("explosion_wave.ani");
13  self.playlist=VS.musicAddList("galacticbattle.m3u")
14  def launchNewDrone (self):
15  playa=VS.getPlayer()
16  if (not playa.isNull()):
17  if (self.drone.isNull()):
18  vec = playa.Position()
19  vec = Vector.Add(vec,(000,3000,0))
20  self.drone=VS.launch("IO42","beholder","unknown","unit","default",1,1,vec,'')
21  self.drone.SetTarget(playa)
22  pos=self.drone.Position()
23  size=10*self.drone.rSize()
24  VS.playAnimation("explosion_wave.ani",pos,size)
25  if (self.playlist != -1):
26  VS.musicPlayList(self.playlist)
27  VS.musicLoopList(2)
28 # VS.musicPlaySong('../music/galacticbattle.mp3')
29 
30  #not currently used
31  def setDroneNear (self,playa):
32  vec = playa.Position()
33  vec = Vector.Add (vec,(vsrandom.uniform(-1000,1000),
34  vsrandom.uniform(-1000,1000),
35  vsrandom.uniform(-1000,1000)))
36  if (not self.drone.isNull()):
37  self.drone.SetCurPosition(vec)
38  self.drone.SetTarget(playa)
39  def SignificantsNear(self,sig):
40  self.significants=0
41  if (VS.getSystemFile()==self.sysfile):
42  self.significants=1
43  if (vsrandom.randrange(0,10)==0):
44  self.launchNewDrone()
45  def unitRipe (self,playa,un):
46  if (un!=self.drone):
47  if (un.isPlayerStarship()==-1):
48  if (not un.isSignificant()):
49  if (not un.isSun()):
50  if (un.getFlightgroupLeader()!=playa):
51  if (playa.InRange(un,0,1)):
52  return 1
53  return 0
54  def killUnit (self,un):
55  pos=un.Position()
56  size=4*un.rSize()
57  if (size<1000):
58  size=1000
59  print "kill"
60  print un.getName()
61  un.Kill()
62  VS.playAnimation("explosion_wave.ani",pos,size)
63  VS.playSound("cloak.wav",pos,(1,0,0))
64  def DestroyUnit (self):
65  playa = VS.getPlayer()
66  if (not playa.isNull()):
67  if (vsrandom.randrange(0,2)==0):
68  un=playa.GetTarget()
69  if (not un.isNull()):
70  if (self.unitRipe(playa,un)):
71  self.killUnit(un)
72  return
73  i=VS.getUnitList ()
74  un = i.current()
75  while (not un.isNull()):
76  if (self.unitRipe(playa,un)):
77  self.killUnit(un)
78  return
79  i.advance()
80  un=i.current()
81  def Execute (self):
82  if (VS.getSystemFile()==self.sysfile):
83  mytime = VS.GetGameTime();
84  if (mytime-self.timer>10):
85  self.timer=mytime
86  if (vsrandom.randrange(0,5)==0):
87  self.DestroyUnit()
88  return 1
89 
91  def __init__ (self):
92  quest.quest_factory.__init__ (self,"quest_disappear")
93  def create (self):
94  return quest_disappear()