Made tutorial_world run on devel, it had a few deprecated imports and also the path to the build file given in the limbo desc was not right anymore.

This commit is contained in:
Griatch 2015-02-10 10:26:08 +01:00
parent ec4e985c39
commit eb738ebad8
4 changed files with 54 additions and 40 deletions

View file

@ -8,9 +8,9 @@ object based on that mobile class.
import random, time import random, time
from django.conf import settings from django.conf import settings
from evennia import search_object, utils, Script from evennia import search_object, utils, DefaultScript
from contrib.tutorial_world import objects as tut_objects from evennia.contrib.tutorial_world import objects as tut_objects
from contrib.tutorial_world import scripts as tut_scripts from evennia.contrib.tutorial_world import scripts as tut_scripts
BASE_CHARACTER_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS BASE_CHARACTER_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS
@ -88,7 +88,7 @@ class Mob(tut_objects.TutorialObject):
# #
#------------------------------------------------------------ #------------------------------------------------------------
class AttackTimer(Script): class AttackTimer(DefaultScript):
""" """
This script is what makes an eneny "tick". This script is what makes an eneny "tick".
""" """

View file

@ -23,7 +23,7 @@ import time
import random import random
from evennia import create_object from evennia import create_object
from evennia import DefaultObject, DefaultExit, Command, CmdSet, Script from evennia import DefaultObject, DefaultExit, Command, CmdSet, DefaultScript
#------------------------------------------------------------ #------------------------------------------------------------
# #
@ -224,7 +224,7 @@ class Obelisk(TutorialObject):
# #
#------------------------------------------------------------ #------------------------------------------------------------
class StateLightSourceOn(Script): class StateLightSourceOn(DefaultScript):
""" """
This script controls how long the light source is burning. When This script controls how long the light source is burning. When
it runs out of fuel, the lightsource goes out. it runs out of fuel, the lightsource goes out.

View file

@ -5,10 +5,10 @@ Room Typeclasses for the TutorialWorld.
""" """
import random import random
from evennia import CmdSet, Script, Command, DefaultRoom from evennia import CmdSet, DefaultScript, Command, DefaultRoom
from evennia import utils, create_object, search_object from evennia import utils, create_object, search_object
from contrib.tutorial_world import scripts as tut_scripts from evennia.contrib.tutorial_world import scripts as tut_scripts
from contrib.tutorial_world.objects import LightSource, TutorialObject from evennia.contrib.tutorial_world.objects import LightSource, TutorialObject
#------------------------------------------------------------ #------------------------------------------------------------
@ -241,7 +241,7 @@ class DarkCmdSet(CmdSet):
# Darkness room two-state system # Darkness room two-state system
# #
class DarkState(Script): class DarkState(DefaultScript):
""" """
The darkness state is a script that keeps tabs on when The darkness state is a script that keeps tabs on when
a player in the room carries an active light source. It places a player in the room carries an active light source. It places
@ -276,7 +276,7 @@ class DarkState(Script):
self.obj.scripts.add(LightState) self.obj.scripts.add(LightState)
class LightState(Script): class LightState(DefaultScript):
""" """
This is the counterpart to the Darkness state. It is active when the This is the counterpart to the Darkness state. It is active when the
lantern is on. lantern is on.
@ -695,12 +695,13 @@ class IntroRoom(TutorialRoom):
character.db.health_max = health character.db.health_max = health
if character.is_superuser: if character.is_superuser:
string = "-"*78 string = "-"*78 + "\n" \
string += "\nWARNING: YOU ARE PLAYING AS A SUPERUSER (%s). TO EXPLORE NORMALLY YOU NEED " % character.key "WARNING: You are playing as a superuser ({name}). Use the {quell} command to\n" \
string += "\nTO CREATE AND LOG IN AS A REGULAR USER INSTEAD. IF YOU CONTINUE, KNOW THAT " "play without superuser privileges (many functions and puzzles ignore the \n" \
string += "\nMANY FUNCTIONS AND PUZZLES WILL IGNORE THE PRESENCE OF A SUPERUSER.\n" "presence of a superuser, making this mode useful for exploring things behind \n" \
string += "-"*78 "the scenes later).\n" \
character.msg("{r%s{n" % string) + "-"*78
character.msg("{r%s{n" % string.format(name=character.key, quell="{w@quell{r"))
#------------------------------------------------------------ #------------------------------------------------------------

View file

@ -13,6 +13,39 @@ from evennia.players.models import PlayerDB
from evennia.server.models import ServerConfig from evennia.server.models import ServerConfig
from evennia.utils import create from evennia.utils import create
ERROR_NO_SUPERUSER = \
"""
No superuser exists yet. The superuser is the 'owner' account on
the Evennia server. Create a new superuser using the command
evennia createsuperuser
Follow the prompts, then restart the server.
"""
LIMBO_DESC = \
_("""
Welcome to your new {wEvennia{n-based game. From here you are
ready to begin development. Visit http://evennia.com if you should
need help or would like to participate in community discussions.
If you are logged in as user #1 you can create a demo/tutorial
area with {w@batchcommand tutorial_world.build{n. Use {w@quell{n
or login as normal player to play the demo properly.
""")
WARNING_POSTGRESQL_FIX = \
"""
PostgreSQL-psycopg2 compatability fix:
The in-game channels {chan1}, {chan2} and {chan3} were created,
but the superuser was not yet connected to them. Please use in
game commands to connect Player #1 to those channels when first
logging in.
"""
def create_config_values(): def create_config_values():
""" """
Creates the initial config values. Creates the initial config values.
@ -27,12 +60,7 @@ def get_god_player():
try: try:
god_player = PlayerDB.objects.get(id=1) god_player = PlayerDB.objects.get(id=1)
except PlayerDB.DoesNotExist: except PlayerDB.DoesNotExist:
txt = "\n\nNo superuser exists yet. The superuser is the 'owner'\n" \ raise PlayerDB.DoesNotExist(ERROR_NO_SUPERUSER)
"account on the Evennia server. Create a new superuser using\n" \
"the command\n\n" \
" evennia createsuperuser\n\n" \
"Follow the prompts, then restart the server."
raise Exception(txt)
return god_player return god_player
@ -83,15 +111,7 @@ def create_objects():
limbo_obj = create.create_object(room_typeclass, _('Limbo'), nohome=True) limbo_obj = create.create_object(room_typeclass, _('Limbo'), nohome=True)
limbo_obj.id = 2 limbo_obj.id = 2
limbo_obj.save() limbo_obj.save()
string = \ limbo_obj.db.desc = LIMBO_DESC.strip()
"Welcome to your new {wEvennia{n-based game. From here you are ready " \
"to begin development. Visit http://evennia.com if you should need " \
"help or would like to participate in community discussions. If you " \
"are logged in as user #1 you can create a demo/tutorial area with " \
"{w@batchcommand contrib.tutorial_world.build{n. Use {w@quell{n or login " \
"as normal player to play the demo properly."
string = _(string)
limbo_obj.db.desc = string
limbo_obj.save() limbo_obj.save()
# Now that Limbo exists, try to set the user up in Limbo (unless # Now that Limbo exists, try to set the user up in Limbo (unless
@ -127,14 +147,7 @@ def create_channels():
or (hasattr(settings, 'DATABASES') or (hasattr(settings, 'DATABASES')
and settings.DATABASES.get("default", {}).get('ENGINE', None) and settings.DATABASES.get("default", {}).get('ENGINE', None)
== 'django.db.backends.postgresql_psycopg2')): == 'django.db.backends.postgresql_psycopg2')):
warning = """ print WARNING_POSTGRESQL_FIX.format(chan1=key1, chan2=key2, chan3=key3)
PostgreSQL-psycopg2 compatability fix:
The in-game channels %s, %s and %s were created,
but the superuser was not yet connected to them. Please use in
game commands to onnect Player #1 to those channels when first
logging in.
""" % (key1, key2, key3)
print warning
return return
# connect the god user to all these channels by default. # connect the god user to all these channels by default.