Sic/frame4.as
From Organic Design wiki
//
// Liscenced under LGPL: www.gnu.org/copyleft/lesser.html
//
// Nad - 2003 - SIC-Games
//
// Frame4: PER-FRAME
now = new Date();
time = now.getTime();
processOutgoingEvents(); // Propagate any accumulated local events
processIncomingEvents(); // Execute events needing instantiation this frame
// Periodically attempt connection
// - first connection attempt is after delay so that peers are all connected
if (!network.connected && ++network.ctr%1000 == 999) network.connect('127.0.0.1', network.port);
if (shell.state != 2) {
// Execute frame() for environment
environment._visible = true;
environment.frame();
// Execute frame() for active spaces - which in turn calls frame() of objects it contains
for (var i = 0; i < allSpaces.length; i++)
if (allSpaces[i].active) allSpaces[i].frame();
// Demo mode (screensaver)
if ((environment.phase < 10)&&(time - environment.lastActivity) > environment.timeout) {
environment.time = time;
environment.phase = 10;
}
}
else demo._visible = game._visible = environment._visible = false;