예제 #1
0
 def make_way(self):  # over ride the floating objects make_way
     '''
     move in response to impelling forces:
     wind, current, and power
     '''
     # Could get wind and current here
     (wind, current) = get_weather(self.db.position)
     power = self.db.power
     sails = self.db.sails
     # polar = self.db.polar  # set by spawner?
     heading = float(self.db.heading)
     bearing = (heading, power)
     print "wind: %s" % str(wind)
     print "current: %s" % str(current)
     # then calculate actual course here.
     if sails:
         self.msg_contents("You're sailing")
         wind = (heading, wind[1] / 2)
         # this lets us sail at any wind angle at half windspeed
     else:
         '''
         if no sails, then wind exerts a fraction of its power
         on the floating object based on the vessel's windage
         '''
         wind = (wind[0], wind[1] * self.db.windage)
         # reduces wind effect to a fraction
     course = add_vector(wind, current)
     if power:
         print "power: %s" % str(power)
         print "bearing: %s" % str(bearing)
         course = add_vector(course, bearing)
         print "course: %s" % str(course)
     position = move_vector(self.db.position, course)
     self.arrive_at(position)
예제 #2
0
파일: vessel.py 프로젝트: j3b4/Mutiny
 def make_way(self):  # over ride the floating objects make_way
     """
     move in response to impelling forces:
     wind, current, and power
     """
     # Could get wind and current here
     (wind, current) = get_weather(self.db.position)
     power = self.db.power
     heading = float(self.db.heading)
     bearing = (heading, power)
     print "wind: %s" % str(wind)
     print "current: %s" % str(current)
     # then calculate actual course here.
     course = add_vector(wind, current)
     if power:
         print "power: %s" % str(power)
         print "bearing: %s" % str(bearing)
         course = add_vector(course, bearing)
         print "course: %s" % str(course)
     position = move_vector(self.db.position, course)
     self.arrive_at(position)
예제 #3
0
파일: vessel.py 프로젝트: j3b4/Mutiny
 def make_way(self):
     """
     move in response to impelling forces:
     wind, current, and power
     on a bare floating object this is purely based on wind and current
     a floater doesn't have a heading and never has power.
     """
     # Could get wind and current here
     (wind, current) = get_weather(self.db.position)
     print "wind: %s" % str(wind)
     print "current: %s" % str(current)
     # then calculate actual course here.
     course = add_vector(wind, current)
     position = move_vector(self.db.position, course)
     self.arrive_at(position)
예제 #4
0
 def make_way(self):
     '''
     move in response to impelling forces:
     wind, current, and power
     on a bare floating object this is purely based on wind and current
     a floater doesn't have a heading and never has power.
     '''
     # Could get wind and current here
     (wind, current) = get_weather(self.db.position)
     print "wind: %s" % str(wind)
     print "current: %s" % str(current)
     # then calculate actual course here.
     wind[1] = wind[1] * self.windage  # reduces wind effect to a fraction
     course = add_vector(wind, current)
     position = move_vector(self.db.position, course)
     self.arrive_at(position)