Generic Secured Post-Apocalypse Room (#262)

(an instance of Generic Post-Apocalypse Room made by Calkins)

     It is raining and secure this day in Bellona.

Go to location of this object, wooden box.


HELP MANUAL:
     The Generic Post-Apocalypse Room Class (PARC) allows room descriptions and details 
to depend on the time of day and the weather.  It has eight settable messages:
     
        @secure here is O|D|A|M     Set the room security to open, deny
                                    accept, maximum.  An open room will
                                    allow anyone to enter.  Set to D, the
                                    room will repel anyone placed on the
                                    denied list.  Set to A, the room will
                                    accept anyone on the accepted list.  At
                                    M, the room is locked to all but the
                                    owner or residents.
     
        @accept [player1, ...]      Add players to the accepted list.
     
        @unaccept [player1, ...]    Remove players from the accepted list.
     
        @deny [player1, ...]        Add players to the denied list.
     
        @undeny [player1, ...]      Remove players from the denied list.
     
     When a player is repelled by room security, they see the repel_msg.  Players in the 
room then see the orepel_msg, informing them of the attempted entrance.  Objects 
owned by a player have the same entrance permission as their owner.
     
     If a player cannot enter a SPARC room (because of security or free_entry == 0), they 
also may not look at it remotely.
     (see also: help #110 for information on PARC)



VERB SOURCE CODE:

accept:
if (!(success = pass(@args)))
    what = args[1];
    if (this.repel_msg)
        what:tell(this.repel_msg);
    endif
    if (this.orepel_msg)
        msg = $string_utils:pronoun_sub(this.orepel_msg, what, this, what.location);
        this:announce_all(msg);
    endif
endif
return success;
.


acceptable:
if (pass(@args))
    if (this.security_level > 1)
        what = args[1];
        who = is_player(what) ? what | what.owner;
        res = {this.owner, @this.residents};
        if ((who in res) || (player in res))
            return 1;
        elseif (this.security_level == 2)
            return !(who in this.deny_list);
        elseif (this.security_level == 3)
            return who in this.accept_list;
        else
            return 0;
        endif
    else
        return 1;
    endif
else
    return 0;
endif
.


@accept:
if (!(player in {this.owner, @this.residents}))
    player:tell(E_PERM);
    return;
endif
folks = $string_utils:explode(strsub(argstr, ",", " "));
for f in (folks)
    w = $string_utils:match_player(f);
    if (valid(w))
        this.accept_list = setadd(this.accept_list, w);
    endif
endfor
player:tell("Accepted players:");
this.accept_list = this:print_and_cleanup(this.accept_list);
.


@deny:
if (!(player in {this.owner, @this.residents}))
    player:tell(E_PERM);
    return;
endif
folks = $string_utils:explode(strsub(argstr, ",", " "));
for f in (folks)
    w = $string_utils:match_player(f);
    if (valid(w))
        this.deny_list = setadd(this.deny_list, w);
    endif
endfor
player:tell("Denied players:");
this.deny_list = this:print_and_cleanup(this.deny_list);
.


@undeny:
if (!(player in {this.owner, @this.residents}))
    player:tell(E_PERM);
    return;
endif
folks = $string_utils:explode(strsub(argstr, ",", " "));
for f in (folks)
    w = $string_utils:match_player(f);
    if (valid(w))
        this.deny_list = setremove(this.deny_list, w);
    endif
endfor
player:tell("Denied players:");
this.deny_list = this:print_and_cleanup(this.deny_list);
.


@unaccept:
if (!(player in {this.owner, @this.residents}))
    player:tell(E_PERM);
    return;
endif
folks = $string_utils:explode(strsub(argstr, ",", " "));
for f in (folks)
    w = $string_utils:match_player(f);
    if (valid(w))
        this.accept_list = setremove(this.accept_list, w);
    endif
endfor
player:tell("Accepted players:");
this.accept_list = this:print_and_cleanup(this.accept_list);
.


@secure:
if (!(player in {this.owner, @this.residents}))
    player:tell(E_PERM);
    return;
endif
if (iobjstr)
    if (level = iobjstr[1] in {"O", "D", "A", "M"})
        this.security_level = level;
    else
        player:tell("Security must be Open, Denied, Accepted, or Maximum.");
    endif
endif
player:tell("Present security level is ", "ODAM"[this.security_level], ".");
.


print_and_cleanup:
clean = {};
names = {};
for i in (args[1])
    if (valid(i))
        clean = {@clean, i};
        names = {@names, i.name};
    endif
endfor
player:tell($string_utils:print(names));
return clean;
.


look_self:
if ((player.location != this) && ((this.security_level > 1) || (!this.free_entry)))
    player:tell("You are too far away to see that.");
else
    pass(@args);
endif
.


description:
if ((player.location != this) && ((this.security_level > 1) || (!this.free_entry)))
    return "You are too far away to see it.";
else
    return pass(@args);
endif
.



PROPERTY DATA:
      security_level
      repel_msg
      orepel_msg
      accept_list
      deny_list

CHILDREN:
Patro's Shack Choir Loft Ruined Church Catacombs Mayor's Office Abandoned Luncheonette Postmodern Laboratory The Master's Chambers The Marrakech The Shack Stage .sig Mouldering Tunnel Tock_WatchDog's Bedroom Shadowed Study The Underground Jeannie's Bottle Gardenia Corner The Club Tangiers The Vortex of Anguish Generic Papa Room The Casbah Love&Rockets #23 Press Room Baia Gothic Tower Slanted rooftop Isolation Peak Exotica Generic Room with Seats Graveyard Memorial