# HG changeset patch # User KarstenBock@gmx.net # Date 1315576063 -7200 # Node ID d4f213b99d41a7cc1518512ca5bc494762742d79 # Parent ba85e5aff37089dfe0351544017cca16516693ea Added meet and met methods from the old player object to the gamestate. diff -r ba85e5aff370 -r d4f213b99d41 gamestate.py --- a/gamestate.py Fri Sep 09 15:30:23 2011 +0200 +++ b/gamestate.py Fri Sep 09 15:47:43 2011 +0200 @@ -25,6 +25,7 @@ self.object_ids = {} self.current_map_name = None self.maps = {} + self.npcs_met = set() def addObject(self, map_id, game_object): @@ -121,4 +122,20 @@ self.current_map_name = state["CurrentMap"] self.quest_engine.readQuests() self.quest_engine.restoreFromState(state["Quests"]) - + + def meet(self, npc): + """Record that the PC has met a certain NPC + @type npc: str + @param npc: The NPC's name or id""" + if npc in self.npcs_met: + # we could raise an error here, but should probably be a warn + # raise RuntimeError("I already know %s" % npc) + return + self.npcs_met.add(npc) + + def met(self, npc): + """Indicate whether the PC has met this npc before + @type npc: str + @param npc: The NPC's name or id + @return: None""" + return npc in self.npcs_met