Added basic Typeclass support to @tunnel
This commit is contained in:
parent
5a1f4aa320
commit
6d80c973da
2 changed files with 15 additions and 4 deletions
|
|
@ -866,7 +866,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
|
||||||
create new rooms in cardinal directions only
|
create new rooms in cardinal directions only
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@tunnel[/switch] <direction> [= <roomname>[;alias;alias;...][:typeclass]]
|
@tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]]
|
||||||
|
|
||||||
Switches:
|
Switches:
|
||||||
oneway - do not create an exit back to the current location
|
oneway - do not create an exit back to the current location
|
||||||
|
|
@ -911,21 +911,29 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
|
||||||
"""Implements the tunnel command"""
|
"""Implements the tunnel command"""
|
||||||
|
|
||||||
if not self.args or not self.lhs:
|
if not self.args or not self.lhs:
|
||||||
string = "Usage: @tunnel[/switch] <direction> [= <roomname>" \
|
string = "Usage: @tunnel[/switch] <direction>[:typeclass] [= <roomname>" \
|
||||||
"[;alias;alias;...][:typeclass]]"
|
"[;alias;alias;...][:typeclass]]"
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
return
|
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(
|
string = "@tunnel can only understand the following directions: %s." % ",".join(
|
||||||
sorted(self.directions.keys()))
|
sorted(self.directions.keys()))
|
||||||
string += "\n(use @dig for more freedom)"
|
string += "\n(use @dig for more freedom)"
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
return
|
return
|
||||||
|
|
||||||
# retrieve all input and parse it
|
# retrieve all input and parse it
|
||||||
exitshort = self.lhs
|
|
||||||
exitname, backshort = self.directions[exitshort]
|
exitname, backshort = self.directions[exitshort]
|
||||||
backname = self.directions[backshort][0]
|
backname = self.directions[backshort][0]
|
||||||
|
|
||||||
|
if ":" in self.lhs:
|
||||||
|
exit_typeclass = ":" + self.lhs.split(":")[-1]
|
||||||
|
exitshort += exit_typeclass
|
||||||
|
backshort += exit_typeclass
|
||||||
|
|
||||||
roomname = "Some place"
|
roomname = "Some place"
|
||||||
if self.rhs:
|
if self.rhs:
|
||||||
roomname = self.rhs # this may include aliases; that's fine.
|
roomname = self.rhs # this may include aliases; that's fine.
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,9 @@ class TestBuilding(CommandTest):
|
||||||
def test_tunnel(self):
|
def test_tunnel(self):
|
||||||
self.call(building.CmdTunnel(), "n = TestRoom2;test2", "Created room TestRoom2")
|
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):
|
def test_exit_commands(self):
|
||||||
self.call(building.CmdOpen(), "TestExit1=Room2", "Created new Exit 'TestExit1' from Room to Room2")
|
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).")
|
self.call(building.CmdLink(), "TestExit1=Room", "Link created TestExit1 > Room (one way).")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue