mirror of
https://github.com/evennia/evennia.git
synced 2026-03-25 01:06:32 +01:00
Merge with Kelketek's branch (which also includes dbenoy's branch)
This commit is contained in:
commit
ca11e7de44
8 changed files with 28 additions and 20 deletions
|
|
@ -153,7 +153,7 @@ class CmdSetObjAlias(MuxCommand):
|
|||
# save back to object.
|
||||
obj.aliases.add(aliases)
|
||||
# we treat this as a re-caching (relevant for exits to re-build their exit commands with the correct aliases)
|
||||
caller.msg("Aliases for '%s' are now %s." % (obj.key, str(obj.aliases)))
|
||||
caller.msg("Alias(es) for '%s' set to %s." % (obj.key, str(obj.aliases)))
|
||||
|
||||
class CmdCopy(ObjManipCommand):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ class CmdGet(MuxCommand):
|
|||
if not self.args:
|
||||
caller.msg("Get what?")
|
||||
return
|
||||
#print "general/get:", caller, caller.location, self.args, caller.location.contents
|
||||
obj = caller.search(self.args, location=caller.location)
|
||||
if not obj:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ from django.utils.unittest import TestCase
|
|||
from src.players.player import Player
|
||||
from src.utils import create, utils, ansi
|
||||
|
||||
from django.db.models.signals import pre_save
|
||||
from src.server.caches import field_pre_save
|
||||
pre_save.connect(field_pre_save, dispatch_uid="fieldcache")
|
||||
|
||||
# set up signal here since we are not starting the server
|
||||
|
||||
_RE = re.compile(r"^\+|-+\+|\+-+|--*|\|", re.MULTILINE)
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
|
@ -171,7 +177,7 @@ class TestBuilding(CommandTest):
|
|||
CID = 6
|
||||
def test_cmds(self):
|
||||
self.call(building.CmdCreate(), "/drop TestObj1", "You create a new Object: TestObj1.")
|
||||
self.call(building.CmdSetObjAlias(), "TestObj1 = TestObj1b","Aliases for 'TestObj1' are now set to testobj1b.")
|
||||
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']")
|
||||
self.call(building.CmdSetAttribute(), "Obj6/test1=\"value1\"", "Created attribute Obj6/test1 = \"value1\"")
|
||||
self.call(building.CmdSetAttribute(), "Obj6b/test2=\"value2\"", "Created attribute Obj6b/test2 = \"value2\"")
|
||||
|
|
|
|||
|
|
@ -792,6 +792,7 @@ class ObjectDB(TypedObject):
|
|||
|
||||
# Perform move
|
||||
try:
|
||||
#print "move_to location:", destination
|
||||
_SA(self, "location", destination)
|
||||
except Exception:
|
||||
emit_to_obj.msg(errtxt % "location change")
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ else:
|
|||
|
||||
def hashid(obj, suffix=""):
|
||||
"""
|
||||
Returns a per-class unique that combines the object's
|
||||
Returns a per-class unique hash that combines the object's
|
||||
class name with its idnum and creation time. This makes this id unique also
|
||||
between different typeclassed entities such as scripts and
|
||||
objects (which may still have the same id).
|
||||
|
|
|
|||
|
|
@ -130,20 +130,20 @@ class Attribute(SharedMemoryModel):
|
|||
# value = self.attr and del self.attr respectively (where self
|
||||
# is the object in question).
|
||||
|
||||
# key property (wraps db_key)
|
||||
#@property
|
||||
def __key_get(self):
|
||||
"Getter. Allows for value = self.key"
|
||||
return get_field_cache(self, "key")
|
||||
#@key.setter
|
||||
def __key_set(self, value):
|
||||
"Setter. Allows for self.key = value"
|
||||
set_field_cache(self, "key", value)
|
||||
#@key.deleter
|
||||
def __key_del(self):
|
||||
"Deleter. Allows for del self.key"
|
||||
raise Exception("Cannot delete attribute key!")
|
||||
key = property(__key_get, __key_set, __key_del)
|
||||
## key property (wraps db_key)
|
||||
##@property
|
||||
#def __key_get(self):
|
||||
# "Getter. Allows for value = self.key"
|
||||
# return get_field_cache(self, "key")
|
||||
##@key.setter
|
||||
#def __key_set(self, value):
|
||||
# "Setter. Allows for self.key = value"
|
||||
# set_field_cache(self, "key", value)
|
||||
##@key.deleter
|
||||
#def __key_del(self):
|
||||
# "Deleter. Allows for del self.key"
|
||||
# raise Exception("Cannot delete attribute key!")
|
||||
#key = property(__key_get, __key_set, __key_del)
|
||||
|
||||
# obj property (wraps db_obj)
|
||||
#@property
|
||||
|
|
@ -232,7 +232,7 @@ class Attribute(SharedMemoryModel):
|
|||
#
|
||||
|
||||
def __str__(self):
|
||||
return smart_str("%s(%s)" % (_GA(self, "db_key", _GA(self, "id"))))
|
||||
return smart_str("%s(%s)" % (_GA(self, "db_key"), _GA(self, "id")))
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s(%s)" % (_GA(self, "db_key", _GA(self, "id")))
|
||||
|
|
|
|||
|
|
@ -137,9 +137,8 @@ def create_object(typeclass, key=None, location=None,
|
|||
else:
|
||||
new_object.home = settings.CHARACTER_DEFAULT_HOME
|
||||
|
||||
|
||||
if location:
|
||||
new_object.move_to(location, quiet=True)
|
||||
new_object.move_to(location, quiet=True)
|
||||
else:
|
||||
# rooms would have location=None.
|
||||
new_object.location = None
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class SharedMemoryModelBase(ModelBase):
|
|||
|
||||
def _set(cls, fname, value):
|
||||
"Wrapper for setting database field"
|
||||
#print "_set:", fname
|
||||
if hasattr(value, "dbobj"):
|
||||
value = _GA(value, "dbobj")
|
||||
elif isinstance(value, basestring) and (value.isdigit() or value.startswith("#")):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue