From c9032653f99fff4cc50fc9b70f2170ec7ae355e9 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Thu, 20 Mar 2025 18:34:14 -0400 Subject: [PATCH] refactor(lib): utilize spawn event --- lib/automation.lua | 4 ++++ lib/events.lua | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/automation.lua b/lib/automation.lua index b473eae..064f9db 100644 --- a/lib/automation.lua +++ b/lib/automation.lua @@ -111,6 +111,10 @@ function attack_entities(target_kind, minimum) end function check_food(hunger) + if not hunger then + hunger = client.hunger + end + if hunger.food >= 20 then return end diff --git a/lib/events.lua b/lib/events.lua index 3b23b35..0d70437 100644 --- a/lib/events.lua +++ b/lib/events.lua @@ -61,9 +61,11 @@ function update_listeners() message = function() info("bot successfully logged in!") end, + }, + spawn = { eat = function() sleep(5000) - check_food(client.hunger) + check_food() end, }, death = {