Пример #1
0
 def footstepnoise(self):
     # assert: "only immobile objects must be taken into account"
     result = style.get(self.type_name, "move")
     if self.airground_type == "ground" and self._terrain_footstep():
         return self._terrain_footstep()
     elif self.airground_type == "ground" and len(self.place.objects) < 30: # save CPU
         d_min = 9999999
         for m in self.place.objects:
             if getattr(m, "speed", 0):
                 continue
             g = style.get(m.type_name, "ground")
             if g and style.has(self.type_name, "move_on_%s" % g[0]):
                 try:
                     k = float(g[1])
                 except IndexError:
                     k = 1.0
                 try:
                     o = self.interface.dobjets[m.id]
                 except KeyError: # probably caused by the world client updates
                     continue
                 try:
                     d = distance(o.x, o.y, self.x, self.y) / k
                 except ZeroDivisionError:
                     continue
                 if d < d_min:
                     result = style.get(self.type_name, "move_on_%s" % g[0])
                     d_min = d
     return result
Пример #2
0
 def footstepnoise(self):
     # assert: "only immobile objects must be taken into account"
     result = style.get(self.type_name, "move")
     if self.airground_type == "ground":
         d_min = 9999999
         for m in self.place.objects:
             if getattr(m, "speed", 0):
                 continue
             g = style.get(m.type_name, "ground")
             if g and style.has(self.type_name, "move_on_%s" % g[0]):
                 try:
                     k = float(g[1])
                 except IndexError:
                     k = 1.0
                 try:
                     o = self.interface.dobjets[m.id]
                 except KeyError: # probably caused by the world client updates
                     continue
                 d = distance(o.x, o.y, self.x, self.y) / k
                 if d < d_min:
                     result = style.get(self.type_name, "move_on_%s" % g[0])
                     d_min = d
     return result
Пример #3
0
 def is_an_exit(self):
     return style.has(self.model.type_name, "when_moving_through")
Пример #4
0
 def _terrain_footstep(self):
     t = self.place.type_name
     if t:
         g = style.get(t, "ground")
         if g and style.has(self.type_name, "move_on_%s" % g[0]):
             return style.get(self.type_name, "move_on_%s" % g[0])
Пример #5
0
 def is_an_exit(self):
     return style.has(self.model.type_name, "when_moving_through")
Пример #6
0
def _has_ord_index(keyword):
    return style.has(keyword, "index")
Пример #7
0
def _has_ord_index(keyword):
    return style.has(keyword, "index")