8 class tail (Director.Mission):
13 def __init__ (self,var_to_set,creds,direct,sdist,mdist,efaction,ffaction,efg,ffg,fnum=3,edyntype='',fdyntype='',edynfg='',fdynfg='',tooclose=["Thought you could hide from me?", "Try hiding from this!"],toofar=["We have lost the lock on the target vessel."],justright=["Thankyou. You help in tracking this criminal has been appreciated."]):
14 Director.Mission.__init__ (self)
15 print 'tail: Starting'
41 self.
cp = VS.getCurrentPlayer()
48 VS.getPlayerX(self.
cp).upgrade(
"jump_drive",0,0,0,1)
53 print 'Tail Error checking: '+self.
directions[0]
70 L.minradius*=faction_ships.launch_distance_factor
71 L.maxradius*=faction_ships.launch_distance_factor
74 self.
enemy=L.launch(VS.getPlayerX(self.
cp))
75 self.enemy.upgrade(
"jump_drive",0,0,0,1)
76 self.
relation = self.enemy.getRelation(VS.getPlayerX(self.
cp))
77 self.enemy.setCombatRole(
"INERT")
79 VS.IOmessage (0,
"[Mission Computer]",
"all",
"Target %s detected! Proceed as per mission instructions."%self.enemy.getFullname())
80 self.
objref=VS.addObjective(
"Follow the %s until it broadcasts the signal"%self.enemy.getFullname())
83 print "now NOT set up!"
99 L.minradius*=faction_ships.launch_distance_factor
100 L.maxradius*=faction_ships.launch_distance_factor
103 friendly=L.launch(around)
104 self.enemy.setCombatRole(
"FIGHTER")
105 flead = friendly.getFlightgroupLeader()
106 flead.SetTarget(self.
enemy)
107 flead.Threaten(self.
enemy,1)
108 self.enemy.Threaten(flead,1)
109 friendly.setFgDirective(
'A.')
110 friendly.DeactivateJumpDrive()
117 raise RuntimeError(
"Jumppoint going to %s cannot be found."%j)
118 self.enemy.SetTarget(targ)
119 self.enemy.ActivateJumpDrive(0)
120 print "tail: Enemy running to "+targ.getName()
125 print 'enemy objective updated '+j
134 sys=uni_.getUnitSystemFile()
139 if (sys[where-1]==
'/'):
148 jto=jto[jto.find(
'/')+1:]
149 itera = VS.getUnitList()
150 while itera.notDone():
151 if itera.current().isJumppoint():
152 if itera.current().getName().
lower().
find(jto.lower())!=-1:
153 return itera.current()
158 relpos=
Vector.Sub(target.Position(),VS.getPlayerX(self.
cp).Position())
163 for i
in range(len(approx)):
167 for i
in range(len(approx)):
174 print 'tail: Pick a vector and hope'
177 return unitrel, biggest
181 self.enemy.SetPosition(
Vector.Add(VS.getPlayerX(self.
cp).Position(),vec))
182 self.enemy.SetOrientation((1,0,0),vec)
191 if VS.GetGameTime() > self.
tracking[0]:
194 VS.IOmessage (0,
"[Mission Command]",
"all",
"Out of our way, let us finish the job!")
195 VS.getPlayerX(self.
cp).addCredits(self.
creds)
196 VS.terminateMission(1)
200 VS.getPlayerX(self.
cp).SetPosition(t.Position())
201 VS.setCompleteness(self.
objref, 1.00)
203 VS.IOmessage (0,
"[Mission Computer]",
"all",
"Broadcast intercepted.")
205 VS.IOmessage (i+1,
"[Mission Command]",
"all",self.
succeed1[i])
211 """Does the enemy feel different about the player? If yes, the player
212 must have talked to, or shot at the enemy."""
213 if abs(self.enemy.getRelation(VS.getPlayerX(self.
cp)) - self.
relation) >= 0.003:
214 print "tail: the relation between the player and target has changed"
219 print "tail: Out of range"
221 for j
in range(len(self.
fail2)):
222 VS.IOmessage (j,
"[Mission Command]",
"all",self.
fail2[j])
224 VS.IOmessage(i,
"[Mission Computer]",
"all",
"You are not able to detect the target.")
225 VS.IOmessage (i+1,
"[Mission Computer]",
"all",
"Mission Failed.")
229 print "tail: Too close"
230 VS.IOmessage (0,
"[Mission Computer]",
"all",
"You have been detected by the target %s "%self.enemy.getFullname())
231 VS.IOmessage (1,
"[Mission Computer]",
"all",
"Mission Failed.")
232 for i
in range(len(self.
fail1)):
233 VS.IOmessage (i+2,
"Target",
"all",self.
fail1[i])
234 self.enemy.SetTarget(VS.getPlayerX(self.
cp))
235 self.enemy.setFgDirective(
'A')
239 print "tail: Too dead"
240 VS.IOmessage (0,
"[Mission Computer]",
"all",
"The target %s has been destroyed."%self.enemy.getFullname())
241 VS.IOmessage (1,
"[Mission Computer]",
"all",
"Mission Failed.")
246 VS.setCompleteness(self.
objref, -1.00)
247 VS.terminateMission(0)
251 you=VS.getPlayerX(self.
cp)
258 if self.enemy.isNull():
261 if self.
tracking[0] < VS.GetGameTime():
263 elif VS.getPlayerX(self.
cp).getUnitSystemFile() == self.enemy.getUnitSystemFile():
266 VS.IOmessage (0,
"[Mission Computer]",
"all",
"Target %s detected in this system."%self.enemy.getFullname())
267 VS.setObjective(self.
objref,
"Follow the %s until it broadcasts the signal"%self.enemy.getFullname())
272 elif VS.getPlayerX(self.
cp).getUnitSystemFile() != self.enemy.getUnitSystemFile():
273 self.enemy.DeactivateJumpDrive()
276 VS.IOmessage (0,
"[Mission Computer]",
"all",
"Target %s detected entering %s"%(self.enemy.getFullname(),self.
nextSystem(VS.getPlayerX(self.
cp))))
277 VS.setObjective(self.
objref,
"Follow the %s into %s"%(self.enemy.getFullname(),self.
nextSystem(VS.getPlayerX(self.
cp))))