Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
client.py
Go to the documentation of this file.
1 import VS
2 import custom
3 
4 class PlayerInfo:
5  def __init__(self):
6  self.myUnit = VS.getPlayer()
7  self.myTarget = VS.Unit()
8  self.sendingShipinfoRequest = False
9 
10 plr = None
11 
13  print 'running getTargetShipInfo'
14  newTarget = plr.myTarget
15  fg = newTarget.getFlightgroupName()
16  def targetResponse(args):
17  plr.sendingShipinfoRequest=False;
18  if (newTarget == plr.myUnit.GetTarget()):
19  VS.setTargetLabel('\n'.join(args))
20  else: # Our target changed... try again:
22  if fg and fg!='Base' and not plr.sendingShipinfoRequest:
23  custom.run("shipinfo",[fg],targetResponse)
24  plr.sendingShipinfoRequest=True
25 
26 def Execute():
27  global plr
28  if not VS.networked():
29  return
30  if not plr:
31  plr = PlayerInfo()
32  if VS.getPlayer() != plr.myUnit:
33  plr = PlayerInfo()
34  if not plr.myUnit:
35  return
36  if plr.myUnit.GetTarget() != plr.myTarget:
37  plr.myTarget = plr.myUnit.GetTarget()
38  print 'plr.myUnit.GetTarget() changed!'
40