Starting to remove obj.typeclass references. Server now starts and stops cleanly, but not yet tested with actual gameplay.
This commit is contained in:
parent
e214c036c8
commit
a93d318121
3 changed files with 12 additions and 22 deletions
|
|
@ -124,8 +124,7 @@ class ScriptDB(TypedObject):
|
||||||
obj = _GA(self, "db_player")
|
obj = _GA(self, "db_player")
|
||||||
if not obj:
|
if not obj:
|
||||||
obj = _GA(self, "db_obj")
|
obj = _GA(self, "db_obj")
|
||||||
if obj:
|
return obj
|
||||||
return obj.typeclass
|
|
||||||
|
|
||||||
def __set_obj(self, value):
|
def __set_obj(self, value):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,8 @@ class Evennia(object):
|
||||||
self.update_defaults()
|
self.update_defaults()
|
||||||
|
|
||||||
#print "run_init_hooks:", ObjectDB.get_all_cached_instances()
|
#print "run_init_hooks:", ObjectDB.get_all_cached_instances()
|
||||||
[(o.typeclass, o.at_init()) for o in ObjectDB.get_all_cached_instances()]
|
[o.at_init() for o in ObjectDB.get_all_cached_instances()]
|
||||||
[(p.typeclass, p.at_init()) for p in PlayerDB.get_all_cached_instances()]
|
[p.at_init() for p in PlayerDB.get_all_cached_instances()]
|
||||||
|
|
||||||
with open(SERVER_RESTART, 'r') as f:
|
with open(SERVER_RESTART, 'r') as f:
|
||||||
mode = f.read()
|
mode = f.read()
|
||||||
|
|
@ -305,11 +305,9 @@ class Evennia(object):
|
||||||
|
|
||||||
if mode == 'reload':
|
if mode == 'reload':
|
||||||
# call restart hooks
|
# call restart hooks
|
||||||
yield [(o.typeclass, o.at_server_reload())
|
yield [o.at_server_reload() for o in ObjectDB.get_all_cached_instances()]
|
||||||
for o in ObjectDB.get_all_cached_instances()]
|
yield [p.at_server_reload() for p in PlayerDB.get_all_cached_instances()]
|
||||||
yield [(p.typeclass, p.at_server_reload())
|
yield [(s.pause(), s.at_server_reload())
|
||||||
for p in PlayerDB.get_all_cached_instances()]
|
|
||||||
yield [(s.typeclass, s.pause(), s.at_server_reload())
|
|
||||||
for s in ScriptDB.get_all_cached_instances()]
|
for s in ScriptDB.get_all_cached_instances()]
|
||||||
yield self.sessions.all_sessions_portal_sync()
|
yield self.sessions.all_sessions_portal_sync()
|
||||||
ServerConfig.objects.conf("server_restart_mode", "reload")
|
ServerConfig.objects.conf("server_restart_mode", "reload")
|
||||||
|
|
@ -325,19 +323,14 @@ class Evennia(object):
|
||||||
if mode == 'reset':
|
if mode == 'reset':
|
||||||
# don't unset the is_connected flag on reset, otherwise
|
# don't unset the is_connected flag on reset, otherwise
|
||||||
# same as shutdown
|
# same as shutdown
|
||||||
yield [(o.typeclass, o.at_server_shutdown())
|
yield [o.at_server_shutdown() for o in ObjectDB.get_all_cached_instances()]
|
||||||
for o in ObjectDB.get_all_cached_instances()]
|
yield [p.at_server_shutdown() for p in PlayerDB.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.at_server_shutdown() for o in ObjectDB.get_all_cached_instances()]
|
||||||
yield [(o.typeclass, o.at_server_shutdown())
|
yield [(p.unpuppet_all(), p.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()]
|
for p in PlayerDB.get_all_cached_instances()]
|
||||||
yield [(s.typeclass, s.at_server_shutdown())
|
yield [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()
|
||||||
ServerConfig.objects.conf("server_restart_mode", "reset")
|
ServerConfig.objects.conf("server_restart_mode", "reset")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,6 @@ class SharedMemoryModel(Model):
|
||||||
def get_all_cached_instances(cls):
|
def get_all_cached_instances(cls):
|
||||||
"return the objects so far cached by idmapper for this class."
|
"return the objects so far cached by idmapper for this class."
|
||||||
return cls.__instance_cache__.values()
|
return cls.__instance_cache__.values()
|
||||||
#get_all_cached_instances = classmethod(get_all_cached_instances)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _flush_cached_by_key(cls, key, force=True):
|
def _flush_cached_by_key(cls, key, force=True):
|
||||||
|
|
@ -276,7 +275,6 @@ class SharedMemoryModel(Model):
|
||||||
del cls.__instance_cache__[key]
|
del cls.__instance_cache__[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
#_flush_cached_by_key = classmethod(_flush_cached_by_key)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def flush_cached_instance(cls, instance, force=True):
|
def flush_cached_instance(cls, instance, force=True):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue