refactor(lib): utilize spawn event
This commit is contained in:
parent
e00220f0a7
commit
c9032653f9
@ -111,6 +111,10 @@ function attack_entities(target_kind, minimum)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function check_food(hunger)
|
function check_food(hunger)
|
||||||
|
if not hunger then
|
||||||
|
hunger = client.hunger
|
||||||
|
end
|
||||||
|
|
||||||
if hunger.food >= 20 then
|
if hunger.food >= 20 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -61,9 +61,11 @@ function update_listeners()
|
|||||||
message = function()
|
message = function()
|
||||||
info("bot successfully logged in!")
|
info("bot successfully logged in!")
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
spawn = {
|
||||||
eat = function()
|
eat = function()
|
||||||
sleep(5000)
|
sleep(5000)
|
||||||
check_food(client.hunger)
|
check_food()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
death = {
|
death = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user