- Made many small bugfixes to the @parent and @create functions as well as their underlying methods.

- Made it so user #1 is also affected by the on_player_creation() function.
- Added an event folder for custom events, including a working example
- Expanded the example commands and parents to include the changes to how they should be initialized.
- Added an optional ansi scheme (not active by default)
This commit is contained in:
Griatch 2009-04-25 20:51:12 +00:00
parent a32840002c
commit a9dbac8aae
16 changed files with 397 additions and 35 deletions

View file

@ -79,6 +79,15 @@ class ObjectManager(models.Manager):
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
defines_global.OTYPE_GOING])
def global_object_script_parent_search(self, script_parent):
"""
Searches through all objects returning those which has a certain script parent.
"""
o_query = self.filter(script_parent__exact=script_parent)
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
defines_global.OTYPE_GOING])
def list_search_object_namestr(self, searchlist, ostring, dbref_only=False,
limit_types=False, match_type="fuzzy"):
"""
@ -350,4 +359,4 @@ class ObjectManager(models.Manager):
user_object.emit_to("Welcome to %s, %s.\n\r" % (
ConfigValue.objects.get_configvalue('site_name'),
user_object.get_name(show_dbref=False)))
command.session.add_default_channels()
command.session.add_default_channels()

View file

@ -18,6 +18,8 @@ from src import logger
import src.flags
from src.util import functions_general
from src.logger import log_infomsg
class Attribute(models.Model):
"""
Attributes are things that are specific to different types of objects. For
@ -598,8 +600,8 @@ class Object(models.Model):
attrib_obj.attr_value = new_value
attrib_obj.save()
else:
if not new_value:
# Attribute object and we have given a doesn't exist, create it.
if new_value:
# No object currently exist, so create it.
new_attrib = Attribute()
new_attrib.attr_name = attribute
new_attrib.attr_value = new_value
@ -800,10 +802,10 @@ class Object(models.Model):
attrib: (str) The attribute's name.
"""
if self.has_attribute(attrib):
if self.has_attribute(attrib):
attrib = Attribute.objects.filter(attr_object=self).filter(attr_name=attrib)
return attrib[0].attr_value
else:
else:
return default
def get_attribute_obj(self, attrib):