Fixed initial_setup to properly create new objects without a pre-set home.
This commit is contained in:
parent
2a5168ade4
commit
b99833e8fc
3 changed files with 10 additions and 14 deletions
|
|
@ -72,7 +72,7 @@ class CommandTest(TestCase):
|
|||
"sets up testing environment"
|
||||
self.player = create.create_player("TestPlayer%i" % self.CID, "test@test.com", "testpassword", typeclass=TestPlayerClass)
|
||||
self.player2 = create.create_player("TestPlayer%ib" % self.CID, "test@test.com", "testpassword", typeclass=TestPlayerClass)
|
||||
self.room1 = create.create_object("src.objects.objects.Room", key="Room%i"%self.CID, testmode=True)
|
||||
self.room1 = create.create_object("src.objects.objects.Room", key="Room%i"%self.CID, nohome=True)
|
||||
self.room1.db.desc = "room_desc"
|
||||
self.room2 = create.create_object("src.objects.objects.Room", key="Room%ib" % self.CID)
|
||||
self.obj1 = create.create_object(TestObjectClass, key="Obj%i" % self.CID, location=self.room1, home=self.room1)
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ def create_objects():
|
|||
god_player.at_player_creation()
|
||||
god_player.locks.add("examine:perm(Immortals);edit:false();delete:false();boot:false();msg:all()")
|
||||
|
||||
# Create the in-game god-character for player #1. We can't set location and home yet since nothing
|
||||
# exists. Also, all properties (name, email, password, is_superuser)
|
||||
# is inherited from the user so we don't specify it again here.
|
||||
# Limbo is the default "nowhere" starting room
|
||||
|
||||
# Create the in-game god-character for player #1 and set it to exist in Limbo.
|
||||
character_typeclass = settings.BASE_CHARACTER_TYPECLASS
|
||||
god_character = create.create_object(character_typeclass, key=god_player.username)
|
||||
god_character = create.create_object(character_typeclass, key=god_player.username, nohome=True)
|
||||
|
||||
god_character.id = 1
|
||||
god_character.db.desc = _('This is User #1.')
|
||||
|
|
@ -76,10 +76,8 @@ def create_objects():
|
|||
god_player.attributes.add("_last_puppet", god_character)
|
||||
god_player.db._playable_characters.append(god_character)
|
||||
|
||||
# Limbo is the default "nowhere" starting room
|
||||
|
||||
room_typeclass = settings.BASE_ROOM_TYPECLASS
|
||||
limbo_obj = create.create_object(room_typeclass, _('Limbo'))
|
||||
limbo_obj = create.create_object(room_typeclass, _('Limbo'), nohome=True)
|
||||
limbo_obj.id = 2
|
||||
string = " ".join([
|
||||
"Welcome to your new {wEvennia{n-based game. From here you are ready to begin development.",
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ _GA = object.__getattribute__
|
|||
|
||||
def create_object(typeclass, key=None, location=None,
|
||||
home=None, permissions=None, locks=None,
|
||||
aliases=None, destination=None, report_to=None, testmode=False):
|
||||
aliases=None, destination=None, report_to=None, nohome=False):
|
||||
"""
|
||||
Create a new in-game object. Any game object is a combination
|
||||
of a database object that stores data persistently to
|
||||
|
|
@ -69,7 +69,8 @@ def create_object(typeclass, key=None, location=None,
|
|||
If report_to is not set, errors will be raised as en Exception
|
||||
containing the error message. If set, this method will return
|
||||
None upon errors.
|
||||
testmode is only intended for Evennia unittest system
|
||||
nohome - this allows the creation of objects without a default home location;
|
||||
this only used when creating default location itself or during unittests
|
||||
"""
|
||||
global _Object, _ObjectDB
|
||||
if not _Object:
|
||||
|
|
@ -135,11 +136,8 @@ def create_object(typeclass, key=None, location=None,
|
|||
# perform a move_to in order to display eventual messages.
|
||||
if home:
|
||||
new_object.home = home
|
||||
elif testmode:
|
||||
# this is required by unittest
|
||||
pass
|
||||
else:
|
||||
new_object.home = settings.CHARACTER_DEFAULT_HOME
|
||||
new_object.home = settings.CHARACTER_DEFAULT_HOME if not nohome else None
|
||||
|
||||
if location:
|
||||
new_object.move_to(location, quiet=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue