LoadingScreen

Client only. A server's own page over joining and loading. Without one, the game's loading screen stays. Name the page in package.json as kcds.loadingScreen, either a path or { page, files }. It shows once its own files have arrived, up to 32 MB in total and 8 MB per file, while the rest downloads. LoadingScreen.show(url) can replace it later, once resources have started. The page is an unfocused, full-screen web view of your client resource. It receives the window event 'kcdsLoading' with detail { stage, percent }, where stage is 'download', with resourcesDone, resourcesTotal, bytesDone and bytesTotal too, 'resources', 'level' or 'ready'. It closes at 'ready' and after any running download has ended, at most 10 minutes later. Scripts hear the stages from 'resources' on as the event loadingProgress.

loadingScreen.show()

LoadingScreen.show(url)

Shows a page, replacing an earlier one. Returns false once the world is ready. Call it when your client script loads.

loadingScreen.hold()

LoadingScreen.hold()

Keeps the page up after the world is ready until release(), for at most 30 seconds. Returns false if there is no page or it is already held.

loadingScreen.release()

LoadingScreen.release()

Ends a hold, and once the world is ready, the page closes at once. Returns false if there is no hold.

loadingScreen.stage

stage

The current stage: 'download', 'resources', 'level' or 'ready'.

loadingScreen.percent

percent

Progress in the stage, from 0 to 100: the share of bytes at 'download', and the game's level-load percentage at 'level'.