<?php
$GLOBALS["CACHE_PATH"] = "flash/cache/";
$GLOBALS["FILE_EXTENSION"] = ".gif";
$GLOBALS["RELATIVE_IMAGE_DIRECTORY_PATH"] = "img/";
remove_cached_strip();
function remove_cached_strip()
{
   go_to_cache_directory();
   $path = find_image_file();
   unlink($path);
}
function go_to_cache_directory()
{
   go_to_image_directory();
   chdir($GLOBALS["CACHE_PATH"]);
}
function go_to_image_directory()
{
   $path = $GLOBALS["RELATIVE_IMAGE_DIRECTORY_PATH"];
   while (!is_dir($path))
   {
      chdir("..");
   }
   chdir($path);
}
function find_image_file()
{
   $index = $_GET["index"];
   foreach (scandir(".") as $file)
   {
      if (fnmatch($index . "_*", $file))
      {
         return $file;
      }
   }
}
EVR.Level.Road.Path.Line = function(container, style)
{
   EVR.Graphic.call(this, container, RATIO_HEIGHT, null, ALIGN_LEFT);
   this.style = style;
   this.margin = LINE_MARGIN;
   this.checkers = [];
   this.build();
}
EVR.Level.Road.Path.Line.prototype = new EVR.Graphic;
EVR.Level.Road.Path.Line.prototype.build = function()
{
   this.set_proportions(LINE_WIDTH, 1);
   this.set_color(LINE_COLOR);
   this.set_opacity(LINE_OPACITY);
   if (this.style == LINE_FINISH)
   {
      this.add_checkers();
   }
}
EVR.Level.Road.Path.Line.prototype.add_checkers = function()
{
   var count = LINE_CHECKER_COUNT;
   var width = .5;
   var height = 1.0 / count;
   var alignment;
   for (var ii = 0; ii < count; ii++)
   {
      alignment = ii % 2 ? ALIGN_TOP_RIGHT : ALIGN_TOP_LEFT;
      var checker = new EVR.Graphic(this, null, null, alignment);
      checker.set_color(LINE_CHECKER_COLOR);
      checker.set_proportions(width, height);
      checker.place(null, height * ii);
      checker.append();
      this.checkers.push(checker);
   }
}
EVR.Level.Road.Path.Line.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   if (this.style != LINE_FINISH)
   {
      this.set_border();
   }
   for (var ii = 0; ii < this.checkers.length; ii++)
   {
      this.checkers[ii].draw();
   }
}
EVR.Level.Road.Path.Line.prototype.set_border = function()
{
   var width = this.container.get_dimensions()[0] * this.get_margin();
   var color = this.container.level.background;
   if (!!window.ActiveXObject)
   {
      this.set_dimensions(this.get_dimensions()[0] + width);
   }
   this.css.borderRight = width + "px solid " + color;
}
EVR.Level.Road.Path.Line.prototype.get_margin = function()
{
   var dimensions = this.container.get_dimensions();
   return dimensions[1] / dimensions[0] * this.margin;
}
EVR.Level.Road.Path.Line.prototype.toString = function()
{
   return "[object EVR.Level.Road.Path.Line]";
}
EVR.include("level/road/path/Line.js");
EVR.include("level/road/path/trail/Trail.js");
EVR.Level.Road.Path = function(container, level)
{
   EVR.Animation.call(this, PATH_INITIAL_RATE, true, PATH_TIMING_BUFFER);
   this.container = container;
   this.level = level;
   this.clusters = level.clusters;
   this.racer = container.racer;
   this.sprinting = false;
   this.offset = 0;
   this.speed = PATH_INITIAL_SPEED;
   this.visible = 0;
   this.color = null;
   this.variance = [0, 0];
   this.meter_unlocked = false;
   this.trail = new EVR.Level.Road.Path.Trail(level);
   this.populate();
   this.last_ms = +new Date;
}
EVR.Level.Road.Path.prototype = new EVR.Animation;
EVR.Level.Road.Path.prototype.populate = function()
{
   this.items = [new EVR.Level.Road.Path.Line(this.container)];
   for (var ii = 0; ii < this.clusters.length; ii++)
   {
      this.clusters[ii].initiate(this.container, this.level);
   }
   this.items = this.items.concat(this.clusters);
   this.items.push(new EVR.Level.Road.Path.Line(this.container, LINE_FINISH));
   this.set_origin();
   this.arrange();
}
EVR.Level.Road.Path.prototype.set_origin = function()
{
   var racer = this.racer;
   var offset = racer.get_coordinates(true)[0] + racer.get_dimensions(true)[0];
   this.origin = offset + this.items[0].get_margin();
}
EVR.Level.Road.Path.prototype.arrange = function()
{
   var x = this.origin - this.offset;
   var container = this.container;
   var border = container.get_dimensions()[0];
   var racer = this.racer.get_coordinates()[0];
   var cluster, left, width, right, ratio, inhabited = null;
   for (var ii = this.visible, len = this.items.length; ii < len; ii++)
   {
      cluster = this.items[ii];
      if (!cluster.attached)
      {
	 cluster.append();
      }
      cluster.place(x);
      left = cluster.get_coordinates()[0];
      width = cluster.get_dimensions()[0];
      right = left + width;
      if (inhabited == null)
      {
	 inhabited = this.locate_racer(racer, left, right, ii, len);
	 if (inhabited != null)
	 {
	    this.trail.add(this.speed, this.racer.lane);
	 }
      }
      ratio = width / border;
      x += ratio;
      if (right < 0)
      {
	 cluster.remove();
	 this.visible++;
	 this.offset -= ratio;
      }
      else if (left > border)
      {
	 break;
      }
   }
   return inhabited;
}
EVR.Level.Road.Path.prototype.locate_racer = function(x, left, right, ii, len)
{
   if (ii == 0 && x < left)
   {
      return -1;
   }
   else if (this.intersect(x, left, right) || ii == len - 1)
   {
      return ii;
   }
   return null;
}
EVR.Level.Road.Path.prototype.intersect = function(x, left, right)
{
   return x >= left && x < right;
}
EVR.Level.Road.Path.prototype.sequence = function()
{
   var ii = this.arrange();
   var item = this.items[ii];
   if (item instanceof EVR.Level.Road.Path.Line)
   {
      if (item.style == LINE_FINISH)
      {
	 this.stop();
	 this.update_cheers();
	 this.level.finish();
	 return;
      }
   }
   else if (item != null)
   {
      this.cluster = item;
      this.update_color();
      this.update_variance();
      this.update_streak();
      this.update_sprint_state();
      this.update_flame();
      this.update_flash();
      this.set_instruments(ii);
      this.set_speed();
//       this.update_scoreboard(ii);
      this.update_cheers();
   }
   this.step();
   this.update_ghost(ii);
   this.unlock_meter(ii);
}
EVR.Level.Road.Path.prototype.unlock_meter = function(index)
{
   if (index >= this.items.length - PATH_METER_UNLOCK_OFFSET)
   {
      if (!this.meter_unlocked)
      {
	 this.meter_unlocked = true;
	 this.set_meter_color();
      }
   }
}
EVR.Level.Road.Path.prototype.update_color = function()
{
   var cluster = this.cluster;
   var racer = this.racer;
   var x = racer.get_coordinates()[0];
   var gap_x = cluster.get_gap_x();
   if (x >= gap_x)
   {
      this.color = null;
   }
   else
   {
      this.color = racer.lane;
      if (!this.level.practice)
      {
	 this.racer.add_color(this.color, cluster.passage);
      }
   }
}
EVR.Level.Road.Path.prototype.update_variance = function()
{
   if (this.color != null)
   {
      this.variance[0]++;
      this.variance[1] += !this.is_in_passage();
   }
}
EVR.Level.Road.Path.prototype.is_in_passage = function()
{
   return this.color == this.cluster.passage;
}
EVR.Level.Road.Path.prototype.update_streak = function()
{
   var streak = this.level.streak;
   if (this.color != null)
   {
      if (this.is_in_passage())
      {
	 streak.increase();
      }
      else
      {
	 streak.reset();
      }
   }
}
EVR.Level.Road.Path.prototype.set_instruments = function(ii)
{
   if (ii > 0)
   {
      this.level.map.advance_player(ii - 1);
      this.level.register.advance(ii - 1);
   }
   this.set_meter();
}
EVR.Level.Road.Path.prototype.set_meter = function()
{
   var meter = this.level.meter;
   if (this.sprinting)
   {
      meter.adjust(-this.rate);
   }
   var color = this.color;
   if (color != null && this.is_in_passage())
   {
      adjustment = PATH_METER_BONUS + this.level.streak * PATH_STREAK_BONUS;
      meter.adjust(adjustment);
   }
   this.set_meter_color();
}
EVR.Level.Road.Path.prototype.set_meter_color = function()
{
   var meter = this.level.meter;
   var reading = meter.read();
   if (this.sprinting)
   {
      meter.set_color(METER_DRAINING_COLOR);
   }
   else if (reading >= this.level.threshold || this.meter_unlocked)
   {
      meter.set_color(METER_READY_COLOR);
   }
   else
   {
      meter.set_color(METER_DISABLED_COLOR);
   }
}
EVR.Level.Road.Path.prototype.set_speed = function()
{
   if (this.sprinting && this.level.meter.read() > 0)
   {
      this.speed = PATH_SPRINT_SPEED;
   }
   else
   {
      this.speed = PATH_INITIAL_SPEED;
   }
   var color = this.color;
   if (color != null && !this.is_in_passage())
   {
      this.speed *= PATH_SPEED_PENALTY;
   }
}
EVR.Level.Road.Path.prototype.update_ghost = function(ii)
{
   var road = this.level.road;
   if (!!road.ghost)
   {
      road.ghost.update(this.speed, this.rate, ii);
   }
}
EVR.Level.Road.Path.prototype.update_sprint_state = function()
{
   if (this.sprinting && this.level.meter.read() <= 0)
   {
      this.sprinting = false;
   }
}
EVR.Level.Road.Path.prototype.update_flame = function()
{
   this.racer.flame.update(this.sprinting, this.speed);
}
EVR.Level.Road.Path.prototype.update_flash = function()
{
   this.racer.flash.update();
}
EVR.Level.Road.Path.prototype.update_scoreboard = function(item_index)
{
//    this.level.scoreboard.update(item_index - 1);
   this.level.scoreboard.update(this.speed);
}
EVR.Level.Road.Path.prototype.update_cheers = function()
{
   this.level.cheers.update(this.sprinting, this.speed);
}
EVR.Level.Road.Path.prototype.step = function()
{
   var dimensions = this.container.get_dimensions();
   var ratio = dimensions[1] / dimensions[0];
   this.offset += ratio * this.speed * this.rate;
}
EVR.Level.Road.Path.prototype.stop = function()
{
   EVR.Animation.prototype.stop.call(this);
   this.level.clock.stop();
   this.sprinting = false;
}
EVR.Level.Road.Path.prototype.draw = function()
{
   var cluster, y, boundary, started = false;
   for (var ii = 0, len = this.items.length; ii < len; ii++)
   {
      cluster = this.items[ii];
      if (cluster.attached)
      {
	 started = true;
	 cluster.shape();
	 y = cluster.get_coordinates()[0];
	 boundary = this.container.get_coordinates()[0];
	 if (y > boundary)
	 {
	    cluster.remove();
	 }
      }
      else if (started)
      {
	 break;
      }
   }
   this.set_origin();
   this.arrange();
   this.update_cluster_dimensions();
}
EVR.Level.Road.Path.prototype.update_cluster_dimensions = function()
{
   var items = this.items;
   for (var ii = 1; ii < items.length - 1; ii++)
   {
      items[ii].update_dimensions();
   }
}
EVR.Level.Road.Path.prototype.calculate_accuracy = function()
{
   var variance = this.variance;
   return 1 - (variance[1] / variance[0]);
}
EVR.Level.Road.Path.prototype.sprint = function()
{
   var level = this.level;
   if (level.meter.read() >= level.threshold || this.meter_unlocked)
   {
      this.sprinting = true;
   }
}
EVR.Level.Road.Path.prototype.remove = function()
{
   var item, items = this.items;
   for (var ii = 0; ii < items.length; ii++)
   {
      item = items[ii];
      item.attached && item.remove();
   }
}
EVR.Level.Road.Path.prototype.toString = function()
{
   return "[object EVR.Level.Road.Path]";
}
216.73.216.171
216.73.216.171
216.73.216.171
 
July 18, 2022


A new era ‼

Our infrastructure has recently upgraded ‼

Nugget Communications Bureau 👍

You've never emailed like this before ‼

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and me can start our own newspaper or social media feed.

Nugget Streaming Media 👍

The content you crave ‼

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional ‼

Nugget Productivity Suite 👍

Unleash your potential ‼

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security 👍

The real Turing test ‼

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software 👍

The best in gaming entertainment ‼

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom ‼

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.