diff --git a/contrib/red_button/__init__.py b/contrib/tutorial_examples/__init__.py similarity index 100% rename from contrib/red_button/__init__.py rename to contrib/tutorial_examples/__init__.py diff --git a/game_template/world/batch_cmds.ev b/contrib/tutorial_examples/batch_cmds.ev similarity index 96% rename from game_template/world/batch_cmds.ev rename to contrib/tutorial_examples/batch_cmds.ev index fe8d4dd9f6..943bf8a1c5 100644 --- a/game_template/world/batch_cmds.ev +++ b/contrib/tutorial_examples/batch_cmds.ev @@ -17,7 +17,7 @@ # This creates a red button -@create button:examples.red_button.RedButton +@create button:tutorial_examples.red_button.RedButton # This comment ends input for @create # Next command: diff --git a/contrib/red_button/cmdset_red_button.py b/contrib/tutorial_examples/cmdset_red_button.py similarity index 100% rename from contrib/red_button/cmdset_red_button.py rename to contrib/tutorial_examples/cmdset_red_button.py diff --git a/contrib/red_button/red_button.py b/contrib/tutorial_examples/red_button.py similarity index 96% rename from contrib/red_button/red_button.py rename to contrib/tutorial_examples/red_button.py index 22fb3f256f..74c656df52 100644 --- a/contrib/red_button/red_button.py +++ b/contrib/tutorial_examples/red_button.py @@ -11,16 +11,16 @@ Create this button with Note that you must drop the button before you can see its messages! """ import random -from evennia import Object -from contrib.examples import red_button_scripts as scriptexamples -from contrib.examples import cmdset_red_button as cmdsetexamples +from evennia import DefaultObject +from contrib.tutorial_examples import red_button_scripts as scriptexamples +from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples # # Definition of the object itself # -class RedButton(Object): +class RedButton(DefaultObject): """ This class describes an evil red button. It will use the script definition in contrib/examples/red_button_scripts to blink at regular diff --git a/contrib/red_button/red_button_scripts.py b/contrib/tutorial_examples/red_button_scripts.py similarity index 99% rename from contrib/red_button/red_button_scripts.py rename to contrib/tutorial_examples/red_button_scripts.py index 581b641618..b73287c5c8 100644 --- a/contrib/red_button/red_button_scripts.py +++ b/contrib/tutorial_examples/red_button_scripts.py @@ -7,7 +7,7 @@ on uses of scripts are included. """ from evennia import Script -from contrib.examples import cmdset_red_button as cmdsetexamples +from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples # # Scripts as state-managers diff --git a/evennia/__init__.py b/evennia/__init__.py index 377dba5a31..29b9902513 100644 --- a/evennia/__init__.py +++ b/evennia/__init__.py @@ -33,6 +33,7 @@ Msg = None # commands Command = None +CmdSet = None default_cmds = None syscmdkeys = None @@ -68,7 +69,6 @@ except IOError: __version__ += " (unknown version)" del os - def init(): """ This is called only after Evennia has fully initialized all its models. @@ -83,7 +83,7 @@ def init(): global DefaultPlayer, DefaultObject, DefaultGuest, DefaultCharacter, \ DefaultRoom, DefaultExit, DefaultChannel, Script global ObjectDB, PlayerDB, ScriptDB, ChannelDB, Msg - global Command, default_cmds, syscmdkeys + global Command, CmdSet, default_cmds, syscmdkeys global search_object, search_script, search_player, search_channel, search_help global create_object, create_script, create_player, create_channel, create_message global lockfuncs, tickerhandler, logger, utils, gametime, ansi, spawn, managers @@ -106,6 +106,7 @@ def init(): # commands from commands.command import Command + from commands.cmdset import CmdSet # search functions from utils.search import search_object @@ -256,4 +257,3 @@ def init(): syscmdkeys = SystemCmds() del SystemCmds del _EvContainer - diff --git a/evennia/commands/default/system.py b/evennia/commands/default/system.py index bf0219a7bd..de562c8b2b 100644 --- a/evennia/commands/default/system.py +++ b/evennia/commands/default/system.py @@ -162,11 +162,12 @@ class CmdPy(MuxCommand): # check if caller is a player # import useful variables - import ev + import evennia available_vars = {'self': caller, 'me': caller, 'here': hasattr(caller, "location") and caller.location or None, - 'ev': ev, + 'evennia': evennia, + 'ev': evennia, 'inherits_from': utils.inherits_from} try: diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index 4de01727ec..426a9f74bc 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -15,6 +15,8 @@ main test suite started with import re from django.conf import settings from django.utils.unittest import TestCase +import evennia +evennia.init() from evennia.server.serversession import ServerSession from evennia.objects.objects import DefaultObject, DefaultCharacter from evennia.players.players import DefaultPlayer @@ -232,7 +234,7 @@ from evennia.commands.default import building class TestBuilding(CommandTest): CID = 6 def test_cmds(self): - self.call(building.CmdCreate(), "/drop TestObj1", "You create a new DefaultObject: TestObj1.") + self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.") self.call(building.CmdExamine(), "TestObj1", "Name/key: TestObj1") self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Alias(es) for 'TestObj1' set to testobj1b.") self.call(building.CmdCopy(), "TestObj1 = TestObj2;TestObj2b, TestObj3;TestObj3b", "Copied TestObj1 to 'TestObj3' (aliases: ['TestObj3b']") @@ -283,5 +285,5 @@ class TestBatchProcess(CommandTest): CID = 8 def test_cmds(self): # cannot test batchcode here, it must run inside the server process - self.call(batchprocess.CmdBatchCommands(), "examples.batch_cmds", "Running Batchcommand processor Automatic mode for examples.batch_cmds") + self.call(batchprocess.CmdBatchCommands(), "contrib.tutorial_examples.batch_cmds", "Running Batchcommand processor Automatic mode for contrib.tutorial_examples.batch_cmds") #self.call(batchprocess.CmdBatchCode(), "examples.batch_code", "") diff --git a/evennia/comms/comms.py b/evennia/comms/comms.py index f2bcd2b865..b9ad1bc0fe 100644 --- a/evennia/comms/comms.py +++ b/evennia/comms/comms.py @@ -109,7 +109,7 @@ class DefaultChannel(ChannelDB): """ self.attributes.clear() self.aliases.clear() - super(Channel, self).delete() + super(DefaultChannel, self).delete() from evennia.comms.channelhandler import CHANNELHANDLER CHANNELHANDLER.update()