Skip to content

Commit a25ce23

Browse files
committed
refactor: remove old config in api.lua
1 parent 4b36304 commit a25ce23

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/lua/api.lua

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function API.update(_)
8181
end
8282

8383
API.server_socket:settimeout(SOCKET_TIMEOUT)
84-
local port = BALATRO_BOT_CONFIG.port
84+
local port = G.BALATROBOT_PORT
8585
local success, err = API.server_socket:bind("127.0.0.1", tonumber(port) or 12346)
8686
if not success then
8787
sendErrorMessage("Failed to bind to port " .. port .. ": " .. tostring(err), "API")
@@ -180,21 +180,14 @@ function API.send_error_response(message, error_code, context)
180180
API.send_response(response)
181181
end
182182

183-
---Initializes the API by hooking into the game's update loop and configuring settings
183+
---Initializes the API by setting up the update timer
184184
function API.init()
185-
-- Hook into the game's update loop
185+
-- Hook API.update into the existing love.update that's managed by settings.lua
186186
local original_update = love.update
187-
love.update = function(_)
188-
original_update(BALATRO_BOT_CONFIG.dt)
189-
API.update(BALATRO_BOT_CONFIG.dt)
190-
end
191-
192-
if not BALATRO_BOT_CONFIG.vsync_enabled then
193-
love.window.setVSync(0)
194-
end
195-
196-
if BALATRO_BOT_CONFIG.max_fps then
197-
G.FPS_CAP = 60
187+
---@diagnostic disable-next-line: duplicate-set-field
188+
love.update = function(dt)
189+
original_update(dt)
190+
API.update(dt)
198191
end
199192

200193
sendInfoMessage("BalatrobotAPI initialized", "API")

0 commit comments

Comments
 (0)