from pygame import Surface
from pygame.image import load

from esp_hadouken.pgfw.GameChild import GameChild

class Background(Surface, GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_screen()
        self.init_surface()
        self.load_tile()
        self.draw_tiles()

    def init_surface(self):
        Surface.__init__(self, self.display_surface.get_size())

    def load_tile(self):
        self.tile = load(self.get_resource("overworld",
                                           "background-tile-path")).convert()

    def draw_tiles(self):
        tile = self.tile
        width = tile.get_width()
        x_limit, y_limit = self.get_size()
        x, y = 0, 0
        for y in xrange(0, y_limit, width):
            for x in xrange(0, x_limit, width):
                self.blit(tile, (x, y))

    def update(self):
        self.display_surface.blit(self, (0, 0))
from pygame import Surface, Rect
from pygame.image import load

from esp_hadouken.pgfw.GameChild import GameChild

class Section(Surface, GameChild):

    def __init__(self, parent, left=True):
        GameChild.__init__(self, parent)
        Surface.__init__(self, self.parent.size)
        self.left = left
        self.display_surface = self.get_display_surface()
        self.rect = self.get_rect()
        self.draw_tiles()
        self.fill_borders()
        self.place()

    def draw_tiles(self):
        tile = self.parent.tile
        x_limit, y_limit = self.get_size()
        width = tile.get_width()
        for y in xrange(0, y_limit, width):
            for x in xrange(0, x_limit, width):
                self.blit(tile, (x, y))

    def place(self):
        rect = self.rect
        rect.top = self.parent.top
        if not self.left:
            rect.right = self.display_surface.get_rect().right

    def fill_borders(self):
        reference = self.rect
        top_rect = Rect(reference.topleft, (reference.w, 1))
        bottom_rect = Rect((0, 0), (reference.w, 1))
        bottom_rect.bottom = reference.bottom
        side_rect = Rect((0, 0), (1, reference.h))
        if self.left:
            side_rect.right = reference.right
        color = self.parent.border
        self.fill(color, top_rect)
        self.fill(color, bottom_rect)
        self.fill(color, side_rect)

    def update(self):
        self.display_surface.blit(self, self.rect)
from pygame import Surface
from pygame.image import load

from esp_hadouken.pgfw.GameChild import GameChild
from esp_hadouken.overworld.wall.Section import Section

class Wall(Surface, GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.load_configuration()
        self.load_tile()
        self.set_sections()
        # 224x25 gap: 52

    def load_configuration(self):
        config = self.get_configuration("overworld")
        self.size = config["wall-size"]
        self.top = config["wall-position"]
        self.border = config["wall-border"]

    def load_tile(self):
        self.tile = load(self.get_resource("overworld",
                                           "wall-tile-path")).convert()

    def set_sections(self):
        self.sections = [Section(self, left) for left in False, True]

    def update(self):
        for section in self.sections:
            section.update()
from random import choice

from pygame import PixelArray, Color
from pygame.image import load

from esp_hadouken.pgfw.Sprite import Sprite
from esp_hadouken.dot.engine.Engine import Engine

class Dot(Sprite):

    def __init__(self, parent):
        Sprite.__init__(self, parent)
        self.engine = Engine(self)
        self.delegate = self.get_delegate()
        self.load_configuration()
        self.load_image()
        self.load_palette()
        self.add_frames()
        self.reset()
        self.subscribe(self.respond)

    def load_configuration(self):
        config = self.get_configuration("dot")
        self.framerate_range = config["framerate-range"]
        self.transparent_color = config["transparent-color"]
        self.frame_count = config["frame-count"]

    def load_image(self):
        image = load(self.get_resource("dot", "image-path")).convert()
        image.set_colorkey(self.transparent_color)
        self.image = image

    def load_palette(self):
        config = self.get_configuration("sprite")
        self.palette = [map(Color, palette) for palette in
                        config["dark-palette"], config["light-palette"]]

    def add_frames(self):
        for ii in xrange(self.frame_count):
            surface = self.image.copy()
            self.paint_frame(surface)
            self.add_frame(surface)

    def paint_frame(self, surface):
        pixels = PixelArray(surface)
        dark, light = map(choice, self.palette)
        pixels.replace((255, 255, 255), light)
        pixels.replace((0, 0, 0), dark)

    def reset(self):
        self.set_framerate(self.framerate_range[1])
        self.engine.reset()

    def respond(self, event):
        if self.delegate.compare(event, "reset-game"):
            self.reset()

    def is_active(self):
        return self.parent.active

    def update(self):
        if self.is_active():
            self.engine.update()
            self.move(*self.engine)
            Sprite.update(self)
from pygame.font import Font

from esp_hadouken.pgfw.GameChild import GameChild
from esp_hadouken.pgfw.Vector import Vector
from esp_hadouken.dot.engine.accelerator.Accelerator import Accelerator
from esp_hadouken.dot.engine.Calibrator import Calibrator
from esp_hadouken.dot.engine.Profile import Profile

class Engine(GameChild, Vector):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.input = self.get_input()
        self.display_surface = self.get_screen()
        self.load_configuration()
        self.display_active = self.check_command_line(self.display_flag)
        self.calibration_active = self.check_command_line(self.calibrate_flag)
        self.accelerator = Accelerator(self)
        self.profile = Profile(self)
        self.accelerator.set_slopes()
        self.add_calibrator()
        self.reset()
        self.init_display()

    def load_configuration(self):
        config = self.get_configuration("engine")
        self.display_flag = config["display-flag"]
        self.calibrate_flag = config["calibrate-flag"]
        self.initial_profile = config["initial-profile"]
        self.font_path = self.get_resource("engine", "font-path")

    def add_calibrator(self):
        if self.calibration_active:
            self.calibrator = Calibrator(self)

    def reset(self):
        Vector.__init__(self)
        self.accelerator.reset()

    def init_display(self):
        if self.display_active:
            self.display_surface = self.get_screen()
            self.font = Font(self.font_path, 14)
            self.render()

    def render(self):
        string = str(self)
        self.text = self.font.render(string, False, (0, 0, 0), (255, 255, 255))
        self.string = string

    def set(self, max_velocity, deceleration):
        self.max_velocity = max_velocity
        self.deceleration = deceleration

    def update(self):
        if self.calibration_active:
            self.calibrator.update()
        self.accelerator.update()
        self.apply_accelerator()
        self.constrain()
        self.decelerate()
        self.display()

    def apply_accelerator(self):
        self += self.accelerator.get_sum()

    def constrain(self):
        self.apply_to_components(self.constrain_component)

    def constrain_component(self, magnitude):
        if magnitude > self.max_velocity:
            return self.max_velocity
        if magnitude < -self.max_velocity:
            return -self.max_velocity
        return magnitude

    def decelerate(self):
        self.apply_to_components(self.decelerate_component)

    def decelerate_component(self, magnitude):
        deceleration = self.deceleration
        if abs(magnitude) < deceleration:
            magnitude = 0
        else:
            if magnitude > 0:
                magnitude -= deceleration
            else:
                magnitude += deceleration
        return magnitude

    def display(self):
        if self.display_active:
            if self.string != str(self):
                self.render()
            self.display_surface.blit(self.text, (0, 0))

    def __str__(self):
        return "[{0: .2f}, {1: .2f}]".format(*self)
216.73.216.10
216.73.216.10
216.73.216.10
 
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.