Sic/frame4.as

From Organic Design wiki
Revision as of 23:44, 24 September 2013 by Nad (talk | contribs) (legacy)
Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, now this page is for historic record only.

<as> // // 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; </as>