Base class for all shadows.
Note that a single instance of a shadow can only shadow one
object instance. If it's desired to shadow multiple objects,
multiple shadow instances will need to be created (one per
object).
To properly support object saving and loading, shadows support
a getOriginalClass method. Even if multiple shadows are placed
upon an object, this method will properly return the class of
the original object.
Methods
|
|
__init__ getOriginalClass getUniqueShadowName removeShadow setUniqueShadowName shadowLoaded shadowObject shadowRemoved
|
|
__init__
|
__init__ ( self )
|
|
getOriginalClass
|
getOriginalClass ( self )
Retrieve the class of the original object shadowed by this shadow.
If multiple shadows are on the object, this method will still
return the class of the original object, not the class of any
shadows "underneath" this one. Returns None if this shadow is
not currently shadowing an object. |
|
getUniqueShadowName
|
getUniqueShadowName ( self )
Returns a name unique to this shadow class.
This method is used by the removeShadow method to remove a
named shadow. It's important that the value returned from
this method uniquely identifies a particular shadow class
so that it will be removed properly without accidental
removal of an unintended shadow.
This method defaults to returning the python path of this
shadow, which should be suitable for most purposes.
returns:
(string) |
|
removeShadow
|
removeShadow ( shadowedObject, uniqueShadowName=None )
Removes a named shadow from an object.
If a shadow name is not specified, then this method simply
removes the last shadow previously added to the object. |
|
setUniqueShadowName
|
setUniqueShadowName ( self, name )
Sets the unique name for this shadow.
By default this is the python path for this shadow class.
Typically you shouldn't have to change it.
arguments:
-
name
- (string)
|
|
shadowLoaded
|
shadowLoaded ( self, shadowedObject )
Invoked after this shadow is loaded onto an object.
If you need to do any additional initialization following
loading of this shadow onto an object, you should override this
method. |
|
shadowObject
|
shadowObject ( self, targetObject )
Install this shadow onto the given target object.
arguments:
-
targetObject
- (MudObject) the object to "shadow"
|
|
shadowRemoved
|
shadowRemoved ( self, shadowedObject )
Invoked after this shadow has been removed from an object.
If you need to do any additional cleanup following
removal of this shadow, you should override this method. |
|