Table of Contents

Class: Wearable mudlib/employable.py

Wearable objects are items that can be worn by an Interactive. Worn items cover certain parts of the body, which must be specified. Interactives may not wear two items that cover the same body part. Body parts are defined in the constants module.

Base Classes   
core.Object
Methods   
addCoveredBodyPart
addWornOnBodyPart
canLeaveEnvironment
cannotRemove
cannotWear
clearWornOnBodyParts
createObject
createWearable
enterEnvironment
getCoveredBodyParts
getWornOnBodyParts
leaveEnvironment
remove
removeAction
wear
wearAction
  addCoveredBodyPart 
addCoveredBodyPart ( self,  bodyPart )

Sets the the list of body parts covered by this item if worn. Each element in the list should be a constant from the constants module. The interactive will not be able to wear this item if the body parts are not available or are already covered by another wearable item.

arguments:

bodyPart
(string) the body part that would be covered (see mudlib.constants for constants)

  addWornOnBodyPart 
addWornOnBodyPart ( self,  bodyPart )

Adds a bodypart to the list that this item is currently covering.

Note that is different from the addCoveredBodyPart. That method is used to add a body part that will be covered when this item is worn. This method is used to indicate that the bodypart is now covered, presumably because this item is now being worn.

arguments:

bodyPart
(string) the body part being covered (see mudlib.constants for constants)
  canLeaveEnvironment 
canLeaveEnvironment ( self,  environment )

Determines if this item can leave its current environment.

This implementation queries the cannotRemove method to determine if the item can be removed. You should not generally override this method, but should instead make sue of the cannotRemove method to restrict when an item can be removed.

see mudlib.core.Object

  cannotRemove 
cannotRemove ( self,  interactive )

This method is invoked when an interactive expresses a desire to remove this item. It should return a failure message if the interactive cannot remove it, false otherwise. Note that this method need not worry about standard checks. Any checks in this method should be above and beyond the normal ones.

arguments:

interactive
(mudlib.living.Interactive) the interactive to test

returns:

a failure string (true) if it cannot be removed or 0 (false)

  cannotWear 
cannotWear ( self,  interactive )

This method is invoked when an interactive expresses a desire to wear this item. It should return a failure message if the interactive cannot wear it, or false otherwise. Note that this method need not worry about standard checks such as whether the body part is available or if the item is already worn. Any checks in this method should be above and beyond the normal ones.

arguments:

interactive
(mudlib.living.Interactive) the interactive to test

returns:

a failure string (true) if it cannot be worn or 0 (false)

  clearWornOnBodyParts 
clearWornOnBodyParts ( self )

Clear list of bodyparts currently covered by this item.

This method will effectively indicate that this item is no longer covering any body parts, presumably because it has now been removed.

  createObject 
createObject ( self )

  createWearable 
createWearable ( self )

The "constructor" for wearable objects. You should override this method and include any required initialization, if necessary. You should NOT override __init__ or createObject.

  enterEnvironment 
enterEnvironment ( self,  newEnvironment )

Bind wear and remove actions to interactive.

see mudlib.core.Object

  getCoveredBodyParts 
getCoveredBodyParts ( self )

Returns the list of body parts that this item covers. Each body part is a constant from the constants module.

returns:

(list of strings) all the body parts this wearable would cover

  getWornOnBodyParts 
getWornOnBodyParts ( self )

Retrieve list of body parts currently covered by this item.

Note that is different from the getCoveredBodyParts method. That method is used to retrieve body part that will be covered when this item is worn. This method is used to retrieve bodyparts that are now covered, presumably because this item is now being worn.

returns:

(list of strings) all the body parts this wearable is covering

  leaveEnvironment 
leaveEnvironment ( self,  oldEnvironment )

Unbind wear and remove actions from interactive.

see mudlib.core.Object

  remove 
remove ( self )

This method is invoked when this item is actually removed. If you want to do any special handling, you should override this method.

  removeAction 
removeAction (
        self,
        actionString,
        arguments,
        rawinput,
        )

Implements the remove <employable> command.

  wear 
wear ( self )

This method is invoked when this item is actually worn. If you want to do any special handling, you should override this method.

  wearAction 
wearAction (
        self,
        actionString,
        arguments,
        rawinput,
        )

Implements the wear <employable> command.


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0