mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
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 the Portal uptime to the `@time` command.
|
||||
- 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
|
||||
|
||||
|
|
|
|||
|
|
@ -234,9 +234,14 @@ class CmdUnconnectedLook(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
def func(self):
|
||||
"""Show the connect screen."""
|
||||
connection_screen = utils.random_string_from_module(CONNECTION_SCREEN_MODULE)
|
||||
if not connection_screen:
|
||||
connection_screen = "No connection screen found. Please contact an admin."
|
||||
|
||||
callables = utils.callables_from_module(CONNECTION_SCREEN_MODULE)
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
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
|
||||
at the "outermost" scope of this module and use it as the
|
||||
connection screen. If there are more than one, Evennia will
|
||||
randomize which one it displays.
|
||||
To change the login screen in this module, do one of the following:
|
||||
|
||||
- Define a function `connection_screen()`, taking no arguments. This will be
|
||||
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
|
||||
are defined in commands.default_cmdsets. UnloggedinCmdSet and the
|
||||
screen is read and displayed by the unlogged-in "look" command.
|
||||
are defined in evennia.default_cmds.UnloggedinCmdSet. The parsing and display
|
||||
of the screen is done by the unlogged-in "look" command.
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue