From ce0291b5e2c17297de7204b094561ea6a0325ca9 Mon Sep 17 00:00:00 2001 From: stevenong99-vp Date: Tue, 22 Apr 2025 14:39:07 +0800 Subject: [PATCH] Added wait function --- plugins/acp/acp_plugin_gamesdk/acp_plugin.py | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugins/acp/acp_plugin_gamesdk/acp_plugin.py b/plugins/acp/acp_plugin_gamesdk/acp_plugin.py index 6dd736f6..df22c2f3 100644 --- a/plugins/acp/acp_plugin_gamesdk/acp_plugin.py +++ b/plugins/acp/acp_plugin_gamesdk/acp_plugin.py @@ -6,6 +6,7 @@ from dataclasses import dataclass, asdict from datetime import datetime import traceback +import time import socketio import socketio.client @@ -626,3 +627,25 @@ def _deliver_job_executable(self, jobId: int, deliverableType: str, deliverable: except Exception as e: print(traceback.format_exc()) return FunctionResultStatus.FAILED, f"System error while delivering items - try again after a short delay. {str(e)}", {} + + @property + def wait(self) -> Function: + + wait_duration_arg = Argument( + name="waitDuration", + type="integer", + description="The duration to wait in seconds (minimum 30 seconds)", + ) + + return Function( + fn_name="wait", + fn_description="Waits for a specified amount of time", + args=[wait_duration_arg], + executable=self._wait_executable + ) + + def _wait_executable(self, waitDuration: int) -> Tuple[FunctionResultStatus, str, dict]: + if waitDuration < 30: + waitDuration = 30 + time.sleep(waitDuration) + return FunctionResultStatus.DONE, f"Waited for {waitDuration} seconds", {} \ No newline at end of file