Added a HIDDEN_ATTRIBS list to defines_global.py containing a list of attributes that shouldn't show up on examined objects.
This commit is contained in:
parent
59518c440c
commit
1a996bbf7e
2 changed files with 8 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import User, Group
|
||||||
import defines_global as global_defines
|
import defines_global
|
||||||
import ansi
|
import ansi
|
||||||
|
|
||||||
class Attribute(models.Model):
|
class Attribute(models.Model):
|
||||||
|
|
@ -45,7 +45,7 @@ class Object(models.Model):
|
||||||
owner = models.ForeignKey('self', related_name="obj_owner", blank=True, null=True)
|
owner = models.ForeignKey('self', related_name="obj_owner", blank=True, null=True)
|
||||||
zone = models.ForeignKey('self', related_name="obj_zone", blank=True, null=True)
|
zone = models.ForeignKey('self', related_name="obj_zone", blank=True, null=True)
|
||||||
home = models.ForeignKey('self', related_name="obj_home", blank=True, null=True)
|
home = models.ForeignKey('self', related_name="obj_home", blank=True, null=True)
|
||||||
type = models.SmallIntegerField(choices=global_defines.OBJECT_TYPES)
|
type = models.SmallIntegerField(choices=defines_global.OBJECT_TYPES)
|
||||||
description = models.TextField(blank=True, null=True)
|
description = models.TextField(blank=True, null=True)
|
||||||
location = models.ForeignKey('self', related_name="obj_location", blank=True, null=True)
|
location = models.ForeignKey('self', related_name="obj_location", blank=True, null=True)
|
||||||
flags = models.TextField(blank=True, null=True)
|
flags = models.TextField(blank=True, null=True)
|
||||||
|
|
@ -301,7 +301,7 @@ class Object(models.Model):
|
||||||
"""
|
"""
|
||||||
Returns a QuerySet of an object's attributes.
|
Returns a QuerySet of an object's attributes.
|
||||||
"""
|
"""
|
||||||
return self.attribute_set.all()
|
return [attr for attr in self.attribute_set.all() if attr.name.upper() not in defines_global.HIDDEN_ATTRIBS]
|
||||||
|
|
||||||
def clear_all_attributes(self):
|
def clear_all_attributes(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -619,7 +619,7 @@ class Object(models.Model):
|
||||||
if return_number:
|
if return_number:
|
||||||
return self.type
|
return self.type
|
||||||
else:
|
else:
|
||||||
return global_defines.OBJECT_TYPES[self.type][1]
|
return defines_global.OBJECT_TYPES[self.type][1]
|
||||||
|
|
||||||
def is_type(self, otype):
|
def is_type(self, otype):
|
||||||
"""
|
"""
|
||||||
|
|
@ -648,7 +648,7 @@ class Object(models.Model):
|
||||||
# We have to cast this because the admin interface is really picky
|
# We have to cast this because the admin interface is really picky
|
||||||
# about tuple index types. Bleh.
|
# about tuple index types. Bleh.
|
||||||
otype = int(self.type)
|
otype = int(self.type)
|
||||||
return global_defines.OBJECT_TYPES[otype][1][0]
|
return defines_global.OBJECT_TYPES[otype][1][0]
|
||||||
|
|
||||||
class CommChannel(models.Model):
|
class CommChannel(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@ NOSET_FLAGS = ["CONNECTED"]
|
||||||
# These attribute names can't be modified by players.
|
# These attribute names can't be modified by players.
|
||||||
NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "CHANLIST", "LAST", "LASTSITE"]
|
NOSET_ATTRIBS = ["MONEY", "ALIAS", "LASTPAGED", "CHANLIST", "LAST", "LASTSITE"]
|
||||||
|
|
||||||
|
# These attributes don't show up on objects when examined.
|
||||||
|
HIDDEN_ATTRIBS = ["CHANLIST"]
|
||||||
|
|
||||||
# Server version number.
|
# Server version number.
|
||||||
EVENNIA_VERSION = 'Alpha'
|
EVENNIA_VERSION = 'Alpha'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue