You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
miner/torch.lua

24 lines
576 B

local robot = require("robot")
local component = require("component")
local inventory = component.inventory_controller;
---Place a torch above the robot
---@param side number|nil which side of the empty space to place the torch
local function place_torch(side)
local stack = inventory.getStackInInternalSlot(1)
if stack.name == "minecraft:torch" then
robot.select(1)
if not robot.placeUp(side) then
print('Failed to place torch')
end
else
print('Out of torches')
end
end
return {
place_torch = place_torch
}