Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
InSystemCondition Class Reference
Inheritance diagram for InSystemCondition:
Condition

Public Member Functions

def __init__
 
def __call__
 
- Public Member Functions inherited from Condition
def __init__
 
def __call__
 

Data Fields

 system
 
 dockedshipname
 

Detailed Description

Definition at line 55 of file campaign_lib.py.

Constructor & Destructor Documentation

def __init__ (   self,
  system,
  shipname = None 
)

Definition at line 56 of file campaign_lib.py.

56 
57  def __init__(self,system,shipname=None):
58  Condition.__init__(self)
59  self.system=None
60  if system:
61  if len(system):
62  self.system=system.lower().replace(' ','_').split('/')
63  self.dockedshipname=None
64  if shipname:
65  self.dockedshipname=shipname.replace(' ','_').lower()

Member Function Documentation

def __call__ (   self)

Definition at line 66 of file campaign_lib.py.

References debug.debug, InSystemCondition.dockedshipname, debug.info, string.lower(), sre_parse.min, pydoc.replace(), dospath.split(), locale.str(), and InSystemCondition.system.

66 
67  def __call__(self):
68  if self.system:
69  sys=VS.getSystemFile().split('/')
70  debug.debug('System: '+str(sys)+'==?=='+str(self.system))
71  for i in range(-1,-min(len(self.system),len(sys))-1,-1):
72  if sys[i].lower()!=self.system[i]:
73  debug.debug(str(sys[i])+'!='+str(self.system[i]))
74  debug.debug('*** insystem return false: not in system!!')
75  return False
76  if self.dockedshipname:
77  if type(self.dockedshipname)==str:
78  debug.debug('*** Test if docked to: '+ self.dockedshipname)
79  iter = VS.getUnitList()
80  while iter.notDone():
81  if VS.getPlayer().isDocked(iter.current()) or iter.current().isDocked(VS.getPlayer()):
82  #Not sure why both have to be checked, it seems to second gives a more consistantly correct response
83  #find unit with name and check
84  debug.info('*** Compare '+iter.current().getName().replace(' ','_').lower()+" == "+self.dockedshipname)
85  debug.info(' Compare '+iter.current().getFullname().replace(' ','_').lower()+" == "+self.dockedshipname)
86  if iter.current().getName().replace(' ','_').lower() == self.dockedshipname or iter.current().getFullname().replace(' ','_').lower() == self.dockedshipname:
87  debug.debug('*** inSystem return true')
88  return True
89  else:
90  debug.info(iter.current().getName()+' not docked to unit')
91  iter.advance()
92  else:
93  debug.debug('*** inSystem return true, no self.dockedshipname')
94  return True
95  debug.debug('*** insystem return false!!')
96  return False
97 fixerloaded=0

Field Documentation

dockedshipname

Definition at line 62 of file campaign_lib.py.

system

Definition at line 58 of file campaign_lib.py.


The documentation for this class was generated from the following file: