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),
utils.time_format(delta_conn, 0),
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.protocol_key,
isinstance(session.address, tuple) and session.address[0] or session.address])

View file

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

View file

@ -128,6 +128,12 @@ class Bot(Player):
"""
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

View file

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