Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1.     #add static entityties to the list, these entities will always will be in the list
  2.         if newList.find(x) == -1:
  3.  
  4.             if x.is_in_group("stations") or x.is_in_group("asteroidField") or x.is_in_group("missionSite"):
  5.                 newList.append(x)
  6.                 go = target_col.instance()
  7.                 listParent.add_child(go)
  8.                 go.get_node("Sprite").set_texture(icon)
  9.                 go.get_node("Sprite").set_scale(Vector2(0.5, 0.5))
  10.                 go.get_node("Name").set_text(str(x.name))
  11.  
  12.                 go.set_name("Entity " + x.name)
  13.                 var y = -35 + (35 * newList.size())
  14.                 #go.set_pos(Vector2(0, y))
  15.                 listParent.set_custom_minimum_size(Vector2(0, y + 25))
  16.                
  17.                 go.connect("mouse_enter", self, "_m_enter", [x])
  18.                 go.connect("mouse_exit", self, "_m_exit", [x])
  19.                
  20.         #display distance on list buttons
  21.         for n in range(newList.size()):
  22.             if listParent.get_child_count() > 0:
  23.                 if newList.find(x) == n:
  24.                    
  25.                     listParent.get_child(n).get_node("Dist").set_text(str(newD))
  26.                     newList.sort_custom(self, "sort_dist")
  27.                    
  28.  
  29. func sort_dist(node_a, node_b):
  30.     return pplPos.distance_squared_to(node_a.get_global_transform().origin) < pplPos.distance_squared_to(node_b.get_global_transform().origin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement