a newspaper (#10)

(an instance of generic note made by The_Mayor)

     It's the latest issue of the Bellona Times, datad dobject.

Go to location of this object, River bank.
     MYSTERIOUS DISASTER BEFALLS ONCE-GREAT CITY
             BELLONA (VPI) -- The city of Bellona as been incommunicado for some weeks 
now, following a cataclysmic rift in the fabric of space-time.  Most of its surviving 
population has escaped via the single remaining bridge to the outside world.
             Cameras and radios have been unable to relay any images or information from 
the city, but fleeing residents report power failures, endlessly burning fires, and 
roaming gangs of youths, called ``scorpions'', who wear holographic costumes.  Although 
roadblocks have been abandon now, a police spokesman still urges the curious to stay 
out.  ``At least tour the caves before attempting to enter'', said one officer.  
[Jan 26, 1994]
     
     INTERZONE
             BELLONA (VPI) -- Bellona, once home to a million people, is now estimated 
to contain less than a thousand.  Reports are sparse.  A clearing in the park has 
become a commune for new comers.  *Graffiti is used as a forum for public discussion. 
 A drug called simply "the ticket" is rumored to be the key to a new world called 
Interzone.  [Feb 20, 1994]
     
     DHALGREN'S HOST CHANGES
             BELLONA (VPI) -- In a sudden, lurching shift in space and time, Dhalgren 
suddenly moves to The University of Washington at 7pm on January 12.  Strangely, 
the world appears just as it did at 8pm on the previous night in Princeton.  Residents 
recover, and life returns to normal -- such as it is in Bellona.  [Jan 12, 1995]




VERB SOURCE CODE:

description:
raw = ctime(this.last_write_time);
"         111111111122222";
"123456789012345678901234";
"Fri Nov 30 14:31:21 1990";
date = (raw[1..10] + ",") + raw[20..24];
desc = "Type 'news' to see the latest issue of the Bellona Times, dated %d.";
return strsub(desc, "%d", date);
.


read:
pass(@args);
pos = player in this.readers;
if (pos)
    this.readtimes[pos] = time();
elseif (!$object_utils:isa(player, $guest))
    this.readers = {@this.readers, player};
    this.readtimes = {@this.readtimes, time()};
endif
.


check:
who = caller;
pos = who in this.readers;
if (pos)
    if (this.readtimes[pos] < this.last_write_time)
        this:announce_new_edition(who);
    endif
else
    who:notify("Don't forget to take a look at the newspaper.  Type 'news' to see 
it.");
endif
.


touch:
if ($perm_utils:controls(valid(caller_perms()) ? caller_perms() | player, this))
    this.last_write_time = time();
    for p in (connected_players())
        this:announce_new_edition(p);
    endfor
    if (callers() == {})
        player:notify("The newspaper has been marked as newly-edited.");
    endif
else
    player:notify("Permission denied.");
endif
.


init_for_core:
if (caller_perms().wizard)
    pass();
    this:set_text({"There's no news unless you write it."});
    this.description = "It's the latest issue of the MOO Herald-Examiner, dated %d.";
    this.take_failed_msg = "Realizing that the newspaper is to be shared among all 
of the players, you change your mind about picking it up.";
    this.readtimes = this.readers = this.writers = {};
else
    return E_PERM;
endif
.


announce_new_edition:
if (caller == this)
    args[1]:notify("There's a new edition of the newspaper.  Type 'news' to see it.");
endif
.


gc garbage_collect:
if (!$perm_utils:controls(player, this))
    player:tell("Sorry, you can't hack on the newspaper.");
else
    original = length(this.readers);
    newplayers = {};
    newtimes = {};
    index = 0;
    for p in (this.readers)
        index = index + 1;
        if (valid(p) && is_player(p))
            newplayers = {@newplayers, p};
            newtimes = {@newtimes, this.readtimes[index]};
        endif
        $command_utils:suspend_if_needed(0);
    endfor
    this.readers = newplayers;
    this.readtimes = newtimes;
    player:tell("Done.  Removed ", original - length(this.readtimes), " bogus readers.");
endif
.


set_text:
if (this:is_writable_by(caller_perms()))
    this.last_write_time = time();
    return pass(@args);
else
    return E_PERM;
endif
.



PROPERTY DATA:
      readtimes
      readers
      last_write_time