-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the login/register commands out of core and into a module.
- Loading branch information
Showing
5 changed files
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from spacegame.core import echo, handler, login | ||
from spacegame.core import echo, handler | ||
|
||
|
||
def init(): | ||
echo.init() | ||
handler.init() | ||
login.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
from pantsmud.driver import command, message | ||
|
||
|
||
class LoginCommandManager(command.CommandManager): | ||
def input_handler(self, brain, line): | ||
if not brain.is_user: | ||
logging.error("Brain '%s' has login input handler but it is not a user.", str(brain.uuid)) | ||
message.command_internal_error(brain) | ||
return | ||
if brain.mobile: | ||
logging.error("Brain '%s' has login input handler it already has a player '%s'.", | ||
str(brain.uuid), str(brain.mobile.uuid)) | ||
message.command_internal_error(brain) | ||
return | ||
return command.CommandManager.input_handler(self, brain, line) | ||
|
||
|
||
_login_command_manager = LoginCommandManager(__name__) | ||
add_command = _login_command_manager.add | ||
command_exists = _login_command_manager.exists | ||
login_input_handler = _login_command_manager.input_handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from spacegame.modules import chat | ||
from spacegame.modules import chat, login | ||
|
||
|
||
def init(): | ||
chat.init() | ||
login.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters