From 47356ca6329c0b4c48cc10b5d56b2bcb663c97d6 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 Feb 2013 20:08:05 +0100 Subject: [PATCH] Fixed a lingering error from turning off "quick assignment" that caused issues in TutorialWorld. --- contrib/tutorial_world/objects.py | 4 ++-- src/objects/models.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/contrib/tutorial_world/objects.py b/contrib/tutorial_world/objects.py index 0a184bf94d..08a9f1ab3e 100644 --- a/contrib/tutorial_world/objects.py +++ b/contrib/tutorial_world/objects.py @@ -773,8 +773,8 @@ class Weapon(TutorialObject): super(Weapon, self).at_object_creation() self.db.hit = 0.4 # hit chance self.db.parry = 0.8 # parry chance - self.damage = 8.0 - self.magic = False + self.db.damage = 8.0 + self.db.magic = False self.cmdset.add_default(CmdSetWeapon, permanent=True) def reset(self): diff --git a/src/objects/models.py b/src/objects/models.py index 21bcdda2d0..63f70a2e21 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -35,7 +35,7 @@ from django.utils.translation import ugettext as _ #__all__ = ("ObjAttribute", "Alias", "ObjectNick", "ObjectDB") - +_ScriptDB = None _AT_SEARCH_RESULT = variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1)) _GA = object.__getattribute__ @@ -900,6 +900,10 @@ class ObjectDB(TypedObject): objects to their respective home locations, as well as clean up all exits to/from the object. """ + global _ScriptDB + if not _ScriptDB: + from src.scripts.models import ScriptDB as _ScriptDB + if _GA(self, "delete_iter") > 0: # make sure to only call delete once on this object # (avoid recursive loops) @@ -924,8 +928,10 @@ class ObjectDB(TypedObject): _SA(_GA(self, "player"), "character", None) _SA(self, "player", None) - for script in _GA(self, "scripts").all(): + for script in _ScriptDB.objects.get_all_scripts_on_obj(self): script.stop() + #for script in _GA(self, "scripts").all(): + # script.stop() # if self.player: # self.player.user.is_active = False