* Updated and expanded the State system; the API changed a bit. You now have to first *create* the state using

GLOBAL_STATE_TABLE.add_state() before adding commands to it. The state can now be much more configured by including as much or as
little of the normal default commands into it as wanted (so you can now have states which are almost as normal, except some
commands are missing or change their behaviour ... illness or darkness comes to mind). The possibilities here are limitless.
* States now also optionally allow traversing exits as well as using command tables defined on objects.
* States now better handle error messages (so if you try 'look' in a state which does not contain a look command you will no
longer get the 'Huh?' but will be told that the command is not available at the moment).
* All examples in commands/examples/ have been updated to use the new State system. Also added a @test_state function for trying out
the functionality.
* Added hooks at_before_move() and at_after_move(), useful for character based move-restrictions and checks (e.g. movement speed)
* Minor tweaks to the event system; avoiding the counters to go negative should they hit an uncaught traceback.
* Small fixes of typos and minor extra safety checks.
/Griatch
This commit is contained in:
Griatch 2009-08-16 01:18:58 +00:00
parent f5b40648a6
commit 1d4f075ca7
16 changed files with 555 additions and 196 deletions

View file

@ -1,5 +1,5 @@
"""
This module handles initial database propagation, which is only ran the first
This module handles initial database propagation, which is only run the first
time the game starts. It will create some default channels, objects, and
other things.
@ -30,11 +30,14 @@ def create_objects():
"""
# Set the initial User's account object's username on the #1 object.
god_user = get_god_user()
god_user.is_superuser = True
god_user.is_staff = True
# Create the matching PLAYER object in the object DB.
god_user_obj = Object(id=1, type=defines_global.OTYPE_PLAYER)
god_user_obj.set_name(god_user.username)
god_user_obj.set_attribute('desc', 'You are Player #1.')
god_user_obj.scriptlink.at_player_creation()
god_user_obj.save()
# Limbo is the initial starting room.
@ -91,8 +94,9 @@ def create_connect_screens():
Creates the default connect screen(s).
"""
ConnectScreen(name="Default",
text="%ch%cb==================================================================%cn\r\n Welcome to Evennia! Please type one of the following to begin:\r\n\r\n If you have an existing account, connect to it by typing:\r\n %chconnect <email> <password>%cn\r\n If you need to create an account, type (without the <>'s):\r\n %chcreate \"<username>\" <email> <password>%cn\r\n%ch%cb==================================================================%cn\r\n",
text="%ch%cb==================================================================%cn\r\n Welcome to %chEvennia%cn! Please type one of the following to begin:\r\n\r\n If you have an existing account, connect to it by typing:\r\n %chconnect <email> <password>%cn\r\n If you need to create an account, type (without the <>'s):\r\n %chcreate \"<username>\" <email> <password>%cn\r\n%ch%cb==================================================================%cn\r\n",
is_active=True).save()
def create_aliases():
"""
@ -107,7 +111,7 @@ def create_aliases():
CommandAlias(user_input="l", equiv_command="look").save()
CommandAlias(user_input="ex", equiv_command="examine").save()
CommandAlias(user_input="sa", equiv_command="say").save()
CommandAlias(user_input="emote", equiv_command="pose").save()
#CommandAlias(user_input="emote", equiv_command="pose").save()
CommandAlias(user_input="p", equiv_command="page").save()
def import_help_files():