from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Background(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_from_path(join(self.get_resource("door", "path"),
                                 str(self.parent.parent.index),
                                 "background.png"), True, True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.parent.foreground.location.right

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from os.path import join

from lib.pgfw.pgfw.Sprite import Sprite

class Foreground(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        index = str(self.parent.parent.index)
        self.load_from_path(self.get_resource(join(self.root, index,
                                                   "foreground.png")), True,
                            True)
        self.location.bottom = self.parent.parent.platforms[0].location.top
        self.reset()

    def reset(self):
        self.location.left = self.x

    def load_configuration(self):
        config = self.get_configuration("door")
        self.x = config["x"]
        self.root = config["path"]

    def update(self):
        self.move(-self.parent.parent.velocity[0])
        Sprite.update(self)
from random import randint, random

from lib.pgfw.pgfw.GameChild import GameChild
from food_spring.level.obstacle.Missile import Missile
from food_spring.level.obstacle.Hurdle import Hurdle
from food_spring.level.obstacle.Spikes import Spikes
from food_spring.level.obstacle.Fireball import Fireball

class Obstacles(GameChild, dict):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.init_dict()

    def load_configuration(self):
        config = self.get_configuration
        self.missile_chance = config("missile", "chance")
        self.missile_count = config("missile", "count")
        self.blink_rate = config("obstacle", "blink-rate")
        self.hurdle_count = config("hurdle", "count")
        self.hurdle_chance = config("hurdle", "chance")
        self.hurdle_first = config("hurdle", "first-range")
        self.hurdle_margin = config("hurdle", "margin")
        self.spikes_chance = config("spikes", "chance")
        self.fireball_chance = config("fireball", "chance")
        self.fireball_count = config("fireball", "count")

    def init_dict(self):
        missiles = [Missile(self) for _ in xrange(self.missile_count[1])]
        hurdles = [Hurdle(self) for _ in xrange(self.hurdle_count[1])]
        fireballs = [Fireball(self) for _ in xrange(self.fireball_count[1])]
        dict.__init__(self, {"missile": missiles, "spikes": [Spikes(self)],
                             "hurdle": hurdles, "fireball": fireballs})

    def reset(self):
        for obstacle in self.get_obstacles():
            obstacle.reset()

    def get_obstacles(self, exclude=[]):
        if isinstance(exclude, str):
            exclude = [exclude]
        for kind in set(("hurdle", "fireball", "spikes",
                         "missile")).difference(exclude):
            for obstacle in self[kind]:
                yield obstacle

    def update(self):
        if self.parent.is_going():
            self.spawn_missiles()
            self.spawn_hurdles()
            self.spawn_spikes()
            self.spawn_fireballs()
        for obstacle in self.get_obstacles():
            obstacle.update()

    def spawn_missiles(self):
        if all(not missile.is_flying() for missile in self["missile"]):
            if random() < self.missile_chance:
                for ii in xrange(randint(*self.missile_count)):
                    self["missile"][ii].queue_fly()

    def spawn_hurdles(self):
        if all(not hurdle.is_playing(hurdle.enter) and \
               not hurdle.is_playing(hurdle.exit) for \
               hurdle in self["hurdle"]):
            if random() < self.hurdle_chance:
                dy = randint(*self.hurdle_first)
                for ii in xrange(randint(*self.hurdle_count)):
                    self["hurdle"][ii].queue_entrance(dy)
                    dy += randint(*self.hurdle_margin)

    def spawn_spikes(self):
        if not self["spikes"][0].is_playing(self["spikes"][0].slide):
            if random() < self.spikes_chance:
                self["spikes"][0].queue_slide()

    def spawn_fireballs(self):
        if all(not fireball.is_playing(fireball.spew) for fireball in \
               self["fireball"]):
            if random() < self.fireball_chance:
                for ii in xrange(randint(*self.fireball_count)):
                    self["fireball"][ii].queue_spew()
from pygame import Surface

from lib.pgfw.pgfw.Sprite import Sprite

class Hurdle(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.load_configuration()
        self.set_frames()
        self.register(self.enter, self.exit)
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("hurdle")
        self.delay = config["delay"]
        self.speed = config["speed"]
        self.pause = config["pause"]

    def set_frames(self):
        surface = Surface((32, 8))
        surface.fill((255, 255, 0))
        self.add_frame(surface, omit=True)
        self.add_frameset(0, name="entered")
        blank = Surface(self.location.size)
        blank.set_colorkey((0, 0, 0))
        self.add_frame(blank, omit=True)
        self.add_frameset([0, 1], self.parent.blink_rate, "queued")

    def reset(self):
        self.halt(self.enter)
        self.halt(self.exit)
        self.active = False
        self.queue_reset = False
        self.location.centerx = self.display_surface.get_rect().left
        self.set_frameset("queued")

    def queue_entrance(self, dy):
        self.location.centery = self.parent.parent.platforms[0].location.top - \
                                dy
        self.active = True
        self.play(self.enter, delay=self.delay)

    def enter(self):
        self.set_frameset("entered")
        self.move(self.speed, 0)
        if self.location.centerx >= self.display_surface.get_rect().centerx:
            self.halt(self.enter)
            self.play(self.exit, delay=self.pause)

    def exit(self):
        self.move(self.speed, 0)
        if self.location.right >= self.display_surface.get_rect().right:
            self.queue_reset = True

    def update(self):
        if self.active:
            if self.is_playing(self.enter, include_delay=True) or \
               self.is_playing(self.exit):
                if self.location.colliderect(self.parent.parent.food):
                    self.parent.parent.food.freeze()
            Sprite.update(self)
        if self.queue_reset:
            self.reset()
44.192.20.240
44.192.20.240
44.192.20.240
 
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 I 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.