Resolves issue 155. Cleaned up the copy functionality and a few minor bugs at the same time. Copying an active character is somewhat confusing though (and deleting a character will currently make the player unable to log back in).

This commit is contained in:
Griatch 2011-04-07 22:10:51 +00:00
parent 4519169e1c
commit 695317e699
8 changed files with 82 additions and 33 deletions

View file

@ -169,3 +169,20 @@ class ScriptManager(TypedObjectManager):
if only_timed:
scripts = scripts.exclude(interval=0)
return scripts
def copy_script(self, original_script, new_key=None, new_obj=None, new_locks=None):
"""
Make an identical copy of the original_script
"""
typeclass = original_script.typeclass_path
if not new_key:
new_key = original_script.key
if not new_obj:
new_obj = original_script.obj
if not new_locks:
new_locks = original_script.db_lock_storage
from src.utils import create
new_script = create.create_script(typeclass, key=new_key, obj=new_obj, locks=new_locks, autostart=True)
return new_script