feat: switch to luajit for more features

This commit is contained in:
2025-02-23 02:49:35 -05:00
parent b1dbfa6110
commit 168ac1bb46
10 changed files with 48 additions and 65 deletions

View File

@@ -9,7 +9,7 @@ function log_player_positions()
and e.position.z > center.z - radius
and e.position.z < center.z + radius
end)
for _, e in entities do
for _, e in ipairs(entities) do
client:chat(string.format("%s (%s) at %.1f %.1f %.1f", e.kind, e.id, e.position.x, e.position.y, e.position.z))
end
end

View File

@@ -1,38 +1,38 @@
function steal(item_name)
for _, chest_pos in client:find_blocks(client.position, get_block_states({ "chest" })) do
client:chat(dump(chest_pos))
for _, chest_pos in ipairs(client:find_blocks(client.position, get_block_states({ "chest" }))) do
client:chat(dump(chest_pos))
client:goto({ position = chest_pos, radius = 3 }, { type = RADIUS_GOAL })
while client.pathfinder.is_calculating or client.pathfinder.is_executing do
sleep(50)
end
client:look_at(chest_pos)
client:go_to({ position = chest_pos, radius = 3 }, { type = RADIUS_GOAL })
while client.pathfinder.is_calculating or client.pathfinder.is_executing do
sleep(50)
end
client:look_at(chest_pos)
local container = client:open_container_at(chest_pos)
for index, item in container.contents do
if item.kind == item_name then
container:click({slot = index - 1}, THROW_ALL)
sleep(50)
end
end
local container = client:open_container_at(chest_pos)
for index, item in ipairs(container.contents) do
if item.kind == item_name then
container:click({ slot = index - 1 }, THROW_ALL)
sleep(50)
end
end
container = nil
while client.open_container do
sleep(50)
end
end
container = nil
while client.open_container do
sleep(50)
end
end
end
function drop_all_hotbar()
local inventory = client:open_inventory()
for i = 0, 9 do
inventory:click({slot = 36 + i}, THROW_ALL)
end
local inventory = client:open_inventory()
for i = 0, 9 do
inventory:click({ slot = 36 + i }, THROW_ALL)
end
end
function drop_all_inventory()
local inventory = client:open_inventory()
for i = 0, 45 do
inventory:click({slot = i}, THROW_ALL)
end
local inventory = client:open_inventory()
for i = 0, 45 do
inventory:click({ slot = i }, THROW_ALL)
end
end

View File

@@ -8,10 +8,10 @@ function look_at_player(name)
end
end
function goto_player(name, opts)
function go_to_player(name, opts)
local player = get_player(name)
if player then
client:goto(player.position, opts)
client:go_to(player.position, opts)
else
client:chat(string.format("/w %s player not found!", sender))
end

View File

@@ -1,6 +1,6 @@
function get_player(name)
local target_uuid = nil
for _, player in client.tab_list do
for _, player in ipairs(client.tab_list) do
if player.name == name then
target_uuid = player.uuid
break