home.social

#computercraft — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #computercraft, aggregated by home.social.

fetched live
  1. libunicornpkg v1.3.1 is out now, featuring a new provider for Sourcehut, a `rel.conflicts` field, and a little bit more. Here's the changelog: unicornpkg.github.io/libunicor

    #ComputerCraft @[email protected]

  2. Big fan of this one, Chat. Made this cute kiosk program that tells you the in-game time, the day of your world, says Hi, and the current Weather.
    This uses the mods CC: Tweaked, for the computer and Advanced Peripherals for the Environment Detector which reports on the weather.

    Technically, it's possible to tell the current weather using the Daylight Detector because the computer can measure the redstone strength based on the light level. But it was complicated, required a lot of space, I found it difficult to calculate the sine wave of light level compared to current weather while also calculating the daylight compared to the time of day and somehow calculating that.
    It's possible for sure but I'm not good enough at maths to understand it.

    Anyway here's the code:

    local monitor = peripheral.find("monitor")
    
    function flash_line(text, background_colour, text_colour)
        local line_length, _ = monitor.getSize()
        local current_text_colour = monitor.getTextColour()
        local current_background_colour = monitor.getBackgroundColour()
        local current_x, current_y = monitor.getCursorPos()
        monitor.clearLine()
        monitor.setTextColour(text_colour)
        for i = 1, 3
        do
            -- Flash half
            monitor.setBackgroundColour(background_colour)
            monitor.setCursorPos(1, current_y)
            for cursor_x = 1, line_length
            do
                monitor.write(text)
            end
            os.sleep(0.5)
            -- Flash second-half
            monitor.setBackgroundColour(current_background_colour)
            monitor.setCursorPos(1, current_y)
            for cursor_x = 1, line_length
            do
                monitor.write(text)
            end
            os.sleep(0.5)
        end
        monitor.setTextColour(current_text_colour)
        monitor.setBackgroundColour(current_background_colour)
        monitor.setCursorPos(current_x, current_y)
        monitor.clearLine()
    end
    
    if not monitor
    then
        print("Could not find monitor.")
        return
    end
    
    local is_raining = false
    local raining_start = 0
    local is_sunny = false
    local sunny_start = 0
    local is_thunder = false
    local thunder_start = 0
    
    monitor.setBackgroundColour(colours.blue)
    monitor.setTextColour(colours.lime)
    monitor.clear()
    while(true)
    do
        local env = peripheral.find("environment_detector")
        local time = os.time()
        local day = os.day()
        local greeting
        local day_stat = "Day: " .. day
        local screen_width, screen_height = monitor.getSize()
         
        local distance_from_right = screen_width - day_stat:len() + 1
        monitor.setBackgroundColour(colours.blue)
        monitor.setTextColour(colours.lime)
        monitor.setCursorPos(1,1)
        monitor.clearLine()
        monitor.write(textutils.formatTime(time))
        monitor.setCursorPos(distance_from_right,1)
        monitor.write(day_stat)
        monitor.setCursorPos(1,2)
        monitor.clearLine()
        if time < 12.0
        then
            monitor.write("Good ")
            monitor.setTextColour(colours.magenta)
            monitor.write("morning.")
        elseif time < 19.0
        then
            monitor.write("Good ")
            monitor.setTextColour(colours.yellow)
            monitor.write("afternoon.")
        else
            monitor.write("Good ")
            monitor.setTextColour(colours.orange)
            monitor.write("evening.")
        end
    
        if env
        then
            monitor.setCursorPos(1,4)
            monitor.clearLine()
            monitor.setTextColour(colours.lime)
            monitor.write("Today's Weather:")
            monitor.setCursorPos(1,5)
            -- It just started sunny.
            if env.isSunny() and not is_sunny
            then
                -- The timer is the computer uptime.
                sunny_start = os.epoch("utc")
                is_sunny = true
                flash_line("!", colours.white, colours.black)
            elseif not env.isSunny()
            then
                -- Set state to false and reset start time.
                is_sunny = false
                sunny_start = 0
            end
    
            -- It just started raining.
            if env.isRaining() and not is_raining
            then
                -- The timer is the computer uptime.
                raining_start = os.epoch("utc")
                is_raining = true
                flash_line("!", colours.yellow, colours.black)
            elseif not env.isRaining()
            then
                -- Set state to false and reset start time.
                is_raining = false
                raining_start = 0
            end
    
            -- It just started thundering.
            if env.isThunder() and not is_thunder
            then
                -- The timer is the computer uptime.
                thunder_start = os.epoch("utc")
                is_thunder = true
                flash_line("!", colours.red, colours.black)
            elseif not env.isThunder()
            then
                -- Set state to false and reset start time.
                is_thunder = false
                thunder_start = 0
            end
            if is_thunder
            then
                local thunder_time = (os.epoch("utc") - thunder_start) / 1000
                local weather_report = "Thundering for: " .. os.date("!%T", thunder_time)
                --local distance_from_right = screen_width - weather_report:len() + 1
                --monitor.setCursorPos(distance_from_right,3)
                monitor.clearLine()
                monitor.write(weather_report)
            elseif is_raining
            then
                local raining_time = (os.epoch("utc") - raining_start) / 1000
                local weather_report = "Raining for: " .. os.date("!%T", raining_time)
                --local distance_from_right = screen_width - weather_report:len() + 1
                --monitor.setCursorPos(distance_from_right,3)
                monitor.clearLine()
                monitor.write(weather_report)
            elseif is_sunny
            then
                local sunny_time = (os.epoch("utc") - sunny_start) / 1000
                local weather_report = "Sunny for: " .. os.date("!%T", sunny_time)
                --local distance_from_right = screen_width - weather_report:len() + 1
                --monitor.setCursorPos(distance_from_right,3)
                monitor.clearLine()
                monitor.write(weather_report)
            end
        end
    
    
        sleep(0.1)
    end

    #minecraft #ComputerCraft #CCtweaked

  3. Functional internet radio in Minecraft using a server written in C#, ffmpeg, and computercraft/LUA. Supports N speakers over physical cable.

    Edit: github.com/Krutonium/InternetR

    #Minecraft #Computercraft #opencomputers #InternetRadio

  4. Does anyone know if it's possible to use 64 bit integers in #computercraft ? My power system exceeds the 32 bit limit multiple times over.

    #Minecraft #ModdedMinecraft

  5. Thinking about using the #websocket support in #ComputerCraft in #minecraft to use #ffmpeg to #stream #internetradio from the #internet into the #game to play via the #ingame #speaker

    Anyone have any idea how to actually make this work/does it already exist? Or am I going to be writing my own thing. (Audio has to be converted from whatever into dfpwm)

  6. Do you use Nix?

    Do you have an uncontrollable urge to manage everything through Home-Manager?

    Do you use CraftOS-PC?

    nix-craftos-pc has just been released, enabling you to declaratively manage your CPC config through Home-Manager!

    github.com/tomodachi94/nix-cra

    #nix #HomeManager #ComputerCraft #FOSS #FLOSS

  7. CW: Nixpkgs package update

    CraftOS-PC has been updated from 2.8 to 2.8.1 in Nixpkgs. You can expect to see this package in nixpkgs-unstable within a few hours and nixos-unstable in a few days.

    This is a bugfix release, containing fixes for a few bugs that landed in v2.8.

    github.com/NixOS/nixpkgs/pull/

    nixpk.gs/pr-tracker.html?pr=28

    #computercraft #craftospc #nixpkgs

  8. W grze Minecraft Java Edition można instalować modyfikacje. Nie polecam jednak pobierać ich i instalować samodzielnie. Do tego celu lepiej skorzystać z launchera, np. @PrismLauncher który jest otwarto-źródłowy. Z jego poziomu można wyszukiwać i pobierać modyfikacje.

    Szczególnie polecam paczkę modów o nazwie Learn Lua lub modyfikację #ComputerCraft i #ComputerCraftEdu na wersję 1.8.9. Dzięki tej modyfikacji można się nieco nauczyć programowania!

  9. who needs quarrys when you have #computercraft!

    no but please i need #minecraft quarry #mod recommendations i need to automate everything
  10. CW: niche package manager - call for feedback on new spec

    #unicornpkg users, developers, maintainers of alternative implementations, as well as anyone who has experience with #ComputerCraft package managers are invited to leave feedback on the new-and-improved unicornpkg remotes spec.

  11. Excited to work with @sammy and PG321 (not on Mastodon) on the #unicornpkg package remote spec! The current (unspecified) implementation is utter garbage.

    unicornpkg.madefor.cc

    #computercraft #packagemanagers

  12. My oldest updated his #ComputerCraft emulator for #iOS to include some #IAP content for the first time, finally joining the world of capitalism after much free work on it.

    apps.apple.com/us/app/craftos-

    If you have a buck laying around I’m not not suggesting that you send it his way 😄💵

  13. Some #SneakPeak from my #UnlimitedPeripheralWorks add-on for #Computercraft. Finally, Reality Forger comes back with the ability to change the appearance of a specific block to nearly anything. And you can also control the light level, visibility, and even the ability to pass through this block.

    #ModdedMinecraft #minecraft

  14. Try my new CC:T addon - UnlimitedPeriphralWorks for 1.20 Forge/Fabric

    This mod provides a lot of integrations with existing mods and cool features, like peripheral proxy, for short-range wireless connections and ability to put several upgrades on one side of turtle or pocket computer. Mod released for 1.20 Forge/Fabric, free and open source.

    modrinth.com/mod/unlimitedperi

    @computercraft

  15. CC:C Bridge Mod

    I thought I'll post this here. CC:C Bridge is a Minecraft mod that adds compatibility between the ComputerCraft and Create mod in Forge and Fabric!

    Things like passing data between Display Sources and Targets is now possible. But not only that but also other stuff like the Scroller Pane, making usage of Creates features.

    There is much more too to discover and we are actively updating it. It is fully Open Source: github.com/tweaked-programs/cc

    @computercraft #computercraft

  16. @computercraft What most strange thing you use computercraft for?

    I used it boring things, usually, like farm automations and etc. Maybe you had better ideas in past?

  17. Last week I began my first foray into #gameDev by checking out #Lua and #Löve2D ! :gamecube:

    I'd been a gamer and a programmer for a long time, but I hadn't tried coding a game myself.

    I feel it was fitting that I only knew/heard about Lua from the #Minecraft #Tekkit mod. ( #ComputerCraft , to be more precise. )

    I had an absolute blast exploring LÖVE through a tutorial. Learning about how collisions, hitscans, quads and assets are written algorithmically was awesome!

  18. Frage in die #Minecraft Runde:
    Hat jemand ne gute Implementierung für die Farming Turtle von #ComputerCraft, die er teilen will? 🤔 🥸