def AsteroidNear (self,uni, how):
     i = VS.getUnitList()
     dd = self.cur.detection_distance
     while i.notDone():
         un = i.current()            
         if (uni.getSignificantDistance(un)<how):
             if (unit.isAsteroid (un)):
                 debug.debug("asty near")
                 return 1
         i.advance()
     return 0
Beispiel #2
0
 def AsteroidNear(self, uni, how):
     debug.debug("i = VS.getUnitList()")
     i = VS.getUnitList()
     dd = self.cur.detection_distance
     while (not i.isDone()):
         #debug.debug("next(i)")
         un = next(i)
         if un.isNull():  # ignore it
             continue
         if (uni.getSignificantDistance(un) < how):
             if (unit.isAsteroid(un)):
                 debug.debug("asteroid near")
                 return 1
     return 0
 def AsteroidNear (self,uni, how):
     num_ships=0
     count=0
     un = VS.getUnit (count)
     while (un):
         dd = self.cur.detection_distance
         if (uni.getSignificantDistance(un)<how):
             if (unit.isAsteroid (un)):
                 print "asty near"
                 return 1
         count=count+1
         if (un):
             un = VS.getUnit(count)
     return 0