give.c

ds2.1.1/lib/lib/events/give.c · 1.0 KB

From the archive ds2.1.1.zip

Download the archive   « Back to the archive contents

/*    /lib/events/give.c
 *    From the Dead Souls Object Library
 *    Give event handler
 *    Created by Descartes of Borg 970101
 *    Version: @(#) give.c 1.1@(#)
 *    Last modified: 97/01/01
 */

// abstract methods
mixed CanDrop(object who);
string GetDefiniteShort();
int GetMass();
// end abstract methods

mixed indirect_give_liv_obj(object target) {
    mixed tmp;

    if( environment() != this_player() ) {
	return "#You cannot give what is not yours.";
    }
    tmp = CanDrop(this_player());
    if( tmp != 1 ) {
	return (tmp || "You can't drop " + GetDefiniteShort() + ".");
    }
    tmp = target->CanCarry(GetMass());
    if( tmp != 1 ) {
	return (tmp || capitalize(GetDefiniteShort()) + " is too heavy.");
    }
    return 1;
}

mixed direct_give_obj_to_liv() {
    mixed tmp;

    if( environment() != this_player() ) {
	return "#You cannot give what is not yours.";
    }
    tmp = CanDrop(this_player());
    if( tmp != 1 ) {
	return (tmp || "You can't drop " + GetDefiniteShort() + ".");
    }
    return 1;
}

Site Stats

Snippets: 1791
Codebases: 571