Fixed some issues with which hooks the reset command calls. Resolves #499.

This commit is contained in:
Griatch 2014-04-12 16:25:19 +02:00
parent bbba449aa4
commit e76061ee4c
4 changed files with 12 additions and 5 deletions

View file

@ -393,7 +393,7 @@ class CmdWho(MuxPlayerCommand):
table.add_row([utils.crop(plr_pobject.name, width=25), table.add_row([utils.crop(plr_pobject.name, width=25),
utils.time_format(delta_conn, 0), utils.time_format(delta_conn, 0),
utils.time_format(delta_cmd, 1), utils.time_format(delta_cmd, 1),
hasattr(plr_pobject, "location") and plr_pobject.location.key or "None", hasattr(plr_pobject, "location") and plr_pobject.location and plr_pobject.location.key or "None",
session.cmd_total, session.cmd_total,
session.protocol_key, session.protocol_key,
isinstance(session.address, tuple) and session.address[0] or session.address]) isinstance(session.address, tuple) and session.address[0] or session.address])

View file

@ -81,7 +81,7 @@ class CmdReset(MuxCommand):
""" """
Reload the system. Reload the system.
""" """
SESSIONS.announce_all(" Server restarting ...") SESSIONS.announce_all(" Server resetting/restarting ...")
SESSIONS.server.shutdown(mode='reset') SESSIONS.server.shutdown(mode='reset')

View file

@ -128,6 +128,12 @@ class Bot(Player):
""" """
pass pass
def at_server_shutdown(self):
"We need to handle this case manually since the shutdown may be a reset"
print "bots at_server_shutdown called"
for session in self.get_all_sessions():
session.sessionhandler.disconnect(session)
# Bot implementations # Bot implementations

View file

@ -325,14 +325,15 @@ class Evennia(object):
# same as shutdown # same as shutdown
yield [(o.typeclass, o.at_server_shutdown()) yield [(o.typeclass, o.at_server_shutdown())
for o in ObjectDB.get_all_cached_instances()] for o in ObjectDB.get_all_cached_instances()]
yield [(p.typeclass, p.at_server_shutdown())
for p in PlayerDB.get_all_cached_instances()]
else: # shutdown else: # shutdown
yield [_SA(p, "is_connected", False) yield [_SA(p, "is_connected", False)
for p in PlayerDB.get_all_cached_instances()] for p in PlayerDB.get_all_cached_instances()]
yield [(o.typeclass, o.at_server_shutdown()) yield [(o.typeclass, o.at_server_shutdown())
for o in ObjectDB.get_all_cached_instances()] for o in ObjectDB.get_all_cached_instances()]
yield [(p.typeclass, p.unpuppet_all(), p.at_server_shutdown())
yield [(p.typeclass, p.unpuppet_all(), p.at_server_shutdown()) for p in PlayerDB.get_all_cached_instances()]
for p in PlayerDB.get_all_cached_instances()]
yield [(s.typeclass, s.at_server_shutdown()) yield [(s.typeclass, s.at_server_shutdown())
for s in ScriptDB.get_all_cached_instances()] for s in ScriptDB.get_all_cached_instances()]
yield ObjectDB.objects.clear_all_sessids() yield ObjectDB.objects.clear_all_sessids()