[Package Index | Mudlib Index | Effect Index]

File /std/living/living.c

The main living inherit. This inherits all the files needed to be in a living object.

Written by Pinkfish

Inherits

This class inherits the following classes /std/living/skills.c, /std/living/nationality.c, /std/living/carrying.c, /std/living/respond_cmd.c, /std/living/riding.c, /std/living/holding.c, /std/living/magic.c, /std/container.c, /std/living/stats.c, /std/living/health.c, /std/living/combat.c, /std/living/armour.c, /std/living/gender.c, /std/living/money.c, /std/living/crafts.c, /std/living/spells.c and /std/living/force.c

Includes

This class includes the following files /include/position.h, /include/effect_utility.h, /include/units.h, /include/minmax.h, /include/dirs.h, /include/room.h, /include/obj_parser.h, /include/tasks.h, /include/move_failures.h, /include/tune.h, /include/drinks.h and /include/living.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

add_dragging_assister
void add_dragging_assister(object thing)

This method adds in a person to assist with the dragging

Parameters:
thing - the person who will help assist


add_follower
varargs int add_follower(object ob,
int no_recurse)

This method adds a follower to the living object. A follower will happily follow around the person in front. Used in the follow command.

Parameters:
ob - the object to follow us

Returns:
1 if data was changed in follower or followee else 0

See also:
remove_follower() and query_followers()


add_following
varargs int add_following(object ob,
int no_recurse)

This method adds a following to the living object. A follower will happily follow around their followings. Used in the follow command. This is used when people are trying to follow using a skill.

Parameters:
ob - the object to follow us

Returns:
1 if data was changed in follower or followee else 0

See also:
remove_following() and query_following()


add_msgin_callback
int add_msgin_callback(string tag,
mixed callback,
int priority)

This function adds a callback for the message when this object moves into a room. This is used for e.g. shoes that make you walk funny.

Parameters:
tag - the unique id for this callback, used for removing the callback
callback - the message, either a string or a function pointer
priority - only the highest priority callback will be evaluated at each move - let's say you're wearing shoes that make you walk funny (priority 10) and then you start riding a horse (priority 100), this makes it so that you will use the horse riding message until you get off the horse again. Priority guidelines: Anything that mentions walking *must* be less than 100, because horses are priority 100. Shoes should be priority 10. If you want your message to override shoes, make it higher than 10. If your message is from wearing shoes, make it 10 unless you have a reason not to. Worn items should also be 10, if we get any non-shoe worn items that affect msgin/out. Held items should be priority 15. As usual, if you have something in mind you can set it higher or lower if you want. Effects can be anywhere from 0-25. The priority should be based on how much it affects the way you walk. For example, if I'm hopping on one leg this should override any sort of sashaying or swaggering I am doing and so have a high priority.

Returns:
1 if the callback was added, 0 if there was already a callback with this tag

See also:
add_msgout_callback()


add_msgout_callback
int add_msgout_callback(string tag,
mixed callback,
int priority)

Like add_msgin_callback but for the message when this object moves out of this room.

See also:
add_msgin_callback()


add_skill_follower
varargs int add_skill_follower(object ob,
int no_recurse)

This method adds a skill follower to the living object. A follower will happily follow around the person in front. Used in the pursue command. This is used when people are trying to follow using a skill.

Parameters:
ob - the object to follow us

Returns:
1 if data was changed in follower or followee else 0

See also:
remove_follower() and query_followers()


add_skill_following
varargs int add_skill_following(object ob,
int no_recurse)

This method adds a skill following to the living object. A follower will happily follow around their followings. Used in the pursue command. This is used when people are trying to follow using a skill.

Parameters:
ob - the object to follow us

Returns:
1 if data was changed in follower or followee else 0

See also:
remove_skill_following() and query_skill_following()


adjust_al
int adjust_al(int number)

This method adjusts the current alignment of the living object.

Parameters:
number - the amount to change the alignment by

Returns:
the new alignment

See also:
query_al(), set_al(), adjust_alignment(), align_string() and alignment .c


adjust_alignment
int adjust_alignment(int number)

This method adjusts the current alignment of the living object. This is called when an object dies and handles the mangling of the change value based on the current alignment and the alignment of the thing dieing.

Parameters:
number - the amount to change the alignment by

Returns:
the new alignment

See also:
query_al(), adjust_al(), set_al(), align_string() and alignment .c


adjust_deity_favour
void adjust_deity_favour(string god,
int amount)

Adjust the favour rating for 'god' by amount. A +ve amount is good favour, a negative is bad.
align_string
string align_string()

This method returns the string associated with the current alignment of the living object.

Returns:
the string associated with the alignment

See also:
query_al(), adjust_al(), adjust_alignment(), set_al() and alignment .c


attack_by
int attack_by(object ob)
become_flummoxed
void become_flummoxed()
burden_string
string burden_string()

This method returns the string representation of the current burden level.

Returns:
the burden string

See also:
calc_burden() and query_burden()


calc_burden
void calc_burden()

This method calculates the current handicap of the living object. The handicap is based on the burden of the person, the more burdened the higher the handicap. The handicap is 1 point of dexterity for every 25% burdened.

See also:
query_handicap() and query_burden()


calculate_scroll_destroy_power
int calculate_scroll_destroy_power(int total_scroll_power)

Calculate how much scroll power is going to escape from this living for a given total scroll power
cannot_walk
varargs int cannot_walk(string verb,
mixed * dest_other)

This method returns 1 if the creature is trapped, ie cannot walk. By default, a creature is free to walk, hence the normal return value of 0. If you shadow this method, including a message about why the player cannot move move is a good idea.

Parameters:
verb - the exit direction that the player is trying to move.
dest_other - the destination information for the exit.

Returns:
0 means creature is free to move, 1 that it is trapped.

See also:
/std/room->query_dest_other()


check_doing_follow
int check_doing_follow(object thing,
string verb,
mixed special)

This is a method to check to see if this object can actually follow the person they are following.

Parameters:
thing - the thing following us
verb - the direction they are going to
special - The leave message

Returns:
1 if we are allowed to go there, 0 otherwise


check_scrolls
void check_scrolls()

Check whether there is too much magic, and do Bad Stuff(TM) if so! This is called by call_out from living::event_enter.
do_burden_call
void do_burden_call()
eat_this
void eat_this(object food)

This method allows you to make the living object eat something.

Parameters:
food - the food object to eat


exit_command
varargs int exit_command(string word,
mixed verb,
object thing,
int redirection,
int recurse)
find_abs
string find_abs(string word)

Finds the absolute direction from the input relative direction.

Parameters:
word - the exit name ('left', 'right', ...)

Returns:
the absolute direction


find_rel
string find_rel(string word,
int from)

This method finds the relative direction from the passed in direction.

Parameters:
word - the exit name ('east', 'west',...)
from - the offset to find the exit from

Returns:
the relative direction


force_burden_recalculate
void force_burden_recalculate()

This forces a burden recalculation. This should also be used to force a recalcuation of the number of items someone can carry.
living_commands
void living_commands()

This method adds any commands needed by the living inherit.
move_with_look
varargs int move_with_look(mixed dest,
string messin,
string messout)
now_removed_item
void now_removed_item(object item)
now_worn_item
void now_worn_item(object item)
query_al
int query_al()

This method returns the current alignment of the living object.

Returns:
the current alignment

See also:
set_al(), adjust_al(), adjust_alignment(), align_string() and alignment .c


query_all_deity_favour
mapping query_all_deity_favour()

Return the deity favour mapping.
query_always_use_default_position
int query_always_use_default_position()

This method sets the always the flag to always use the default position. If this is set then rooms cannot override the position message which is displayed by the object.

Returns:
the always use default position flag

See also:
set_always_use_default_position(), set_default_position() and return_to_default_position()


query_arcane_shields
varargs string * query_arcane_shields( object)

This method can be shadowed by all forms of magical and religious shields so that the shields command will give the player a nice description. The first element in the array should contain the description as shown to the player, the second element should contain the description shown to others.

Returns:
Array with description of shield.

Example:
({ "You have a nice shield.", "He has a nice shield." })

query_burden
int query_burden()

This method returns the current burden level of the living object. This is returned as a percentage of the maximum weight that the living can carry.

Returns:
the burden level (0-100)


query_burden_limit
int query_burden_limit()
query_combat_burden
int query_combat_burden()

This method returns the current combat burden level of the living object. The combat burden takes into account that armour sometimes has a smaller effect (depending on guild).
query_current_room
object query_current_room()

This method returns the current room of the object. This was needed previously to use in things like unique_array, before function pointers came into existance.

Returns:
the environment of the object


query_default_position
varargs mixed query_default_position(object ob)

This method sets the default position of the object. This is used to allow things to default to some other exciting off beat and froopy default position. The value returned by this is the command code used to put the object back into the default position or an array which contains three or one elements, the first is the string to use as the position, the second and third (if they exist) are the string to tell the person when changing and the string to tell everyone else when changing position.

Returns:
the default position

See also:
set_default_position(), return_to_default_position() and set_always_use_default_position()


query_deity
string query_deity()

This method returns the current deity the living object is worshipping.

Returns:
the current deity

See also:
/obj/handlers/diety_handler.c and set_deity()


query_deity_favour
int query_deity_favour(string god)

If there is no mapping for deity favour, or if the God is not mentioned, return 0 as 'no favour'. Otherwise return the favour amount.
query_distracted
varargs string query_distracted(int severity,
int every_reason)
query_dragging
object query_dragging()

This method returns the object we are dragging.

Returns:
the thing we are dragging


query_dragging_assisters
object * query_dragging_assisters()

This method returns the people who are assisting us drag.

Returns:
the people assisting us drag


query_facing
mixed * query_facing()
query_followers
object * query_followers()

This method returns the current list of followers of the living object.

See also:
add_follower() and remove_follower()


query_following
object * query_following()

This method returns the current list of followings of the living object.

See also:
add_following() and remove_following()


query_handicap
int query_handicap()

This method returns the current handicap of the living object.

Returns:
the current handicap.

See also:
calc_burden()


query_it_them
class obj_match_context query_it_them()

This method returns the current array used for calculating 'it' and 'them' in the find_match code.

Returns:
the array of objects matching them

See also:
/secure/simul_efun->find_match() and set_it_them()


query_living_owner
object query_living_owner(object thing)

Identify the living object this is contained within directly or otherwise, if there is one
query_mmsgin
string query_mmsgin()

THis is the message to be used when the person is teleported.

Returns:
the in message when they teleport


query_mmsgout
string query_mmsgout()

THis is the message to be used when the person is teleported.

Returns:
the out message when they teleport


query_msgin
string query_msgin()

This is the method used to query the current message to use when entering a room. A $N in the string will be expanded to the name and a $F will be expanded to the from direction.

Returns:
the message to print when entering a room.

See also:
/obj/handlers/room_handler.c, query_msgout() and set_msgin()


query_msgout
string query_msgout()

This is the method used to query the current message to use when exiting a room. A $N in the string will be expanded to the name and a $T will be expanded to the to direction.

Returns:
the message to print when entering a room.

See also:
/obj/handlers/room_handler.c, query_msgin() and set_msgout()


query_objective
string query_objective()

This method returns the objective string of the living object. An objective is "her", "him", "it".

Returns:
the objective string


query_position
string query_position()

This queries the current position of the object.

Returns:
the current position of the living

See also:
query_position_on(), query_position_multiple(), query_position_type(), set_position(), set_position_on(), set_position_multiple() and set_position_type()


query_position_long
string query_position_long()

This method returns the string used in the long description of the living object.

Returns:
the long description of the position

See also:
query_position_type() and query_position_on_short()


query_position_multiple
int query_position_multiple()

This returns fact that the object being referenced is one of many. So you get something more like 'xx is sitting on one of the couches'.

Returns:
0 if non-multiple, 1 if multiple

See also:
query_position_on(), query_position_multiple(), query_position_type(), set_position(), set_position_on(), set_position_multiple() and set_position_type()


query_position_on
mixed query_position_on()

This queries the current object being referenced. This can be an object or a string.

Returns:
the current object being referenced

See also:
query_position(), query_position_multiple(), query_position_type(), set_position(), set_position_on(), set_position_multiple() and set_position_type()


query_position_on_short
string query_position_on_short()

This method returns the short description of the object we are referencing.

Returns:
the short description of the object, "" if none

See also:
query_position_on(), set_position_on() and query_position_long()


query_position_short
string query_position_short()

This method returns the description used in the inventory listing code.

Returns:
the string used in inventory listings

See also:
query_position_long(), query_position_on_short() and query_position_type()


query_position_type
string query_position_type()

This returns way the object is being referenced. The 'on', 'at', 'beside' or whatever strings.

Returns:
the current type string

See also:
query_position(), query_position_on(), query_position_multiple(), set_position(), set_position_on(), set_position_multiple() and set_position_type()


query_possessive
string query_possessive()

This method returns the prossessive string of the living object. A possessive is "her", "his", "its".

Returns:
the possessive string


query_pronoun
string query_pronoun()

This method returns the pronoun string of the living object. A pronoun is "he", "she", "it".

Returns:
the pronoun string


query_single_shoulder_burden
int query_single_shoulder_burden()
query_skill_followers
object * query_skill_followers()

This method returns the current list of skill based followers of the living object.

See also:
add_skill_follower() and remove_skill_follower()


query_skill_following
object * query_skill_following()

This method returns the current list of skill based followings of the living object.

See also:
add_skill_following() and remove_skill_following()


query_verbose
int query_verbose(string type)

This method returns the current verbose mode setting of the player.

Parameters:
the - type of verbosity, by default it will return the normal stuff.

Returns:
the verbose mode of the player


query_verbose_settings
mapping query_verbose_settings()

This function returns the current verbose/brief settings.
query_verbose_types
string * query_verbose_types()

This method returns the current verbose/brief types.
recalc_single_shoulder_burden
void recalc_single_shoulder_burden()
remove_dragging_assister
void remove_dragging_assister(object thing)

This method removes a person who is assisting us drag.

Parameters:
thing - the person who will help assist


remove_follower
varargs int remove_follower(object ob,
int no_recurse)

This method removes a follower from the living object. A follower will happily follow around the person in front. Used in the unfollow and lose commands.

Parameters:
ob - the object to remove from the follow list

Returns:
1 if data was changed in follower or followee else 0

See also:
add_follower() and query_followers()


remove_following
varargs int remove_following(object ob,
int no_recurse)

This method removes a following from the living object. A follower will happily follow around their followings.

Parameters:
ob - the object to remove from the follow list

Returns:
1 if data was changed in follower or followee else 0

See also:
add_following() and query_following()


remove_msgin_callback
mixed remove_msgin_callback(string tag)
remove_msgout_callback
mixed remove_msgout_callback(string tag)
remove_skill_follower
varargs int remove_skill_follower(object ob,
int no_recurse)

This method removes a follower from the living object. A follower will happily follow around the person in front. This is used when the player is trying to follow someone with a skill. It will be automatically updated whenever the person being follow loses you.

Parameters:
ob - the object to remove from the follow list

Returns:
1 if data was changed in follower or followee else 0

See also:
add_follower() and query_followers()


remove_skill_following
varargs int remove_skill_following(object ob,
int no_recurse)

This method removes a following from the living object. A follower will happily follow around their followings. This is used when the player is trying to follow someone with a skill. It will be automatically updated whenever the following loses their follower.

Parameters:
ob - the object to remove from the follow list

Returns:
1 if data was changed in follower or followee else 0

See also:
add_skill_following() and query_skill_following()


reorient_abs
void reorient_abs(string verb)

This method takes in a absolute direction and reorients us in the correct way to go in that direction.

Parameters:
word - the direction to look up


reorient_rel
string reorient_rel(string word)

This method takes in a relative direction and reorients us in the correct way to go in that direction. This also updates our facing so we are facing in the specified relative direction.

Parameters:
word - the direction to look up

Returns:
the real direction


reset_dragging
void reset_dragging()

This method resets the object we are dragging.
reset_dragging_assisters
void reset_dragging_assisters()

This method removes all the people who are helping us drag.
reset_following
void reset_following()

This method resets all the people following this person. it is use dby the death code to make sure that no one is following or purseuing the dead person any more.
return_to_default_position
varargs void return_to_default_position(int leaving)

This method returns the living object to its default position.

Parameters:
leaving - this is if we are leaving the room

See also:
set_default_position(), query_default_position() and set_always_use_default_position()


room_look
int room_look()

This is used by the movement system to look in the room when we move. It does checks for verbose and other checks before doing the look.
run_away
varargs int run_away(object from)
send_position_event
void send_position_event()

This method sends the position changing event. This is called a little after the event acutally occurs so it catches all the possible changes. This called the event: event_position_change on the environment with the following arguments.

void event_position_change(
position,
on_object,
type,
multiple
, who);

set_al
void set_al(int number)

This method sets the current alignment of the living object.

Parameters:
number - the new alignment for the object

See also:
query_al(), adjust_al(), adjust_alignment(), align_string() and alignment .c


set_always_use_default_position
void set_always_use_default_position(int flag)

This method sets the always the flag to always use the default position. If this is set then rooms cannot override the position message which is displayed by the object.

Parameters:
flag - if we should always use the default position

See also:
query_always_use_default_position(), set_default_position() and return_to_default_position()


set_default_position
void set_default_position(mixed str)

This sets the default position of the object. This is used to allow things to default to some other exciting off beat and froopy default position. The paramater to this is the command code used to put the object back into the default position or an array which contains three or one elements, the first is the string to use as the position, the second and third (if they exist) are the string to tell the person when changing and the string to tell everyone else when changing position. The paramer can also be a function pointer, if it is then it will be evaluated and have two parameters passed into the function. The first is the object returing to the position and the second is the leaving flag.

Please note! After setting the position you will need to make the object return to the default position to use it.

A second note! A room can also define a query_default_position() function which will be called, if this returns a value (and the override flag is not set) then that will be used for the default position.

Parameters:
str - the new default position

See also:
query_default_position(), set_always_use_default_position(), /obj/monster()->set_cannot_change_position() and return_to_default_position()

Example:
set_default_position("/cmds/living/kneel");

set_default_position(({ "running" }));

set_default_position(({ "fishing",
                        "You start to fish.\n",
                        the_short() + " starts to fish.\n" }));

npc->set_default_position(({ "running" }));
npc->return_to_default_position(1);

set_deity
void set_deity(string word)

This method sets the current deity the living object is worshipping.

Parameters:
word - the new deity

See also:
/obj/handlers/diety_handler.c and query_deity()


set_dragging
void set_dragging(object thing)

This method sets the object for us to drag when we try and leave.

Parameters:
thing - the object to drag off


set_facing
void set_facing(mixed * args)

The facing array is a list of directions and two integers which determine which way we face. The layout is:
({ facing, ({ dirs }), up_down_facing, ({ up_down_dirs }) })

Parameters:
args - the facing arguments


set_it_them
void set_it_them(class obj_match_context args)

This method sets the current array used for calculating 'it' and 'them' in the find_match code.

Parameters:
args - the new array of objects

See also:
/secure/simul_efun->find_match() and query_it_them()


set_mmsgin
int set_mmsgin(string str)

The teleport in message. Sets the message to be seen when a player telerpots into the room.

Parameters:
str - the message to be seen


set_mmsgout
int set_mmsgout(string str)

Sets the teleport out message. If the player teleports out, this is the message seen.

Parameters:
str - the teleport message


set_msgin
int set_msgin(string str)

This is the method used to set the current message to use when entering a room. A $N in the string will be expanded to the name and a $F will be expanded to the from direction.

Parameters:
str - the message to print when entering a room

See also:
/obj/handlers/room_handler.c, query_msgin() and set_msgout()


set_msgout
int set_msgout(string str)

This is the method used to query the current message to use when exiting a room. A $N in the string will be expanded to the name and a $T will be expanded to the to direction.

Returns:
the message to print when entering a room.

See also:
/obj/handlers/room_handler.c, query_msgout() and set_msgin()


set_position
void set_position(string name)

This sets the current position of the object.

Parameters:
name - the string to use for the position

See also:
query_position(), query_position_on(), query_position_multiple(), query_position_type(), set_position_on(), set_position_multiple(), set_position_type() and send_position_event()


set_position_multiple
void set_position_multiple(int mult)

This sets fact that the object being referenced is one of many. So you get something more like 'xx is sitting on one of the couches'.

Parameters:
mult - 0 if non-multiple, 1 if multiple

See also:
query_position(), query_position_on(), query_position_multiple(), query_position_type(), set_position(), set_position_multiple(), set_position_type() and send_position_event()


set_position_on
void set_position_on(mixed ob)

This sets the current object which is being referenced as being 'on', 'beside' or 'at'.

Parameters:
ob - the object being referenced

See also:
query_position(), query_position_on(), query_position_multiple(), query_position_type(), set_position(), set_position_multiple(), set_position_type() and send_position_event()


set_position_type
void set_position_type(string type)

This sets way the object is being referenced. The 'on', 'at', 'beside' or whatever strings.

Parameters:
type - the new type string

See also:
query_position(), query_position_on(), query_position_multiple(), query_position_type(), set_position(), set_position_on(), set_position_multiple() and send_position_event()


set_verbose
void set_verbose(string type,
int val)

This method sets the verbosity for a given type.
test_add
int test_add(object ob,
int flag)

This method handles the cannot get flags. This is placed into the living object so that things which are marked as being unable to be picked up can still be put into normal containers. The upwards checking of containers stops here. This should make it so that objects marked as unable to be picked up cannot be put into objects in the players inventory.

Returns:
1 if the object can be added, 0 if not.


test_remove
int test_remove(object ob,
int flag,
mixed dest)

This method handles the cannot drop flags. This is placed into the living object so that things which are marked as being unable to be dropped can still be remove from normal containers. This does all sorts of other exciting checks now.

Returns:
1 if the object can be added, 0 if not.


Classes

These are nice data types for dealing with... Data!