mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Finished moving stuff around, things should be in mostly working order now.
This commit is contained in:
parent
fd264667b8
commit
a954069776
11 changed files with 27 additions and 28 deletions
|
|
@ -9,9 +9,9 @@ import time
|
|||
from apps.objects.models import Object
|
||||
import defines_global
|
||||
import cmdtable
|
||||
import functions_general
|
||||
from src import logger
|
||||
from src import comsys
|
||||
import logger
|
||||
import comsys
|
||||
from util import functions_general
|
||||
|
||||
class UnknownCommand(Exception):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import time
|
|||
|
||||
from django.conf import settings
|
||||
|
||||
import functions_general
|
||||
import src.comsys
|
||||
from src import defines_global
|
||||
from src import ansi
|
||||
from src.util import functions_general
|
||||
|
||||
def cmd_addcom(cdat):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from django.conf import settings
|
|||
from apps.config.models import ConfigValue
|
||||
from apps.helpsys.models import HelpEntry
|
||||
from apps.objects.models import Object
|
||||
import functions_general
|
||||
from src import defines_global
|
||||
from src import session_mgr
|
||||
from src import ansi
|
||||
from src.util import functions_general
|
||||
|
||||
def cmd_password(cdat):
|
||||
"""
|
||||
|
|
@ -71,7 +71,7 @@ def cmd_wall(cdat):
|
|||
return
|
||||
|
||||
message = "%s shouts \"%s\"" % (session.get_pobject().get_name(show_dbref=False), wallstring)
|
||||
functions_general.announce_all(message)
|
||||
session_mgr.announce_all(message)
|
||||
|
||||
def cmd_idle(cdat):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ the server instance.
|
|||
import os
|
||||
import time
|
||||
|
||||
import functions_general
|
||||
from src.util import functions_general
|
||||
|
||||
if not functions_general.host_os_is('nt'):
|
||||
# Don't import the resource module if the host OS is Windows.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ are generally @-prefixed commands, but there are exceptions.
|
|||
"""
|
||||
from apps.objects.models import Object
|
||||
from src import defines_global
|
||||
import functions_general
|
||||
from src import ansi
|
||||
from src.util import functions_general
|
||||
|
||||
def cmd_reload(cdat):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ Commands that are available from the connect screen.
|
|||
from django.contrib.auth.models import User
|
||||
|
||||
from apps.objects.models import Attribute, Object
|
||||
import functions_general
|
||||
from src import defines_global
|
||||
from src.util import functions_general
|
||||
|
||||
def cmd_connect(cdat):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import sys
|
|||
|
||||
from twisted.application import internet, service
|
||||
from twisted.internet import protocol, reactor, defer
|
||||
from twisted.python import log
|
||||
|
||||
from django.db import models
|
||||
from django.db import connection
|
||||
|
|
@ -13,10 +12,11 @@ from django.conf import settings
|
|||
from apps.config.models import CommandAlias, ConfigValue
|
||||
from src.session import SessionProtocol
|
||||
from src import scheduler
|
||||
import functions_general
|
||||
from src import logger
|
||||
from src import session_mgr
|
||||
from src import cmdtable
|
||||
from src import initial_setup
|
||||
from src.util import functions_general
|
||||
|
||||
class EvenniaService(service.Service):
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class EvenniaService(service.Service):
|
|||
BEGIN GENERAL METHODS
|
||||
"""
|
||||
def shutdown(self, message='The server has been shutdown. Please check back soon.'):
|
||||
functions_general.announce_all(message)
|
||||
session_mgr.announce_all(message)
|
||||
session_mgr.disconnect_all_sessions()
|
||||
reactor.callLater(0, reactor.stop)
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ class EvenniaService(service.Service):
|
|||
reload(sys.modules[mod])
|
||||
|
||||
session.msg("Modules reloaded.")
|
||||
functions_general.log_infomsg("Modules reloaded by %s." % (session,))
|
||||
logger.log_infomsg("Modules reloaded by %s." % (session,))
|
||||
|
||||
def getEvenniaServiceFactory(self):
|
||||
f = protocol.ServerFactory()
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ from django.contrib.auth.models import User
|
|||
from apps.objects.models import Object
|
||||
from apps.config.models import ConnectScreen, ConfigValue
|
||||
import cmdhandler
|
||||
import functions_general
|
||||
import logger
|
||||
import session_mgr
|
||||
import ansi
|
||||
from util import functions_general
|
||||
|
||||
class SessionProtocol(StatefulTelnetProtocol):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ Session manager, handles connected players.
|
|||
import time
|
||||
|
||||
from apps.config.models import ConfigValue
|
||||
import functions_general
|
||||
from src import logger
|
||||
from src.util import functions_general
|
||||
|
||||
# Our list of connected sessions.
|
||||
session_list = []
|
||||
|
|
@ -102,3 +102,15 @@ def session_from_dbref(dbstring):
|
|||
return results[0]
|
||||
else:
|
||||
return False
|
||||
|
||||
def announce_all(message, with_ann_prefix=True):
|
||||
"""
|
||||
Announces something to all connected players.
|
||||
"""
|
||||
if with_ann_prefix:
|
||||
prefix = 'Announcement:'
|
||||
else:
|
||||
prefix = ''
|
||||
|
||||
for session in get_session_list():
|
||||
session.msg('%s %s' % (prefix, message))
|
||||
|
|
|
|||
0
src/util/__init__.py
Normal file
0
src/util/__init__.py
Normal file
|
|
@ -3,7 +3,6 @@ General functions that don't fit neatly under any given category.
|
|||
"""
|
||||
import os
|
||||
import textwrap
|
||||
from src import session_mgr
|
||||
|
||||
def wildcard_to_regexp(instring):
|
||||
"""
|
||||
|
|
@ -99,18 +98,6 @@ def time_format(seconds, style=0):
|
|||
retval = '%s%s%s%s' % (days_str, hours_str, minutes_str, seconds_str,)
|
||||
return retval
|
||||
|
||||
def announce_all(message, with_ann_prefix=True):
|
||||
"""
|
||||
Announces something to all connected players.
|
||||
"""
|
||||
if with_ann_prefix:
|
||||
prefix = 'Announcement:'
|
||||
else:
|
||||
prefix = ''
|
||||
|
||||
for session in session_mgr.get_session_list():
|
||||
session.msg('%s %s' % (prefix, message))
|
||||
|
||||
def word_wrap(text, width=78):
|
||||
"""
|
||||
Wrap text to a certain number of characters.
|
||||
Loading…
Add table
Add a link
Reference in a new issue