WorldResource
A world export: a JSON file, `<name>.world.json`, of content the server spawns once after resources have started, through the same APIs a script uses. List the files in the KCDS_WORLD_RESOURCES environment variable, separated like PATH. Exports belong to the server and last until it shuts down, and worldResourcesReady fires when all have loaded. The format is { level, props: [{ model, position, rotation, scale, physics, dimension }], effects: [{ effect, position, ...Vfx options }], lights: [{ position, color, intensity, radius, castShadows }], world: [LevelEdit definitions], areas: [Area.create definitions], patrolRoutes: [PatrolRoute.create definitions] }. All lists are optional, and a file with an error adds nothing.
worldResource.ready
readyWhether all listed exports have loaded.
worldResource.all()
WorldResource.all()All loaded exports.
worldResource.find()
WorldResource.find(name)The export with this name, the file name without .world.json, or null.
worldResource.record
recordThe export's raw record as loaded, or null.
worldResource.name
nameThe export's name.
worldResource.path
pathThe file it came from.
worldResource.level
levelThe level it was made in.
worldResource.loaded
loadedWhether it is loaded.
worldResource.props
propsProps it spawned that still exist, in file order.
worldResource.effects
effectsEffects it spawned that still exist.
worldResource.lights
lightsLights it spawned that still exist.
worldResource.levelEdits
levelEditsIts level edits still applied.
worldResource.items
itemsGround items from it that are still there, in file order. Its items list has { item, position, rotation?, amount?, name?, quality?, health?, condition?, dimension? }, working like GroundItem.spawn.
worldResource.doors
doorsDoors it created that still exist, in file order. Its doors list uses Door.spawn definitions, { model, position, rotation?, name?, locked?, lock?, canBePicked?, lockLevel?, lockKey? }, plus dimension?. The server owns them, so they last until shutdown. Level doors it removed appear in levelEdits and Door.removed instead.
worldResource.smartObjects
smartObjectsSmart objects it created that still exist, in file order. Its smartObjects list has { blueprint, position, rotation?, name?, dimension? }, working like SmartObject.spawn. Dice tables and crafting stations behave like the level's. Level stations it removed appear in levelEdits instead.
worldResource.areas
areasIts areas that still exist.
worldResource.patrolRoutes
patrolRoutesIts patrol routes that still exist.