rumble.c

skylib_mudos_v1/mudlib/cmds/admin/rumble.c · 2.1 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/**
 * Little toy command for admin by Shiannar.
 */

inherit COMMAND_BASE;

private void rumble2(object person, object rumbler, int type);

private varargs void pimp_shout( string words, object avoid ) {
    object thing, *things;
    things = users();
    foreach( thing in things ) {
        if ( ( thing != avoid ) )
            thing->event_write( previous_object(), words, ({ }) );
    }
}

private int cmd(string words) {
    int type;
    object person;

    if(!lordp(TP)) {
        return notify_fail("Getting a bit uppity aren't we?\n");
    }
    if(!words) type = 0;
    else type = 1;
    if(type) {
        if(!person = find_player(TP->expand_nickname(words))) {
            return notify_fail("Couldn't find \""+words+"\"!\n");
        }
    }
    tell_object(TP, "Let's RUMBLE!!\n");
    pimp_shout("The sky goes dark.  Thick black clouds roll in.\n");
    pimp_shout("A loud peal of %^RED%^%^BOLD%^thunder%^RESET%^ rumbles, "
      "shaking the ground, and bolts of %^WHITE%^%^BOLD%^"
      "lightning%^RESET%^ flash through the sky!\n");
    call_out((:rumble2:), 9, person, TP, type);
    return 1;
}

private void rumble2(object person, object rumbler, int type) {
    if(type && !person) {
        if(rumbler) {
            tell_object(rumbler, "Something went badly wrong!  Aborting the rumble!\n");
        }
        pimp_shout("The clouds sweep out as quickly as they swept in.  "
          "All is quiet again.\n");
        return;
    }
    if(type) {
        pimp_shout("A bolt of lightning strikes close to "+person->short()+", "
          "but leaves "+person->HIM+" unharmed!\n", person);
        tell_object(person, "A bolt of lightning strikes very close to you, "
          "but luckily you weren't hit!\n");
    }
    else {
        pimp_shout("A few random bolts of lightning strike the ground, but "
          "no-one seems to get hurt!\n");
    }
    pimp_shout("The clouds roll back across the sky.\nIt seems there's "
      "been a reprieve, for now at least.\n");
}

mixed query_patterns() {
    return ({ "<word'player-name'>", (:cmd($4[0]):),
      "", (:cmd(0):) });
}

Site Stats

Snippets: 1791
Codebases: 571