diff 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
line wrap: on
line diff
--- a/gamestate.py	Sun Nov 13 13:37:24 2011 +0100
+++ b/gamestate.py	Sun Nov 13 17:19:14 2011 +0100
@@ -26,6 +26,10 @@
         self.current_map_name = None
         self.maps = {}
         self.npcs_met = set()
+        self.funcs = {
+            "meet":self.meet,
+            "met":self.met
+        }
         
         
     def addObject(self, object_id, map_id, game_object):
@@ -68,10 +72,13 @@
            @type map: String
            @param map: The map name.
            @returns: The list of objects on this map. Or an empty list"""
+        return [i for i in self.getObjectDictOfMap(map_id).values()
+                                    if map_id in self.objects]
+    
+    
+    def getObjectDictOfMap(self, map_id):
         if map_id in self.objects:
-            return [i for i in self.objects[map_id].values() \
-                                        if map_id in self.objects]
-        
+            return self.objects[map_id]
         return {}
     
     def deleteObjectsFromMap(self, map_id):
@@ -157,4 +164,4 @@
            @type npc: str
            @param npc: The NPC's name or id
            @return: None"""
-        return npc in self.npcs_met
+        return npc in self.npcs_met
\ No newline at end of file