Optionally read connection screen from connection_screen() callable
This commit is contained in:
parent
1d0d6bc7cf
commit
c4d178c6c7
3 changed files with 24 additions and 11 deletions
|
|
@ -14,6 +14,9 @@ Update to Python 3
|
||||||
- Add new `@force` command to have another object perform a command.
|
- Add new `@force` command to have another object perform a command.
|
||||||
- Add the Portal uptime to the `@time` command.
|
- Add the Portal uptime to the `@time` command.
|
||||||
- Make the `@link` command first make a local search before a global search.
|
- Make the `@link` command first make a local search before a global search.
|
||||||
|
- Have the default Unloggedin-look command look for optional `connection_screen()` callable in
|
||||||
|
`mygame/server/conf/connection_screen.py`. This allows for more flexible welcome screens
|
||||||
|
that are calculated on the fly.
|
||||||
|
|
||||||
### Web
|
### Web
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,14 @@ class CmdUnconnectedLook(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Show the connect screen."""
|
"""Show the connect screen."""
|
||||||
connection_screen = utils.random_string_from_module(CONNECTION_SCREEN_MODULE)
|
|
||||||
if not connection_screen:
|
callables = utils.callables_from_module(CONNECTION_SCREEN_MODULE)
|
||||||
connection_screen = "No connection screen found. Please contact an admin."
|
if "connection_screen" in callables:
|
||||||
|
connection_screen = callables['connection_screen']()
|
||||||
|
else:
|
||||||
|
connection_screen = utils.random_string_from_module(CONNECTION_SCREEN_MODULE)
|
||||||
|
if not connection_screen:
|
||||||
|
connection_screen = "No connection screen found. Please contact an admin."
|
||||||
self.caller.msg(connection_screen)
|
self.caller.msg(connection_screen)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,21 @@
|
||||||
"""
|
"""
|
||||||
Connection screen
|
Connection screen
|
||||||
|
|
||||||
Texts in this module will be shown to the user at login-time.
|
This is the text to show the user when they first connect to the game (before
|
||||||
|
they log in).
|
||||||
|
|
||||||
Evennia will look at global string variables (variables defined
|
To change the login screen in this module, do one of the following:
|
||||||
at the "outermost" scope of this module and use it as the
|
|
||||||
connection screen. If there are more than one, Evennia will
|
- Define a function `connection_screen()`, taking no arguments. This will be
|
||||||
randomize which one it displays.
|
called first and must return the full string to act as the connection screen.
|
||||||
|
This can be used to produce more dynamic screens.
|
||||||
|
- Alternatively, define a string variable in the outermost scope of this module
|
||||||
|
with the connection string that should be displayed. If more than one such
|
||||||
|
variable is given, Evennia will pick one of them at random.
|
||||||
|
|
||||||
The commands available to the user when the connection screen is shown
|
The commands available to the user when the connection screen is shown
|
||||||
are defined in commands.default_cmdsets. UnloggedinCmdSet and the
|
are defined in evennia.default_cmds.UnloggedinCmdSet. The parsing and display
|
||||||
screen is read and displayed by the unlogged-in "look" command.
|
of the screen is done by the unlogged-in "look" command.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue