comparison gamestate.py @ 160:75c0b728ccf3

Further work on the scripting system.
author KarstenBock@gmx.net
date Sun, 13 Nov 2011 17:19:14 +0100
parents 824f3068ef2a
children 230d316cc43b
comparison
equal deleted inserted replaced
159:1b66e1ce226b 160:75c0b728ccf3
24 self.objects = {} 24 self.objects = {}
25 self.object_ids = {} 25 self.object_ids = {}
26 self.current_map_name = None 26 self.current_map_name = None
27 self.maps = {} 27 self.maps = {}
28 self.npcs_met = set() 28 self.npcs_met = set()
29 self.funcs = {
30 "meet":self.meet,
31 "met":self.met
32 }
29 33
30 34
31 def addObject(self, object_id, map_id, game_object): 35 def addObject(self, object_id, map_id, game_object):
32 """Adds an object to the objects and object_ids 36 """Adds an object to the objects and object_ids
33 dictionaries. 37 dictionaries.
66 def getObjectsFromMap(self, map_id): 70 def getObjectsFromMap(self, map_id):
67 """Gets all objects that are currently on the given map. 71 """Gets all objects that are currently on the given map.
68 @type map: String 72 @type map: String
69 @param map: The map name. 73 @param map: The map name.
70 @returns: The list of objects on this map. Or an empty list""" 74 @returns: The list of objects on this map. Or an empty list"""
75 return [i for i in self.getObjectDictOfMap(map_id).values()
76 if map_id in self.objects]
77
78
79 def getObjectDictOfMap(self, map_id):
71 if map_id in self.objects: 80 if map_id in self.objects:
72 return [i for i in self.objects[map_id].values() \ 81 return self.objects[map_id]
73 if map_id in self.objects]
74
75 return {} 82 return {}
76 83
77 def deleteObjectsFromMap(self, map_id): 84 def deleteObjectsFromMap(self, map_id):
78 """Deletes all objects of the given map. 85 """Deletes all objects of the given map.
79 @type map: String 86 @type map: String