Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
quest_rogue_militia.py
Go to the documentation of this file.
1 import quest
2 import Vector
3 import VS
4 import unit
5 import vsrandom
6 import launch
7 import faction_ships
9  def __init__ (self):
10  self.sysfile = VS.getSystemFile()
11  playa=VS.getPlayer()
12  difficulty=4
13  self.stage=0
14  self.mark=VS.GetGameTime()
15  self.gametime = VS.GetGameTime()
16  self.militia = []
17  for i in range(difficulty):
18  self.militia += [launch.launch_wave_around_unit("Extortionist","pirates",faction_ships.getRandomFighterInt(faction_ships.homeland_security),"default",1,100,150,playa)]
19  # self.distractMilitia()
20  VS.IOmessage (0,"Extortionist","all","This is the milita: You must pay toll to pass through these parts")
21  VS.IOmessage (0,"Extortionist","all","Power down your engines for 10 seconds and allow us to remove 2000 credits")
22  VS.IOmessage (5,"Extortionist","all","Those pirates who do not reduce speed will be shot")
23  def ZeroVel (self,playa):
24  vel =playa.GetVelocity()
25  return (vel[0]>-.1 and vel[0] < .1 and vel[1]>-.1 and vel[1] < .1 and vel[2]>-.1 and vel[2] < .1)
26  def deductToll(self,playa):
27  playa.addCredits(-2000)
28  VS.IOmessage (0,"Extortionist","all","We appreciate your donation and wish you safe passage through this system!")
29  VS.IOmessage (3,"Extortionist","all","Thank you, come again!")
30  def distractMilitia(self):
31  targ = unit.getSignificant(2,1,1)
32  for un in self.militia:
33  un.SetTarget(targ)
34  un.SetVelocity ((500,500,500))
35  def Execute (self):
36  playa=VS.getPlayer()
37  if (playa.isNull()):
38  return 1
39  if (VS.getSystemFile()!=self.sysfile):
40  self.gametime=VS.GetGameTime()
41  return 1
42  if (VS.GetGameTime()-self.gametime>10 and self.stage==0):
43  self.stage=1
44  if (self.ZeroVel(playa)):
45  self.deductToll(playa)
46  self.distractMilitia()
47  return 0
48  else:
49  self.stage=1
50  for un in self.militia:
51  un.SetTarget(playa)
52  VS.IOmessage(0,"Extortionist","all","Ok you asked for it! Die scoundrel!")
53  if (self.stage==1):
54  if (len (self.militia)==0):
55  VS.IOmessage (0,"Extortionist","all","*@&* taking work from honest securme($*@")
56  VS.IOmessage(0,"game","news","ROGUE SECURITY FORCES CRUSHED: With the bulk of the Confederate Navy deployed in the war against the Aera, the protection and defense of civilian trade lines have been left to local militias in many systems. Recent events have proven, though, that some of these militias walk a very fine line between enforcing the law and breaking it. In the Heinlein System, the militia began charging outrageous toll fees for passage through the system. On those occasions when their demands weren't met, they opened fire. This prompted the Navy to dispatch the HCS Hangzhou to the system, and today the cruiser finally reported arresting the last member of the rogue security forces.")
57  l = faction_ships.capitols[faction_ships.confed]
58  launch.launch_wave_around_unit("Hangzhou",faction_ships.factions[faction_ships.confed],faction_ships.getRandomCapitolInt(faction_ships.confed),"default",1,1000,2000,playa)
59  self.removeQuest();
60  return 0
61  else:
62  if (self.ZeroVel(playa)):
63  tim = VS.GetGameTime()
64  if (tim-self.mark>10):
65  self.mark = tim
66  elif (tim-self.mark>5):
67  self.deductToll(playa)
68  self.distractMilitia()
69  return 0
70  if (self.militia[0].isNull()):
71  del self.militia[0]
72  return 1
73 
75  def __init__ (self):
76  quest.quest_factory.__init__ (self,"quest_rogue_militia")
77  def create (self):
78  return quest_rogue_militia()