Added basic Typeclass support to @tunnel

This commit is contained in:
Nicholas Matlaga 2017-09-19 16:52:24 -04:00
parent 5a1f4aa320
commit 6d80c973da
2 changed files with 15 additions and 4 deletions

View file

@ -866,7 +866,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
create new rooms in cardinal directions only
Usage:
@tunnel[/switch] <direction> [= <roomname>[;alias;alias;...][:typeclass]]
@tunnel[/switch] <direction>[:typeclass] [= <roomname>[;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] <direction> [= <roomname>" \
string = "Usage: @tunnel[/switch] <direction>[:typeclass] [= <roomname>" \
"[;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.