builder.c--

./world-0.5/src/builder.c-- · 933 B

From the archive Glacier-0.5.tar.gz

Download the archive   « Back to the archive contents

    Generic builder

parent user
object builder

eval
    .initialize();
    .set_name("BuilderBob");
    .add_command("@dig * to *", 'template, 'dig_to_cmd);
    .add_command("@dig *", 'template, 'dig_cmd);
.

method dig_cmd
    arg dummy1, name;
    var room;

    room = $room.spawn(name);
    .tell("Created new room " + toliteral(room) + ".");
.

method dig_to_cmd
    arg dummy1, exitname, dummy2, roomname;
    var room, exit;

    if (roomname && roomname[1] == "$") {
	room = todbref(substr(roomname, 2));
    } else {
	room = $room.spawn(roomname);
	.tell("Created new room " + toliteral(room) + ".");
    }
    exit = $exit.spawn(exitname);
    catch ~perm {
	exit.attach(.location());
	exit.link(room);
    } with handler {
	exit.destroy();
	.tell("Couldn't make exit from here to " + toliteral(room) + ": Permission denied.");
	return;
    }
    .tell("Created exit \"" + exitname + "\" to room " + toliteral(room));
.

Site Stats

Snippets: 1791
Codebases: 571