diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 129479dfaa..d88dc89f1f 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -1169,7 +1169,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)): """ # if we have saved protocol flags on ourselves, load them here. - protocol_flags = self.attributes.get("_saved_protocol_flags", None) + protocol_flags = self.attributes.get("_saved_protocol_flags", {}) if session and protocol_flags: session.update_flags(**protocol_flags) diff --git a/evennia/commands/default/account.py b/evennia/commands/default/account.py index bf9767d893..067bc6dd55 100644 --- a/evennia/commands/default/account.py +++ b/evennia/commands/default/account.py @@ -434,10 +434,10 @@ class CmdWho(COMMAND_DEFAULT_CLASS): account = session.get_account() puppet = session.get_puppet() location = puppet.location.key if puppet and puppet.location else "None" - table.add_row(utils.crop(account.name, width=25), + table.add_row(utils.crop(account.get_display_name(account), width=25), utils.time_format(delta_conn, 0), utils.time_format(delta_cmd, 1), - utils.crop(puppet.key if puppet else "None", width=25), + utils.crop(puppet.get_display_name(account) if puppet else "None", width=25), utils.crop(location, width=25), session.cmd_total, session.protocol_key, @@ -451,7 +451,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS): delta_cmd = time.time() - session.cmd_last_visible delta_conn = time.time() - session.conn_time account = session.get_account() - table.add_row(utils.crop(account.key, width=25), + table.add_row(utils.crop(account.get_display_name(account), width=25), utils.time_format(delta_conn, 0), utils.time_format(delta_cmd, 1)) is_one = naccounts == 1 diff --git a/evennia/contrib/ingame_python/typeclasses.py b/evennia/contrib/ingame_python/typeclasses.py index e78f46d090..ca4d71b436 100644 --- a/evennia/contrib/ingame_python/typeclasses.py +++ b/evennia/contrib/ingame_python/typeclasses.py @@ -1,8 +1,9 @@ """ Typeclasses for the in-game Python system. -To use thm, one should inherit from these classes (EventObject, -EventRoom, EventCharacter and EventExit). +To use them, change your base typeclasses to inherit from the classes in this +module (EventObject, EventRoom, EventCharacter and EventExit) instead of the +default ones in evennia core. """ @@ -179,6 +180,11 @@ class EventCharacter(DefaultCharacter): "unpuppeted": (["character"], CHARACTER_UNPUPPETED), } + @lazy_property + def callbacks(self): + """Return the CallbackHandler.""" + return CallbackHandler(self) + def announce_move_from(self, destination, msg=None, mapping=None): """ Called if the move is to be announced. This is @@ -602,6 +608,11 @@ class EventExit(DefaultExit): "traverse": (["character", "exit", "origin", "destination"], EXIT_TRAVERSE), } + @lazy_property + def callbacks(self): + """Return the CallbackHandler.""" + return CallbackHandler(self) + def at_traverse(self, traversing_object, target_location): """ This hook is responsible for handling the actual traversal, @@ -862,6 +873,11 @@ class EventRoom(DefaultRoom): "unpuppeted_in": (["character", "room"], ROOM_UNPUPPETED_IN), } + @lazy_property + def callbacks(self): + """Return the CallbackHandler.""" + return CallbackHandler(self) + def at_object_delete(self): """ Called just before the database object is permanently diff --git a/evennia/server/amp_client.py b/evennia/server/amp_client.py index 1d06b33a70..08c46a7520 100644 --- a/evennia/server/amp_client.py +++ b/evennia/server/amp_client.py @@ -241,4 +241,5 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol): else: raise Exception("operation %(op)s not recognized." % {'op': operation}) + return {} diff --git a/evennia/server/session.py b/evennia/server/session.py index 7f02b69323..f06bcac3f6 100644 --- a/evennia/server/session.py +++ b/evennia/server/session.py @@ -135,7 +135,7 @@ class Session(object): """ if self.account: - self.protocol_flags.update(self.account.attributes.get("_saved_protocol_flags", {})) + self.protocol_flags.update(self.account.attributes.get("_saved_protocol_flags", None) or {}) # access hooks