rope

obj
OBJECT
	/obj/rope


SYNOPSIS
	#include <rope.h>
	inherit "/obj/rope";

	  OR

	clone_object ("/obj/rope");

LAST UPDATE
	Suamor, 13-Jul-95 11:30 MET


DESCRIPTION
	The /obj/rope is a simple generic rope, usable to be tied to
	things, or optionally to tie two things in one room together.
	The things may be normal objects or details. If the latter
	is applied to two livings, the livings may pull	each other
	around.

	If /obj/rope is just cloned, it's preconfigured to be a
	'rop' of 15 coins worth and 4 kg weight. It then allows just
	one object (or detail) being tied.

	The rope may be tie and untied:

	  tie rope to <object>
	  untie rope from <object>

        If the rope is tied to an object, it will be moved into the
        environment of the player and it can't be taken unless it is
        untied again. If the rope may be tied to two objects, the
        command has to issued for each of the objects. Also it has
        to be untied from both objects before it can be taken again.

	The rope is a normal /std/thing. It offers additionally these
	properties:

	  int P_ALLOW_TIE2   "AllowTie2"
	    When non-zero, the rope my tie two objects together.

	  object * P_TIED    "Tied"
	    An array of the two objects the rope is tied to.
	    If the rope is not tied to anything, the array contains
	    two zeroes. If the rope is tied with one end, the array's
	    first entry holds the object, the second is 0.
	    If the rope is tied with both ends, the array contains the
	    both tied objects in random order.
	    The function 'SetTied()' may be called with just one
	    object as argument, which is then tied to the yet free end
	    of the rope if there is one.

	  object * P_UNTIED   "Untied"
	    This property can only be set. It is used to specify the
	    object(s) the rope is to be untied from. Result is the new
	    P_TIED value.

	The rope may be tied to details, too. To do this, the room must
	set the following property:
        
	  mapping P_FASTENING "Fastening"
	    It offers you to specify not only the detail you want to
	    tie the rope to, but also a short description of the detail,
	    for example: (["tree":"a big branch of a tree"]). This 
	    description will be added to the Short (and Long) description
	    of the rope.

	  public mapping AddFastening(mixed id, string descr)
	    You can add a detail to the already existing details of the
	    specified room. The mapping is only stored in the room.
	    Therefore the "real" object the rope is tied to, is this room.
	    The function itself queries first the existing mapping and
	    sets then P_FASTENING with the new added property.

	The rope offers the possibility to tie it to a detail which is in
	another room, but must be visible from the actual room, i.e. the
	player must be able to look at it and it must be tie-able in the
	actual room. Then you may specify another room where this detail
	really lies:
        
	  string P_VISIBLE_ROOM "VisibleRoom"       
	    You have to specify the full filename of the room and this file
	    must have the same detail and it must be tie-able, too.

	Objects which don't want to be tied or untied, may specify one
	or both of these properties:

	   mixed P_NO_TIE     "NoTie"
	   mixed P_NO_UNTIE   "NoUntie"
	     If the property is non-zero, the associated command is
	     not possible. If the properties setting is a string, it
	     is used as the failure message to issue, else a default
	     message will be generated.

	The action functions are these:

	  int TieTo (object ob)
	    Tie the rope to object <ob>. On failure, set appopriate
	    notify_fail()-messages.
	    Result:
	      0: Ok, rope is tied.
	      1: Rope has no free end to tie to <ob>.
	      2: <ob> won't be tied (its P_NO_TIE is non-zero).

	  int UntieFrom (object ob)
	    Untie the rope from object <ob>. On failure, set appopriate
	    notify_fail()-messages.
	    Result:
	      0: Ok, rope is untied.
	      1: Rope was not tied to <ob> at all.
	      2: <ob> won't be untied (its P_NO_UNTIE is non-zero).

	  string MyShort ()
	    Returns a string describing the objects and/or details
	    the rope is tied to, if any. This function is used to
	    modify the ropes description.

	  string CheckNoMove ()
	    Return 0, if the rope may be dropped/taken/given, else a
	    string with the failure message.
	    This function is used to prevent such player actions.


	The player commands are executed by

	  int ftie (string arg)
	  int funtie (string arg)

	This function tests, if any details may be tied to the rope:
        
	  string dtie(string arg)
	    It is called from ftie() and funtie() when the specified
            object could not be found the rope should be tied to.

	The following functions of the /std/thing are overloaded:

	  string Short (string what)
	  string Long (string what)
	    Return the ropes short/long description as returned by
	    thing::Short()/thing::Long(), expanded to include the
	    objects the rope is tied to.

	  string P_NOGET    "NoGet"
	  string P_NOGIVE   "NoGive"
	  string P_NODROP   "NoDrop"
	    If the setting of these properties is 0, the result from
	    CheckNoMove() is returned.

	  void follow (mixed dest, int method, mixed extra)
	    This function handles if the rope may be moved at all, and
	    if the move has to pull something else with it.

	  void init ()
	    Adds the commands 'tie' and 'untie'.


CREDITS
	The rope was originally written by Suamor.


BUGS
        Concerning P_VISIBLE_ROOM:

	You cannot specify a detail in the firest room and
	then use an object in the second room, because the object is
	only set when you tie/untie it. This should propably be added.

INHERITANCE TREE
	rope
          `-std/thing
              |-std/base
	      |-std/thing/moving
	      |-std/thing/properties
	      `-std/thing/description


SEE ALSO
	thing(S)