mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 12:37:16 +02:00
- 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:
parent
a32840002c
commit
a9dbac8aae
16 changed files with 397 additions and 35 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue