from esp_hadouken.pgfw.GameChild import GameChild
from esp_hadouken.title.background.Sky import Sky
from esp_hadouken.title.background.Mask import Mask

class Background(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.sky = Sky(self)
        self.mask = Mask(self)

    def update(self):
        self.sky.update()
        self.mask.update()
from pygame import Surface, Color, PixelArray
from pygame.image import load

from esp_hadouken.pgfw.GameChild import GameChild

class Mask(Surface, GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_screen()
        self.transparent_color = 0xFF00FF
        self.load_configuration()
        self.init_surface()
        self.modify()

    def init_surface(self):
        Surface.__init__(self, self.display_surface.get_size())
        self.set_colorkey(self.transparent_color)
        self.blit(load(self.vector_path).convert(), (0, 0))

    def load_configuration(self):
        get = self.get_resource
        config = self.get_configuration("title")
        self.vector_path = get("title", "mask-vector-path")
        self.vector_color = Color(config["mask-vector-colors"][2])
        self.foreground_path = get("title", "mask-foreground-path")

    def modify(self):
        pixels = PixelArray(self)
        white = 0xFFFFFF
        pixels.replace(white, self.vector_color)
        reference = PixelArray(load(self.foreground_path).convert())
        for ii, column in enumerate(reference):
            for jj, pixel in enumerate(column):
                if pixel == 0xFFFFFF:
                    pixels[ii][jj] = self.transparent_color

    def update(self):
        self.draw()

    def draw(self):
        self.display_surface.blit(self, (0, 0))
from random import choice

from pygame import Color, PixelArray

from esp_hadouken.pgfw.GameChild import GameChild

class Blinker(GameChild):

    def __init__(self, parent, initial_freq, max_freq):
        GameChild.__init__(self, parent)
        self.frequency = initial_freq
        self.max_freq = max_freq
        self.iterations = 0
        self.set_palettes()

    def set_palettes(self):
        config = self.get_configuration("sprite")
        self.inner_palette = map(
            self.translate_hex_color, config["inner-palette"])
        self.outer_palette = map(
            self.translate_hex_color, config["outer-palette"])
        self.palette = (Color("black"), Color("white"))

    def translate_hex_color(self, color):
        return Color(color + "ff")

    def build_palette(self):
        return (choice(self.inner_palette), choice(self.outer_palette))

    def paint(self):
        image = self.parent.image
        pixels = PixelArray(image)
        old_palette = self.palette
        new_palette = self.build_palette()
        pixels.replace(old_palette[0], new_palette[0])
        pixels.replace(old_palette[1], new_palette[1])
        self.palette = new_palette
        image.unlock()

    def blink(self):
        iterations = self.iterations + 1
        if 1.0 / iterations <= self.frequency:
            self.paint()
            iterations = 0
        self.iterations = iterations
from math import floor
import copy

import pygame

from esp_hadouken.sprite.Blinker import Blinker
from esp_hadouken.pgfw.GameChild import GameChild

class Sprite(GameChild):

    def __init__(self, parent, image_path, display_surface, bounds=(None, None),
                 wrap=(False, False), initial_blink_freq=0, max_blink_freq=1):
        GameChild.__init__(self, parent)
        self.image_path = image_path
        self.display_surface = display_surface
        self.bounds = bounds
        self.wrap = wrap
        self.restricted_areas = []
        self.blinker = Blinker(self, initial_blink_freq, max_blink_freq)
        self.add_image()
        self.hide()

    def add_image(self):
        image = pygame.image.load(self.image_path).convert_alpha()
        self.rect = image.get_rect()
        self.old_rect = self.rect
        self.image = image

    def paint(self):
        self.blinker.paint()

    def move(self, x=0, y=0):
        self.old_rect = copy.copy(self.rect)
        if isinstance(x, tuple) or isinstance(x, list):
            x, y = x[0], x[1]
        if x < 0:
            x = floor(x)
        if y < 0:
            y = floor(y)
        rect = self.rect
        self.place(rect.left + x, rect.top + y)
        self.rect = self.accommodate_wrapping(rect)

    def place(self, x=None, y=None):
        rect = self.rect
        if type(x) is tuple or type(x) is list:
            x, y = x[0], x[1]
        if x is None:
            x = rect.left
        if y is None:
            y = rect.top
        self.rect.topleft = x, y

    def accommodate_wrapping(self, rect):
        horizontal, vertical = self.wrap
        scope = self.display_surface.get_rect()
        if vertical:
            if rect.top < -rect.h:
                rect.top += scope.h
            elif rect.top > scope.h:
                rect.top -= scope.h
        if horizontal:
            if rect.left < 0:
                rect.left += scope.w - rect.w - 1
            elif rect.right > scope.w:
                rect.right -= scope.w - rect.w - 1
        return rect

    def add_restricted_areas(self, rects):
        if type(rects) is not list:
            rects = [rects]
        self.restricted_areas += rects

    def flip(self):
        self.image = pygame.transform.flip(self.image, True, False)

    def resize(self, size):
        self.image = pygame.transform.scale(self.image, size)

    def show(self):
        self.visible = True

    def hide(self):
        self.visible = False

    def set_blink_frequency(self, frequency):
        self.blinker.frequency = frequency

    def update(self):
        if self.visible:
            self.blinker.blink()
            self.draw()

    def draw(self):
        self.display_surface.blit(self.image, self.rect)

    def erase(self):
        self.parent.clear(self.old_rect)
216.73.216.58
216.73.216.58
216.73.216.58
 
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.