Skip to content

Commit

Permalink
Merge pull request #95 from twisted/94.go-closed
Browse files Browse the repository at this point in the history
handle `Closed` in Go
  • Loading branch information
mithrandi committed Nov 15, 2020
2 parents 8720b02 + e8ebf04 commit e47ed95
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/imaginary/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,13 @@ def do(self, player, line, direction):
actor=player,
actorMessage=language.ExpressString(
u"There's no room for you there.")))
except eimaginary.Closed:
raise eimaginary.ActionFailure(events.ThatDoesntWork(
actor=player,
actorMessage=language.ExpressString(
u"The way is shut.",
),
))

# This is subtly incorrect: see http://divmod.org/trac/ticket/2917
lookAroundActor = iimaginary.IActor(player)
Expand Down
15 changes: 15 additions & 0 deletions src/imaginary/test/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,21 @@ def test_directionalMovement(self):
""])


def test_goClosed(self):
"""
You cannot move through an exit to a "closed" location.
"""
unreachable = objects.Thing(store=self.store, name=u"unreachable")
objects.Container.createFor(unreachable, capacity=1000, closed=True)
objects.Exit.link(self.location, unreachable, u"west")

self._test(
"west",
["The way is shut."],
[],
)


def test_scrutinize(self):
"""
The scrutinize action takes a thing as a target and displays a lot of
Expand Down

0 comments on commit e47ed95

Please sign in to comment.