diff --git a/evennia/contrib/puzzles.py b/evennia/contrib/puzzles.py index 9db9fa356a..a44329d40a 100644 --- a/evennia/contrib/puzzles.py +++ b/evennia/contrib/puzzles.py @@ -501,11 +501,6 @@ class CmdUsePuzzleParts(MuxCommand): use ] """ - # TODO: consider allowing builder to provide - # messages and "hooks" that can be displayed - # and/or fired whenever the resolver of the puzzle - # enters the location where a result was spawned - key = 'use' aliases = 'combine' locks = 'cmd:pperm(use) or pperm(Player)' @@ -597,7 +592,7 @@ class CmdUsePuzzleParts(MuxCommand): matched_puzzles[puzzle.dbref] = matched_dbrefparts if len(matched_puzzles) == 0: - # TODO: we could use part.fail_message instead, if any + # TODO: we could use part.fail_message instead, if there was one # random part falls and lands on your feet # random part hits you square on the face caller.msg(_PUZZLE_DEFAULT_FAIL_USE_MESSAGE % (many)) @@ -613,13 +608,15 @@ class CmdUsePuzzleParts(MuxCommand): puzzle = puzzles_dict[puzzledbref] largest_puzzles = list(itertools.takewhile(lambda t: len(t[1]) == nparts, puzzletuples)) - # if there are more than one, ... + # if there are more than one, choose one at random. + # we could show the names of all those that can be resolved + # but that would give away that there are other puzzles that + # can be resolved with the same parts. + # just hint how many. if len(largest_puzzles) > 1: - # TODO: pick a random one or let user choose? - # TODO: do we show the puzzle name or something else? caller.msg( - 'Your gears start turning and a bunch of ideas come to your mind ...\n%s' % ( - ' ...\n'.join([puzzles_dict[lp[0]].db.puzzle_name for lp in largest_puzzles])) + 'Your gears start turning and %d different ideas come to your mind ...\n' + % (len(largest_puzzles)) ) puzzletuple = choice(largest_puzzles) puzzle = puzzles_dict[puzzletuple[0]] @@ -632,10 +629,6 @@ class CmdUsePuzzleParts(MuxCommand): result.tags.add(puzzle.db.puzzle_name, category=_PUZZLES_TAG_CATEGORY) result.db.puzzle_name = puzzle.db.puzzle_name result_names.append(result.name) - # TODO: add 'ramdon' messages: - # Hmmm ... did I search result.location? - # What was that? ... I heard something in result.location? - # Eureka! you built a result # Destroy all parts used for dbref in matched_dbrefparts: diff --git a/evennia/contrib/tests.py b/evennia/contrib/tests.py index 3912bd2dab..71236a14df 100644 --- a/evennia/contrib/tests.py +++ b/evennia/contrib/tests.py @@ -1977,7 +1977,7 @@ class TestPuzzles(CommandTest): # only one is. self._use( '1-stone, 2-flint, 3-stone, 3-flint', - 'Your gears start turning and a bunch of ideas come to your mind ... ') + 'Your gears start turning and 2 different ideas come to your mind ... ') self._check_room_contents({'stone': 2, 'flint': 2, 'fire': 2}, check_test_tags=True) self.room1.msg_contents = Mock() @@ -2282,7 +2282,7 @@ class TestPuzzles(CommandTest): parts = ['Balloon'] results = ['Balloon'] # FIXME: we don't want results recipe_dbref = self._good_recipe( - 'Boom!!!', + 'boom!!!', # FIXME: uppercase name fails parts, results, and_destroy_it=False, expected_count=3 @@ -2293,7 +2293,7 @@ class TestPuzzles(CommandTest): sps = sorted(parts) expected = {key: len(list(grp)) for key, grp in itertools.groupby(sps)} - self._arm(recipe_dbref, 'Boom!!!', parts) + self._arm(recipe_dbref, 'boom!!!', parts) self._check_room_contents(expected) self._use(','.join(parts), 'You are a Genius')