Skip to content

Instantly share code, notes, and snippets.

@whutch
Created January 26, 2016 19:19
Show Gist options
  • Save whutch/d802ea7eba86ca136592 to your computer and use it in GitHub Desktop.
Save whutch/d802ea7eba86ca136592 to your computer and use it in GitHub Desktop.
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