diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 571c134b30..78209f9b61 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -866,7 +866,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS): create new rooms in cardinal directions only Usage: - @tunnel[/switch] [= [;alias;alias;...][:typeclass]] + @tunnel[/switch] [:typeclass] [= [;alias;alias;...][:typeclass]] Switches: oneway - do not create an exit back to the current location @@ -911,21 +911,29 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS): """Implements the tunnel command""" if not self.args or not self.lhs: - string = "Usage: @tunnel[/switch] [= " \ + string = "Usage: @tunnel[/switch] [:typeclass] [= " \ "[;alias;alias;...][:typeclass]]" self.caller.msg(string) return - if self.lhs not in self.directions: + + exitshort = self.lhs.split(":")[0] + + if exitshort not in self.directions: string = "@tunnel can only understand the following directions: %s." % ",".join( sorted(self.directions.keys())) string += "\n(use @dig for more freedom)" self.caller.msg(string) return + # retrieve all input and parse it - exitshort = self.lhs exitname, backshort = self.directions[exitshort] backname = self.directions[backshort][0] + if ":" in self.lhs: + exit_typeclass = ":" + self.lhs.split(":")[-1] + exitshort += exit_typeclass + backshort += exit_typeclass + roomname = "Some place" if self.rhs: roomname = self.rhs # this may include aliases; that's fine. diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index c68d17c758..20eb3bacae 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -266,6 +266,9 @@ class TestBuilding(CommandTest): def test_tunnel(self): self.call(building.CmdTunnel(), "n = TestRoom2;test2", "Created room TestRoom2") + def test_tunnel_exit_typeclass(self): + self.call(building.CmdTunnel(), "n:evennia.objects.objects.DefaultExit = TestRoom3", "Created room TestRoom3") + def test_exit_commands(self): self.call(building.CmdOpen(), "TestExit1=Room2", "Created new Exit 'TestExit1' from Room to Room2") self.call(building.CmdLink(), "TestExit1=Room", "Link created TestExit1 > Room (one way).")