Skip to content

Instantly share code, notes, and snippets.

@whutch whutch/testgame.py
Created Jan 26, 2016

Embed
What would you like to do?
Test game module for Atria
# -*- coding: utf-8 -*-
"""A test game for prototyping."""
# Part of Atria MUD Server (https://github.com/whutch/atria)
# :copyright: (c) 2008 - 2016 Will Hutcheson
# :license: MIT (https://github.com/whutch/atria/blob/master/LICENSE.txt)
import re
from .. import settings
from ..core.accounts import Account, AccountMenu, AccountName
from ..core.events import EVENTS
settings.IDLE_TIME_MAX = 0 # Temporary
# Adjust the validation pattern for account names
AccountName._valid_chars = re.compile(".+")
# We don't need the default connect menu.
EVENTS.unhook("session_started")
@EVENTS.hook("session_started")
def _hook_session_started(session):
email = "{}@test.game".format(session.address)
account = Account.load(email, default=None)
if not account:
account = Account()
account.email = email
account.name = session.address
account.options.color = True
session.account = account
session.menu = AccountMenu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.