""" Gendersub Griatch 2015 This is a simple gender-aware Character class for allowing users to insert custom markers in their text to indicate gender-aware messaging. It relies on a modified msg() and is meant as an inspiration and starting point to how to do stuff like this. An object can have the following genders: - male (he/his) - female (her/hers) - neutral (it/its) - ambiguous (they/them/their/theirs) When in use, messages can contain special tags to indicate pronouns gendered based on the one being addressed. Capitalization will be retained. - `|s`, `|S`: Subjective form: he, she, it, He, She, It, They - `|o`, `|O`: Objective form: him, her, it, Him, Her, It, Them - `|p`, `|P`: Possessive form: his, her, its, His, Her, Its, Their - `|a`, `|A`: Absolute Possessive form: his, hers, its, His, Hers, Its, Theirs For example, ``` char.msg("%s falls on |p face with a thud." % char.key) "Tom falls on his face with a thud" ``` The default gender is "ambiguous" (they/them/their/theirs). To use, have DefaultCharacter inherit from this, or change setting.DEFAULT_CHARACTER to point to this class. The `@gender` command is used to set the gender. It needs to be added to the default cmdset before it becomes available. """ import re from evennia.utils import logger from evennia import DefaultCharacter from evennia import Command # gender maps _GENDER_PRONOUN_MAP = { "male": {"s": "he", "o": "him", "p": "his", "a": "his"}, "female": {"s": "she", "o": "her", "p": "her", "a": "hers"}, "neutral": {"s": "it", "o": "it", "p": "its", "a": "its"}, "ambiguous": {"s": "they", "o": "them", "p": "their", "a": "theirs"}, } _RE_GENDER_PRONOUN = re.compile(r"(?