Commit be435f08 authored by Fedja Beader's avatar Fedja Beader
Browse files

Quick anti-stealing code smashed together to support long afk at public lava orb farm

parent 5538e285
......@@ -348,12 +348,39 @@ function convert_cobble()
end
local lavaorb_pos = { x = 100000, y = 100000, z = 100000 }
function fetch_lava_orbs()
if not biofuel.enable then return end
local my_pos = core.localplayer:get_pos()
if vector.distance(lavaorb_pos, my_pos) < 9 then
local chest_inv = core.get_inventory(lavaorb_pos)
local my_inv = core.get_inventory()
local orb_src_index = find_item_index(chest_inv["main"], "mobs:lava_orb")
local orb_dst_index = find_item_index(my_inv["bag4contents"], "mobs:lava_orb")
or find_item_index(my_inv["bag4contents"], "")
if orb_src_index and orb_dst_index then
l:debug("Moving one orb")
core.move_stack(lavaorb_pos, "main", orb_src_index, nil, "bag4contents", orb_dst_index, 1)
end
else
--l:debug("Too far from lavaorb chest, waiting")
end
core.after(5, fetch_lava_orbs)
end
local wait_for_punch = false
core.register_on_punchnode(function(pos, node)
if wait_for_punch then
if node.name == "biofuel:refinery" or node.name == "biofuel:refinery_active" then
add_pos_to_list(biofuel.refineries, pos)
l:info("Added refinery")
elseif node.name == "technic:iron_chest" then
lavaorb_pos = pos
l:info("Added lava org chest")
elseif node.name == "drawers:controller" then
l:info("Setting default drawer controller")
biofuel.drawer_controllers[1] = pos
......@@ -415,6 +442,7 @@ core.register_chatcommand("biofuel", {
wait_for_punch = false
elseif args[1] == "start" then
biofuel.enable = true
fetch_lava_orbs()
convert_cobble()
queue:prepend(biofuel_step)
queue:walk()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment