Compare commits

...

2 Commits

Author SHA1 Message Date
Andrew Lalis 6615635013 Added start of package manager. 2019-05-07 15:20:59 +02:00
Andrew Lalis db2dd32d04 Added minification. 2019-05-07 13:57:44 +02:00
5 changed files with 36 additions and 1 deletions

1
min_minify.lua Normal file

File diff suppressed because one or more lines are too long

10
minify_all.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Executes minify program on all lua scripts in the repo.
find . -name "*.lua" | lua minify.lua minify
for i in *.lua; do
echo "$i";
lua minify.lua minify "$i" > "min_$i"
done

View File

@ -0,0 +1,17 @@
local component = require("component")
local event = require("event")
local modem = component.modem
local PORT = 80
local PROTOCOL = "pm"
local function initialize()
modem.open(PORT)
print("Initialized pm_client on port " .. PORT)
end
-- Main Program Script
local action = arg[1]
if action == nil then
print("No action specified.")
end

View File

@ -0,0 +1,8 @@
-- Main Program Script
local action = arg[1]
if action == nil then
print("No action specified.")
os.exit()
end
print("You entered the action: " .. action)

View File

@ -1 +0,0 @@
local a=require("robot")local b=require("component")local c=b.tractor_beam local d=b.inventory_controller local e="minecraft:sapling"local f=0 local g="minecraft:dye"local h=15 local i=false local function j()print("#--------------------------------#")print("# Tree Chopping Program exited. #")os.exit()end local function k(t,u)for v=1,16 do local w=d.getStackInInternalSlot(v)if(w~=nil and w.name==t and w.damage==u)then a.select(v)return true end end return false end local function l(t,u)local v=k(t,u)if i and not v then print("Out of "..t..", exiting.")j()end while not v do print("Cannot find "..t.." in inventory. Please add some, and press enter.")io.read()v=k(t,u)end end local function m()l(e,f)local t=a.place()while not t do print("Unable to place the sapling. Please remove any blocks in front of the robot, and press enter.")io.read()t=a.place()end end local function n()local t,u=a.detect()while u~="solid"do l(g,h)a.place()t,u=a.detect()end end local function o()local t=a.durability()if i and(t==nil or t<0.1)then print("Inadequate tool to chop trees, exiting.")j()end while(t==nil)or(t<0.1)do print("Please ensure that a lumber axe with at least 10% durability is equipped in the tool slot, and press enter.")io.read()t=a.durability()end a.swing()end local function p()local t=c.suck()while t do t=c.suck()end end local function q()m()n()end local function r()q()o()os.sleep(2)p()end local function s()print("# Andrew's Tree Chopping Program #")print("# Copyright 2018 Andrew Lalis #")print("#--------------------------------#")print("Please enter the number of trees to chop, or -1 to chop until out of resources.")local t=tonumber(io.read())if(t==nil or t==-1)then i=true print(" Chopping trees until out of resources.")while i do r()end else print(" Chopping "..t.." trees.")for u=1,t do r()end end j()end s()