Log inGet started
Package

scene_starter.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

scene_starter

The files a new scene is started from, read out of a starter scene folder (@builtin::scenes.starter_*). scene.create { template = ... } copies a starter into a new scene of a world with it, and a new world's startup scene is copied from a starter the same way.

A copy takes every file of the starter except its .meta sidecars, so the new scene gets an identity of its own where it is written. It takes the baked scene.json with the .build.state that records the build script it was baked from, so the new scene opens as the starter does without running its build. README.md and entrypoint.luau carry the new scene's name where the starter leaves a [scene_name] slot, and the copied scene.json records the document it holds as the scene's initial generated baseline (authoring.initialGenerated, as a scene asset.create makes carries), so the first authoring save reads the entities the starter's build placed as that build's own.

local Starter = require("@builtin::modules.scene_starter")
local source = "/zero/source/libs/@builtin/scenes/starter_clearing.scene"
for _, rel in Starter.paths(source) do
    vfs.write("/source/scenes/camp.scene/" .. rel, Starter.bytes(source, rel, "camp"))
end
  • paths(sourcePath): the files a copy takes, relative to the starter folder, sorted.
  • bytes(sourcePath, rel, sceneName): one file's bytes as the new scene holds it, or nil when it cannot be read.
  • sceneName(destPath): the scene name a <name>.scene folder path holds.