diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 640717050f..62f6e59f72 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -240,7 +240,31 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): # main methods - ## methods inherited from the database object (overload them here) + def get_display_name(self, looker, **kwargs): + """ + Displays the name of the object in a viewer-aware manner. + + Args: + looker (TypedObject): The object or player that is looking + at/getting inforamtion for this object. + + Returns: + name (str): A string containing the name of the object, + including the DBREF if this user is privileged to control + said object. + + Notes: + This function could be extended to change how object names + appear to users in character, but be wary. This function + does not change an object's keys or aliases when + searching, and is expected to produce something useful for + builders. + + """ + if self.locks.check_lockstring(looker, "pperm(Builders)"): + return "{}(#{})".format(self.name, self.id) + return self.name + def search(self, searchdata, global_search=False,