mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 02:06:32 +01:00
Restructured the way typeclasses are loaded. This makes it possible to run at_init() hooks at initiation also for objects without any custom cases for character/players. at_init() hooks are called only when an object is initiated. This means that a room's at_init() hook is only called when someone looks or enters it or a script operates on it, for example, rest of the time these objects are dormant, most efficiently.
This commit is contained in:
parent
0a1bcd36c2
commit
23cd9e31b1
14 changed files with 142 additions and 109 deletions
|
|
@ -252,7 +252,7 @@ class ObjectDB(TypedObject):
|
|||
"Getter. Allows for value = self.location."
|
||||
loc = self.db_location
|
||||
if loc:
|
||||
return loc.typeclass(loc)
|
||||
return loc.typeclass
|
||||
return None
|
||||
#@location.setter
|
||||
def location_set(self, location):
|
||||
|
|
@ -291,7 +291,7 @@ class ObjectDB(TypedObject):
|
|||
"Getter. Allows for value = self.home"
|
||||
home = self.db_home
|
||||
if home:
|
||||
return home.typeclass(home)
|
||||
return home.typeclass
|
||||
return None
|
||||
#@home.setter
|
||||
def home_set(self, home):
|
||||
|
|
@ -329,7 +329,7 @@ class ObjectDB(TypedObject):
|
|||
"Getter. Allows for value = self.destination."
|
||||
dest = self.db_destination
|
||||
if dest:
|
||||
return dest.typeclass(dest)
|
||||
return dest.typeclass
|
||||
return None
|
||||
#@destination.setter
|
||||
def destination_set(self, destination):
|
||||
|
|
@ -565,7 +565,7 @@ class ObjectDB(TypedObject):
|
|||
if nick.db_nick in raw_list:
|
||||
raw_string = raw_string.replace(nick.db_nick, nick.db_real, 1)
|
||||
break
|
||||
cmdhandler.cmdhandler(self.typeclass(self), raw_string)
|
||||
cmdhandler.cmdhandler(self.typeclass, raw_string)
|
||||
|
||||
def msg(self, message, from_obj=None, data=None):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ class Object(TypeClass):
|
|||
pass
|
||||
|
||||
def at_init(self):
|
||||
"""
|
||||
OBS: CURRENTLY NOT CALLED!
|
||||
|
||||
"""
|
||||
This is always called whenever this
|
||||
object initiated -- both when the object
|
||||
is first created as well as after each restart.
|
||||
|
|
@ -86,8 +84,7 @@ class Object(TypeClass):
|
|||
if something should survive a warm-reboot (rebooting
|
||||
the server without the players logging out), put it here.
|
||||
"""
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
def basetype_posthook_setup(self):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue