File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ local json = require("json")
44-- Constants
55local UDP_BUFFER_SIZE = 65536
66local SOCKET_TIMEOUT = 0
7+ -- The threshold for determining when game state transitions are complete.
8+ -- This value represents the maximum number of events allowed in the game's event queue
9+ -- to consider the game idle and waiting for user action. When the queue has fewer than
10+ -- 3 events, the game is considered stable enough to process API responses. This is a
11+ -- heuristic based on empirical testing to ensure smooth gameplay without delays.
712local EVENT_QUEUE_THRESHOLD = 3
813API = {}
914API .socket = nil
Original file line number Diff line number Diff line change @@ -111,7 +111,12 @@ function utils.table_to_json(obj, depth)
111111 return json .encode (sanitized )
112112end
113113
114- -- Load debug
114+ -- Load DebugPlus integration
115+ -- Attempt to load the optional DebugPlus mod (https://github.com/WilsontheWolf/DebugPlus/tree/master).
116+ -- DebugPlus is a Balatro mod that provides additional debugging utilities for mod development,
117+ -- such as custom debug commands and structured logging. It is not required for core functionality
118+ -- and is primarily intended for development and debugging purposes. If the module is unavailable
119+ -- or incompatible, the program will continue to function without it.
115120local success , dpAPI = pcall (require , " debugplus-api" )
116121
117122if success and dpAPI .isVersionCompatible (1 ) then
Original file line number Diff line number Diff line change @@ -71,7 +71,20 @@ def send_and_receive_api_message(
7171
7272
7373def assert_error_response (response , expected_error_text , expected_context_keys = None ):
74- """Helper function to assert error response format and content."""
74+ """
75+ Helper function to assert the format and content of an error response.
76+
77+ Args:
78+ response (dict): The response dictionary to validate. Must contain at least
79+ the keys "error" and "state".
80+ expected_error_text (str): The expected error message text to check within
81+ the "error" field of the response.
82+ expected_context_keys (list, optional): A list of keys expected to be present
83+ in the "context" field of the response, if the "context" field exists.
84+
85+ Raises:
86+ AssertionError: If the response does not match the expected format or content.
87+ """
7588 assert isinstance (response , dict )
7689 assert "error" in response
7790 assert "state" in response
You can’t perform that action at this time.
0 commit comments