diff --git a/src/cmdhandler.py b/src/cmdhandler.py index cb67582729..8d9142a988 100755 --- a/src/cmdhandler.py +++ b/src/cmdhandler.py @@ -180,9 +180,7 @@ def match_exits(command): # it's not traversible. if targ_exit.get_home(): # SCRIPT: See if the player can traverse the exit - if not targ_exit.scriptlink.default_lock({ - "pobject": source_object - }): + if not targ_exit.scriptlink.default_lock(source_object): source_object.emit_to("You can't traverse that exit.") else: source_object.move_to(targ_exit.get_home()) diff --git a/src/commands/general.py b/src/commands/general.py index 507f11cdcf..51df9a9530 100644 --- a/src/commands/general.py +++ b/src/commands/general.py @@ -136,15 +136,10 @@ def cmd_look(command): target_obj = source_object.get_location() # SCRIPT: Get the item's appearance from the scriptlink. - source_object.emit_to(target_obj.scriptlink.return_appearance({ - "target_obj": target_obj, - "pobject": source_object - })) + source_object.emit_to(target_obj.scriptlink.return_appearance(source_object)) # SCRIPT: Call the object's script's a_desc() method. - target_obj.scriptlink.a_desc({ - "target_obj": source_object - }) + target_obj.scriptlink.a_desc(source_object) GLOBAL_CMD_TABLE.add_command("look", cmd_look) def cmd_get(command): @@ -184,9 +179,7 @@ def cmd_get(command): exclude=source_object) # SCRIPT: Call the object's script's a_get() method. - target_obj.scriptlink.a_get({ - "pobject": source_object - }) + target_obj.scriptlink.a_get(source_object) GLOBAL_CMD_TABLE.add_command("get", cmd_get) def cmd_drop(command): @@ -218,9 +211,7 @@ def cmd_drop(command): exclude=source_object) # SCRIPT: Call the object's script's a_drop() method. - target_obj.scriptlink.a_drop({ - "pobject": source_object - }) + target_obj.scriptlink.a_drop(source_object) GLOBAL_CMD_TABLE.add_command("drop", cmd_drop), def cmd_examine(command): diff --git a/src/objects/managers/object.py b/src/objects/managers/object.py index ead676dda1..3e42b8a528 100644 --- a/src/objects/managers/object.py +++ b/src/objects/managers/object.py @@ -340,6 +340,10 @@ class ObjectManager(models.Manager): "owner": None} user_object = self.create_object(odat) + # The User and player Object are ready, do anything needed by the + # game to further prepare things. + user_object.scriptlink.at_player_creation() + # Activate the player's session and set them loose. command.session.login(user) print 'Registration: %s' % (command.session, user_object.get_name()) diff --git a/src/script_parents/basicobject.py b/src/script_parents/basicobject.py index 50a35a01c1..3b4bfe0232 100644 --- a/src/script_parents/basicobject.py +++ b/src/script_parents/basicobject.py @@ -18,27 +18,27 @@ class EvenniaBasicObject(object): """ self.source_obj = source_obj - def a_desc(self, values): + def a_desc(self, pobject): """ Perform this action when someone uses the LOOK command on the object. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Un-comment the line below for an example - #print "SCRIPT TEST: %s looked at %s." % (values["pobject"], self.source_obj) + #print "SCRIPT TEST: %s looked at %s." % (pobject, self.source_obj) pass - def return_appearance(self, values): + def return_appearance(self, pobject): """ Returns a string representation of an object's appearance when LOOKed at. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ + # This is the object being looked at. target_obj = self.source_obj - pobject = values["pobject"] - + # See if the envoker sees dbref numbers. show_dbrefs = pobject.sees_dbrefs() description = target_obj.get_description() @@ -80,60 +80,60 @@ class EvenniaBasicObject(object): return retval - def a_get(self, values): + def a_get(self, pobject): """ Perform this action when someone uses the GET command on the object. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Un-comment the line below for an example - #print "SCRIPT TEST: %s got %s." % (values["pobject"], self.source_obj) + #print "SCRIPT TEST: %s got %s." % (pobject, self.source_obj) pass - def a_drop(self, values): + def a_drop(self, pobject): """ Perform this action when someone uses the GET command on the object. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Un-comment the line below for an example - #print "SCRIPT TEST: %s dropped %s." % (values["pobject"], self.source_obj) + #print "SCRIPT TEST: %s dropped %s." % (pobject, self.source_obj) pass - def default_lock(self, values): + def default_lock(self, pobject): """ This method returns a True or False boolean value to determine whether the actor passes the lock. This is generally used for picking up objects or traversing exits. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Assume everyone passes the default lock by default. return True - def use_lock(self, values): + def use_lock(self, pobject): """ This method returns a True or False boolean value to determine whether the actor passes the lock. This is generally used for seeing whether a player can use an object or any of its commands. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Assume everyone passes the use lock by default. return True - def enter_lock(self, values): + def enter_lock(self, pobject): """ This method returns a True or False boolean value to determine whether the actor passes the lock. This is generally used for seeing whether a player can enter another object. - values: (Dict) Script arguments with keys: - * pobject: The object requesting the action. + values: + * pobject: (Object) The object requesting the action. """ # Assume everyone passes the enter lock by default. return True diff --git a/src/script_parents/basicplayer.py b/src/script_parents/basicplayer.py index 8f3719e83d..e0d459608c 100644 --- a/src/script_parents/basicplayer.py +++ b/src/script_parents/basicplayer.py @@ -9,6 +9,14 @@ import time from src import comsys class EvenniaBasicPlayer(object): + def at_player_creation(self): + """ + This is triggered after a new User and accompanying Object is created. + By the time this is triggered, the player is ready to go but not + logged in. + """ + pass + def at_pre_login(self, session): """ Everything done here takes place before the player is actually