Ok, but I'm currently working on this, because the original was for minecraft 1.5.2 and some methods there aren't by now.
local monitor = peripheral.wrap("monitor_2")
local pim = peripheral.wrap("emptyinventory_4")
if pim == nil then error("No PIM") end
local standdir = "east"
local rsside = "bottom"
local high = 10
local low = 1
local wait = 3
local w,h = monitor.getSize()
local armorMenu, menu
local armor = {}
armor[1] = colors.white
armor[2] = colors.gray
armor[3] = colors.pink
armor[4] = colors.lime
armor[5] = colors.lightBlue
armor[6] = colors.magenta
armor[7] = colors.lightGray
armor[8] = colors.blue
armor[9] = colors.black
armor[10] = colors.brown
armor[11] = colors.yellow
local inUse = {}
inUse[2] = false
inUse[3] = false
inUse[4] = false
inUse[5] = false
inUse[6] = false
inUse[7] = false
inUse[8] = false
inUse[9] = false
local cutNetwork = function(n)
local current = rs.getBundledOutput(rsside)
rs.setBundledOutput(rsside,current + armor[n])
sleep(1)
end
local powerNetwork = function(n)
local current = rs.getBundledOutput(rsside)
rs.setBundledOutput(rsside,current - armor[n])
sleep(1)
end
local armorToStand = function(n)
local current = rs.getBundledOutput(rsside)
rs.setBundledOutput(rsside,current + armor[n] + colors.brown)
sleep(5)
rs.setBundledOutput(rsside,current - armor[n] - colors.brown)
end
local clearStand = function()
sleep(0.1)
rs.setBundledOutput("bottom",rs.getBundledOutput("bottom") + colors.yellow)
sleep(5)
rs.setBundledOutput("bottom",rs.getBundledOutput("bottom") - colors.yellow)
end
local equipArmor = function()
local inv = pim.getInventoryName()
if inv == "EmptyInventory" then return end
for i=39,36,-1 do
local data = pim.getStackInSlot(i)
if data ~= nil then
term.clear()
term.setTextColor(colors.red)
term.setCursorPos(math.floor((w-41)/2),math.floor(h/2))
term.write("Already wearing armor. Touch to continue.")
os.pullEvent("monitor_touch")
clearStand()
return false
end
end
pim.pullItemIntoSlot(standdir,0,1,103)
sleep(0.33)
pim.pullItemIntoSlot(standdir,1,1,102)
sleep(0.33)
pim.pullItemIntoSlot(standdir,2,1,101)
sleep(0.33)
pim.pullItemIntoSlot(standdir,3,1,100)
rs.setBundledOutput("bottom",rs.getBundledOutput("bottom") - colors.brown)
return true
end
local unequipArmor = function()
local inv = pim.getInvName()
if inv == "EmptyInventory" then return end
pim.pushItemIntoSlot(standdir,103,1,0)
sleep(0.33)
pim.pushItemIntoSlot(standdir,102,1,1)
sleep(0.33)
pim.pushItemIntoSlot(standdir,101,1,2)
sleep(0.33)
pim.pushItemIntoSlot(standdir,100,1,3)
-- stand.setPriority(high) --
end
local activateSuit = function(suit,n)
if inUse[n] then
term.setBackgroundColor(colors.black)
term.clear()
term.setCursorPos(math.floor((w-44)/2),math.floor(h/2))
term.write("Please stand on the suit pad to remove suit.")
while pim.getInvName() == "EmptyInventory" do
sleep(1)
end
unequipArmor()
sleep(1)
clearStand()
powerLights(n)
armorMenu[suit].color = colors.lime
inUse[n] = false
else
term.setBackgroundColor(colors.black)
term.clear()
term.setCursorPos(math.floor((w-43)/2),math.floor(h/2))
term.write("Please stand on the suit pad to equip suit.")
armorToStand(n)
while pim.getInventoryName() == "EmptyInventory" do
sleep(1)
end
if equipArmor() then
armorMenu[suit].color = colors.red
inUse[n] = true
else
powerLights(n)
end
end
end
local printButton = function(button,color)
term.setBackgroundColor(color)
for j = 1,button.sizeY do
term.setCursorPos(button.X,button.Y+j-1)
term.write(string.rep(" ",button.sizeX))
end
if type(button.text) == "table" then
local n = #button.text
for i = 1,n do
term.setCursorPos(button.X+math.floor((button.sizeX-button.text[i]:len())/2),button.Y+math.floor((button.sizeY-n)/2)+i-1)
term.write(button.text[i])
end
else
term.setCursorPos(button.X+math.floor((button.sizeX-button.text:len())/2),button.Y+math.floor(button.sizeY/2))
term.write(button.text)
end
end
local printButtons = function(buttons)
for k,v in pairs(buttons) do
printButton(v,v.color)
end
end
local flashButton = function(button)
printButton(button, button.colorFlash)
sleep(0.2)
printButton(button, button.color)
sleep(0.1)
end
local waitForButton = function(buttons)
local button
while button == nil do
local e, side, X, Y = os.pullEvent("monitor_touch")
for k,v in pairs(buttons) do
if X >= v.X and X <= v.X+v.sizeX and Y >= v.Y and Y <= v.Y+v.sizeY then
button = k
break
end
end
end
return button
end
armorMenu =
{
["powersuit"] = {},
["tartarite"] = {},
["obsidian"] = {},
["glowstone"] = {},
["ironman"] = {},
["thaumium"] = {},
["diamond"] = {},
["iron"] = {},
}
armorMenu["powersuit"].text = {"War","Machine"}
armorMenu["powersuit"].X = 2
armorMenu["powersuit"].Y = math.floor((h-6)/2)
armorMenu["powersuit"].sizeX = 11
armorMenu["powersuit"].sizeY = 6
armorMenu["powersuit"].color = colors.lightBlue
armorMenu["powersuit"].colorFlash= colors.red
armorMenu["powersuit"].func = function () activateSuit("powersuit",2) end
armorMenu["tartarite"].text = {"Tartarite", "Armor"}
armorMenu["tartarite"].X = 14
armorMenu["tartarite"].Y = math.floor((h-6)/2)
armorMenu["tartarite"].sizeX = 11
armorMenu["tartarite"].sizeY = 6
armorMenu["tartarite"].color = colors.lightBlue
armorMenu["tartarite"].colorFlash= colors.red
armorMenu["tartarite"].func = function () activateSuit("tartarite",3) end
armorMenu["obsidian"].text = {"Obsidian", "Armor"}
armorMenu["obsidian"].X = 27
armorMenu["obsidian"].Y = math.floor((h-6)/2)
armorMenu["obsidian"].sizeX = 11
armorMenu["obsidian"].sizeY = 6
armorMenu["obsidian"].color = colors.lightBlue
armorMenu["obsidian"].colorFlash= colors.red
armorMenu["obsidian"].func = function () activateSuit("obsidian",4) end
armorMenu["glowstone"].text = {"Glowstone", "Armor"}
armorMenu["glowstone"].X = 39
armorMenu["glowstone"].Y = math.floor((h-6)/2)
armorMenu["glowstone"].sizeX = 11
armorMenu["glowstone"].sizeY = 6
armorMenu["glowstone"].color = colors.lightBlue
armorMenu["glowstone"].colorFlash= colors.red
armorMenu["glowstone"].func = function () activateSuit("glowstone",5) end
armorMenu["ironman"].text = {"Mark", "XVII"}
armorMenu["ironman"].X = 2
armorMenu["ironman"].Y = math.floor((h-6)/1)
armorMenu["ironman"].sizeX = 11
armorMenu["ironman"].sizeY = 6
armorMenu["ironman"].color = colors.lightBlue
armorMenu["ironman"].colorFlash= colors.red
armorMenu["ironman"].func = function () activateSuit("ironman",6) end
armorMenu["thaumium"].text = {"Thaumium", "Armor"}
armorMenu["thaumium"].X = 14
armorMenu["thaumium"].Y = math.floor((h-6)/1)
armorMenu["thaumium"].sizeX = 11
armorMenu["thaumium"].sizeY = 6
armorMenu["thaumium"].color = colors.lightBlue
armorMenu["thaumium"].colorFlash= colors.red
armorMenu["thaumium"].func = function () activateSuit("thaumium",7) end
armorMenu["diamond"].text = {"Diamond", "Armor"}
armorMenu["diamond"].X = 27
armorMenu["diamond"].Y = math.floor((h-6)/1)
armorMenu["diamond"].sizeX = 11
armorMenu["diamond"].sizeY = 6
armorMenu["diamond"].color = colors.lightBlue
armorMenu["diamond"].colorFlash= colors.red
armorMenu["diamond"].func = function () activateSuit("diamond",8) end
armorMenu["iron"].text = {"Iron", "Armor"}
armorMenu["iron"].X = 39
armorMenu["iron"].Y = math.floor((h-6)/1)
armorMenu["iron"].sizeX = 11
armorMenu["iron"].sizeY = 6
armorMenu["iron"].color = colors.lightBlue
armorMenu["iron"].colorFlash= colors.red
armorMenu["iron"].func = function () activateSuit("iron",9) end
term.redirect(monitor)
term.setBackgroundColor(colors.black)
term.clear()
term.setTextColor(colors.red)
term.setCursorPos(math.floor((w-15)/2),math.floor(h/2))
term.write("Touch to start")
os.pullEvent("monitor_touch")
term.clear()
sleep(0.3)
term.setCursorPos(math.floor((w-15)/2),math.floor(h/2))
textutils.slowWrite("Loading",15)
clearStand()
term.setBackgroundColor(colors.black)
term.clear()
term.setTextColor(colors.yellow)
term.setCursorPos(math.floor((w-27)/1),3)
term.write("Welcome")
term.setTextColor(colors.white)
menu = armorMenu
while true do
term.setBackgroundColor(colors.black)
term.clear()
term.setTextColor(colors.yellow)
term.setCursorPos(math.floor((w-27)/1),3)
term.write("Benvenuto")
term.setTextColor(colors.white)
printButtons(menu)
local b = waitForButton(armorMenu)
menu[b].func()
end