tools(bunsik): 장면 덤프와 간이 3D 미리보기 렌더러(배치 확인용)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"""Open Cloud 도구: 게임 파일 업로드, 로블록스 서버에서 Luau 실행.
|
||||
|
||||
python3 tools/cloud.py publish build/BunsikTycoon.rbxl [--published]
|
||||
python3 tools/cloud.py run script.luau [--version N] # 기본: 가장 최근 저장 버전
|
||||
python3 tools/cloud.py run script.luau [--version N] [--out file] # 기본: 가장 최근 저장 버전
|
||||
python3 tools/cloud.py products # 게임패스·개발자 상품 만들기(이미 있으면 건너뜀)
|
||||
python3 tools/cloud.py place # 서버 인원 6명, 설명 설정
|
||||
|
||||
@@ -55,15 +55,21 @@ def publish(path, published=False):
|
||||
return res["versionNumber"]
|
||||
|
||||
|
||||
def run(script, version=None, timeout_s=300):
|
||||
def run(script, version=None, timeout_s=300, binary_out=None):
|
||||
base = f"https://apis.roblox.com/cloud/v2/universes/{UNIVERSE}/places/{PLACE}"
|
||||
if version:
|
||||
base += f"/versions/{version}"
|
||||
task = request("POST", base + "/luau-execution-session-tasks", {"script": script, "timeout": f"{timeout_s}s"})
|
||||
body = {"script": script, "timeout": f"{timeout_s}s"}
|
||||
if binary_out:
|
||||
body["enableBinaryOutput"] = True
|
||||
task = request("POST", base + "/luau-execution-session-tasks", body)
|
||||
path = task["path"]
|
||||
while task.get("state") not in ("COMPLETE", "FAILED", "CANCELLED"):
|
||||
time.sleep(3)
|
||||
task = request("GET", f"https://apis.roblox.com/cloud/v2/{path}")
|
||||
if binary_out and task.get("binaryOutputUri"):
|
||||
with urllib.request.urlopen(task["binaryOutputUri"], timeout=120) as r, open(binary_out, "wb") as f:
|
||||
f.write(r.read())
|
||||
logs = request("GET", f"https://apis.roblox.com/cloud/v2/{path}/logs?maxPageSize=10000")
|
||||
lines = []
|
||||
for page in logs.get("luauExecutionSessionTaskLogs", []):
|
||||
@@ -154,7 +160,8 @@ def main(argv):
|
||||
version = int(argv[argv.index("--version") + 1])
|
||||
with open(argv[1]) as f:
|
||||
script = f.read()
|
||||
task, lines = run(script, version)
|
||||
out = argv[argv.index("--out") + 1] if "--out" in argv else None
|
||||
task, lines = run(script, version, binary_out=out)
|
||||
for line in lines:
|
||||
print(line)
|
||||
print(f"state: {task['state']}")
|
||||
|
||||
Reference in New Issue
Block a user