jille_Jr icon

CC: Cannon mail [Server] - inv.lua

jille_Jr | PRO | 02/22/16 07:36:54 PM UTC | 0 ⭐ | 367 👁️ | Never ⏰ | []
Lua |

770 B

|

None

|

0 👍

/

0 👎

-- inv.lua
 
--(( Settings ))--
 
--(( Variables ))--
 
local dropper = peripheral.wrap("dropper_0")
or error("Unable to wrap dropper!")
 
--(( Functions ))--
 
-- get the side to eject from the dropper
function getDirection(r)
    r = r:lower()
 
    if r == "jag"
    or r == "kalle"
    or r == "akajag"
    then
        return "north"
    end
    
    if r == "bejno"
    or r == "fabian"
    then
        return "east"
    end
 
    if r == "knut"
    or r == "knaut"
    then
        return "south"
    end
end
 
function emptyDropper(dir)
    if dir == nil then
        dir = getDirection("jag")
    end
    for slot = 1,dropper.getInventorySize() do
        dropper.pushItem(dir, slot)
    end
end
 
-- dir=direction we send the item in the drive to
function emptyDrive(dir)
    dropper.pullItem("up",1)
    emptyDropper(dir)
end
 
-- eof

Comments