Skip to content

Instantly share code, notes, and snippets.

View bananasov's full-sized avatar
🍵

bananasov

🍵
  • The Netherlands
  • 19:19 (UTC +01:00)
View GitHub Profile
@bananasov
bananasov / buttplug.lua
Created October 17, 2023 21:28
Buttplug.io connection for CC
--
-- buttplug.lua
--
-- MIT License
--
-- Copyright (c) 2021 abbiwyn
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
{
"version": "1.0.13",
"description": "Plugin and package manager for Lite XL editor.",
"homepage": "https://github.com/lite-xl/lite-xl-plugin-manager",
"license": "LPM",
"architecture": {
"64bit": {
"url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/v1.0.13/lpm.x86_64-windows.exe#/lpm.exe",
"hash": "d2d7e626ddb14c4488765a2518176a1158b30faa8525ea19042f7a1ed641c3c3"
}
@bananasov
bananasov / slutball.lua
Last active August 11, 2023 19:47
Create powah! charged snowballs using turtles and UPW
local ball_side = "top"
local orb_side = "front"
local orb = peripheral.wrap(orb_side) or error("Guh")
---@return number
local function get_orb_item_amount()
return #orb.items()
end
@bananasov
bananasov / farm.lua
Created August 7, 2023 15:52
Industrial Revolution + CC: Tweaked auto farming thing for the farmer machine
local sides = {
barrel = "top",
machine = "bottom"
}
local barrel = peripheral.wrap(sides.barrel)
local machine = peripheral.wrap(sides.machine)
local input_slots = {
2, 3,
@bananasov
bananasov / peripheral.lua
Created October 8, 2022 21:01
A simple library that adds custom peripheral names to the peripheral library.
local pperipheral = {custom_names = {}}
local oldCall, oldGetType, oldWrap, oldFind = peripheral.call, peripheral.getType, peripheral.wrap, peripheral.find
--- Peripheral call method that supports custom names
---@param name string The name of the peripheral to invoke the method on.
---@param method string The name of the method
---@param ... any Additional arguments
---@return any? The return values of the peripheral method.
function pperipheral.call(name, method, ...)
local name = pperipheral.custom_names[name] or name
@bananasov
bananasov / energy.lua
Last active July 29, 2022 15:40
Energy monitor for CC: Tweaked (and CC: Restiched) and tech reborn
local energy = {
su = {
battery_box = {name = "low_voltage_su"},
mfe = {name = "medium_voltage_su"},
mfsu = {name = "high_voltage_su"}
},
solar = {
basic = {name = "basic_solar_panel"},
advanced = {name = "advanced_solar_panel"},
industrial = {name = "industrial_solar_panel"},
@bananasov
bananasov / bee_keeping.lua
Created July 10, 2022 13:50
Bee keeping 👍
local config = require("config")
local bee_locations = config.bee_locations
local GuiH = require("GuiH")
local monitor = peripheral.find("monitor")
local gui = GuiH.new(monitor)
gui.debug = true
local watermarkText = gui.new.text{
text = gui.text{
@bananasov
bananasov / check.lua
Created July 6, 2022 18:24
Get current items and max amount of items from connected chests in ComputerCraft
-- Tested on ComputerCraft: Restiched v1.101.0 on Minecraft 1.19
local function getChests()
local chests = peripheral.getNames()
local actual_chests = {}
for i, chest in pairs(chests) do
if chest:find("chest") or chest:find("barrel") then
table.insert(actual_chests, chest)
end
end
@bananasov
bananasov / beer_client.lua
Last active May 30, 2022 12:59
Beer client
local modem = peripheral.find("modem") or error("No modem attached", 0)
modem.open(80)
print("Opened to port 80")
modem.transmit(81, 80, "client_request")
while true do
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
if channel == 80 then