comparison gamestate.py @ 58:d4f213b99d41

Added meet and met methods from the old player object to the gamestate.
author KarstenBock@gmx.net
date Fri, 09 Sep 2011 15:47:43 +0200
parents 98f26f7636d8
children 5c751b9a3d8b
comparison
equal deleted inserted replaced
57:ba85e5aff370 58:d4f213b99d41
23 self.quest_engine.readQuests() 23 self.quest_engine.readQuests()
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 29
29 30
30 def addObject(self, map_id, game_object): 31 def addObject(self, map_id, game_object):
31 """Adds an object to the objects and object_ids 32 """Adds an object to the objects and object_ids
32 dictionaries. 33 dictionaries.
119 def restoreFromState(self, state): 120 def restoreFromState(self, state):
120 """Restores the state""" 121 """Restores the state"""
121 self.current_map_name = state["CurrentMap"] 122 self.current_map_name = state["CurrentMap"]
122 self.quest_engine.readQuests() 123 self.quest_engine.readQuests()
123 self.quest_engine.restoreFromState(state["Quests"]) 124 self.quest_engine.restoreFromState(state["Quests"])
124 125
126 def meet(self, npc):
127 """Record that the PC has met a certain NPC
128 @type npc: str
129 @param npc: The NPC's name or id"""
130 if npc in self.npcs_met:
131 # we could raise an error here, but should probably be a warn
132 # raise RuntimeError("I already know %s" % npc)
133 return
134 self.npcs_met.add(npc)
135
136 def met(self, npc):
137 """Indicate whether the PC has met this npc before
138 @type npc: str
139 @param npc: The NPC's name or id
140 @return: None"""
141 return npc in self.npcs_met