Trunk: Merged griatch-branch. This implements a new reload mechanism - splitting Evennia into two processes: Server and Portal with different tasks. Also cleans and fixes several bugs in script systems as well as introduces i18n (courtesy of raydeejay).

This commit is contained in:
Griatch 2011-09-03 10:22:19 +00:00
parent 14dae44a46
commit f13e8cdf7c
50 changed files with 3175 additions and 2565 deletions

View file

@ -724,7 +724,7 @@ class ObjectDB(TypedObject):
Destroys all of the exits and any exits pointing to this
object as a destination.
"""
for out_exit in self.exits:
for out_exit in [exi for exi in ObjectDB.objects.get_contents(self) if exi.db_destination]:
out_exit.delete()
for in_exit in ObjectDB.objects.filter(db_destination=self):
in_exit.delete()
@ -779,6 +779,7 @@ class ObjectDB(TypedObject):
new_key = "%s_copy" % self.key
return ObjectDB.objects.copy_object(self, new_key=new_key)
delete_iter = 0
def delete(self):
"""
Deletes this object.
@ -786,13 +787,20 @@ class ObjectDB(TypedObject):
objects to their respective home locations, as well as clean
up all exits to/from the object.
"""
if self.delete_iter > 0:
# make sure to only call delete once on this object
# (avoid recursive loops)
return False
if not self.at_object_delete():
# this is an extra pre-check
# run before deletion mechanism
# is kicked into gear.
self.delete_iter == 0
return False
self.delete_iter += 1
# See if we need to kick the player off.
for session in self.sessions:

View file

@ -75,6 +75,17 @@ class Object(TypeClass):
"""
pass
def at_init(self):
"""
This is always called whenever this
object initiated -- both when the object
is first created as well as after each restart.
It is also called after each server reload, so
if something should survive a warm-reboot (rebooting
the server without the players logging out), put it here.
"""
pass
def basetype_posthook_setup(self):
"""
Called once, after basetype_setup and at_object_creation. This should generally not be overloaded unless
@ -87,9 +98,26 @@ class Object(TypeClass):
def at_cache(self):
"""
Called whenever this object is cached to the idmapper backend.
This is the place to put eventual reloads of non-persistent attributes
you saved in the at_server_reload() below.
"""
pass
def at_server_reload(self):
"""
This hook is called whenever the server is shutting down for restart/reboot.
If you want to, for example, save non-persistent properties across a restart,
this is the place to do it.
"""
pass
def at_server_shutdown(self):
"""
This hook is called whenever the server is shutting down fully (i.e. not for
a restart).
"""
pass
def at_cmdset_get(self):
"""
Called just before cmdsets on this object are requested by the
@ -384,9 +412,9 @@ class Character(Object):
the script is permanently stored to this object (the permanent
keyword creates a script to do this), we should never need to
do this again for as long as this object exists.
pass
"""
pass
def at_after_move(self, source_location):
"Default is to look around after a move."
self.execute_cmd('look')
@ -512,7 +540,7 @@ class Exit(Object):
self.locks.add("traverse:all()") # who can pass through exit by default
self.locks.add("get:false()") # noone can pick up the exit
# an exit should have a destination (this is replaced at creation time)
# an exit should have a destination (this is replaced at creation time)
if self.dbobj.location:
self.destination = self.dbobj.location