Body Part

Stores a representation of a body part.
Return to Index
new ( string name , string type = "unknown_part" )
__gc ( )
__eq ( am.body_part rhs ) -> ( boolean )
name ( ) -> ( string )
type ( ) -> ( string )
type ( string type ) -> ( am.body_part , am.code )
can_hold_onto ( ) -> ( am.body_part )
can_hold_onto ( ) -> ( am.body_part )
can_hold_onto ( ) -> ( am.body_part )
weapon_part ( ) -> ( boolean )
weapon_part ( boolean is_weapon_body ) -> ( am.body_part )
is_holding_onto ( ) -> ( boolean )
can_equip_item ( am.item item ) -> ( boolean )
item ( am.item item ) -> ( am.body_part )
item ( ) -> ( am.item )
new ( string name , string type = "unknown_part" )
Creates a new body part instance with the given name. This name is used to identify the part when it is attached to a character.
Parameters:
string name : The body part name.
string type = "unknown_part" : The body part type.
__gc ( )
Releases body part reference counter.
__eq ( am.body_part rhs ) -> ( boolean )
Compares if two body parts are the same object.
Parameters:
am.body_part rhs : The body part to compare with.
Returns:
boolean : True if they are the same object.
name ( ) -> ( string )
Returns the name of the body part. A nil return indicates that there was an error.
Returns:
string : Body part name.
type ( ) -> ( string )
Returns the type of the body part as a string.
Returns:
string : Body part type.
type ( string type ) -> ( am.body_part , am.code )
Sets the type of the body part.
Parameters:
string type : The type to set the body part to.
Returns:
am.body_part : This
am.code : Return code. Can return either:
success The body part type was changed.
body_part_type_unknown The type name was unknown.
can_hold_onto ( ) -> ( am.body_part )
Returns the body part which this body part can aid in equipping items.
Returns:
am.body_part : The other body part that this body part can hold onto to help equip items.
can_hold_onto ( ) -> ( am.body_part )
Sets the body part which this body part can help with equipping items. Body parts which are not both added to the same character cannot help each other. @params am.body_part part_to_hold The body part to hold.
Returns:
am.body_part : This
can_hold_onto ( ) -> ( am.body_part )
Removes the body part that this part was helping. @params nil part_to_hold Remove.
Returns:
am.body_part : This
weapon_part ( ) -> ( boolean )
Returns true if this is considered a weapon body part. Weapon body parts are cycled through during the attack sequence.
Returns:
boolean : True if this is a weapon body part.
weapon_part ( boolean is_weapon_body ) -> ( am.body_part )
Sets if this body part should be used as a weapon.
Parameters:
boolean is_weapon_body : Sets if this is a weapon body part.
Returns:
am.body_part : This.
is_holding_onto ( ) -> ( boolean )
If this body part can hold onto another body part and this body part is currently helping hold onto an item then this will return true. Essentially this means that this part has an item equipped but it should not be considered a different item from the part that actually has the item equipped.
Returns:
boolean : True if this is currently helping equip another body parts item.
can_equip_item ( am.item item ) -> ( boolean )
Returns true if the given item can be equipped at all on this body part. This compares the body part type with the list of body part types that the item supports. This only indicates if the item could be equipped onto this part, it does not take into consideration other character specific requirements or if there is currently another item equipped that would prevent the item from being equipped immediately.
Parameters:
am.item item : The item to compare.
Returns:
boolean : True if the item could be equipped.
item ( am.item item ) -> ( am.body_part )
Sets the given item as the equipped item on this body part.
Parameters:
am.item item : The item to equip, can be nil.
Returns:
am.body_part : This.
item ( ) -> ( am.item )
Returns the equipped item on this body part.
Returns:
am.item : The equipped item, can be nil.