Some cleanups.

This commit is contained in:
Griatch 2015-03-09 11:42:01 +01:00
parent 972b5cd2e2
commit 60163184ad
2 changed files with 10 additions and 12 deletions

View file

@ -1,5 +1,5 @@
""" """
This module contains the base Script class that all This module contains the base DefaultScript class that all
scripts are inheriting from. scripts are inheriting from.
It also defines a few common scripts. It also defines a few common scripts.
@ -7,12 +7,10 @@ It also defines a few common scripts.
from twisted.internet.defer import Deferred, maybeDeferred from twisted.internet.defer import Deferred, maybeDeferred
from twisted.internet.task import LoopingCall from twisted.internet.task import LoopingCall
from django.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from evennia.typeclasses.models import TypeclassBase from evennia.typeclasses.models import TypeclassBase
from evennia.scripts.models import ScriptDB from evennia.scripts.models import ScriptDB
from evennia.scripts.manager import ScriptManager from evennia.scripts.manager import ScriptManager
from evennia.comms import channelhandler
from evennia.utils import logger from evennia.utils import logger
__all__ = ["DefaultScript", "DoNothing", "Store"] __all__ = ["DefaultScript", "DoNothing", "Store"]
@ -112,7 +110,7 @@ class ExtendedLoopingCall(LoopingCall):
class ScriptBase(ScriptDB): class ScriptBase(ScriptDB):
""" """
Base class for scripts. Don't inherit from this, inherit Base class for scripts. Don't inherit from this, inherit
from the class `Script` instead. from the class `DefaultScript` below instead.
""" """
__metaclass__ = TypeclassBase __metaclass__ = TypeclassBase
objects = ScriptManager() objects = ScriptManager()
@ -280,7 +278,7 @@ class ScriptBase(ScriptDB):
def pause(self): def pause(self):
""" """
This stops a running script and stores its active state. This stops a running script and stores its active state.
It WILL NOT call that `at_stop()` hook. It WILL NOT call the `at_stop()` hook.
""" """
if not self.db._paused_time: if not self.db._paused_time:
# only allow pause if not already paused # only allow pause if not already paused
@ -348,9 +346,9 @@ class ScriptBase(ScriptDB):
class DefaultScript(ScriptBase): class DefaultScript(ScriptBase):
""" """
This is the base TypeClass for all Scripts. Scripts describe events, This is the base TypeClass for all Scripts. Scripts describe
timers and states in game, they can have a time component or describe events, timers and states in game, they can have a time component
a state that changes under certain conditions. or describe a state that changes under certain conditions.
Script API: Script API:

View file

@ -1,5 +1,5 @@
""" """
This file contains the core methods for the Batch-command- and This module contains the core methods for the Batch-command- and
Batch-code-processors respectively. In short, these are two different Batch-code-processors respectively. In short, these are two different
ways to build a game world using a normal text-editor without having ways to build a game world using a normal text-editor without having
to do so 'on the fly' in-game. They also serve as an automatic backup to do so 'on the fly' in-game. They also serve as an automatic backup
@ -107,7 +107,7 @@ allows them to the executed in blocks. This way of working assures a
sequential execution of the file and allows for features like stepping sequential execution of the file and allows for features like stepping
from block to block (without executing those coming before), as well from block to block (without executing those coming before), as well
as automatic deletion of created objects etc. You can however also run as automatic deletion of created objects etc. You can however also run
a batch-code Python file directly using Python (and can also be de). a batch-code Python file directly using Python.
Code blocks are separated by python comments starting with special Code blocks are separated by python comments starting with special
code words. code words.
@ -315,8 +315,8 @@ class BatchCodeProcessor(object):
3) #CODE headers may be of the following form: 3) #CODE headers may be of the following form:
#CODE (info) objname, objname2, ... #CODE (info) objname, objname2, ...
4) Lines starting with #INSERT are on form #INSERT filename. 4) Lines starting with #INSERT are on form #INSERT filename.
3) All lines outside blocks are stripped. 5) All lines outside blocks are stripped.
4) All excess whitespace beginning/ending a block is stripped. 6) All excess whitespace beginning/ending a block is stripped.
""" """