mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
suggested refactor
Extract into a separate variable (note), then % interpolate it.
This commit is contained in:
parent
53943ab1e8
commit
2dd322e721
1 changed files with 3 additions and 4 deletions
|
|
@ -954,9 +954,9 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
|
|||
return
|
||||
|
||||
string = ""
|
||||
note = "Note: %s(%s) did not have a destination set before. Make sure you linked the right thing."
|
||||
if not obj.destination:
|
||||
string += "Note: %s(%s) did not have a destination set before." \
|
||||
" Make sure you linked the right thing." % (obj.name, obj.dbref)
|
||||
string = note % (obj.name, obj.dbref)
|
||||
if "twoway" in self.switches:
|
||||
if not (target.location and obj.location):
|
||||
string = "To create a two-way link, %s and %s must both have a location" % (obj, target)
|
||||
|
|
@ -964,8 +964,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
|
|||
self.caller.msg(string)
|
||||
return
|
||||
if not target.destination:
|
||||
string += "\nNote: %s(%s) did not have a destination set before." \
|
||||
" Make sure you linked the right thing." % (target.name, target.dbref)
|
||||
string += note % (target.name, target.dbref)
|
||||
obj.destination = target.location
|
||||
target.destination = obj.location
|
||||
string += "\nLink created %s (in %s) <-> %s (in %s) (two-way)." %\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue