Help us shape the future of Go! Take the 2026 Go Developer Survey

source

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package source loads and expands authored world YAML into a flat room graph.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPath      = errors.New("world source path is invalid")
	ErrYAML      = errors.New("world source YAML is invalid")
	ErrExpansion = errors.New("world source expansion is invalid")
)

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Yaw, Pitch, Roll float64
	Scale            worldsource.Vec3
	SolidRenderer    string
	Sprite           *worldsource.Sprite
	Tags             []string
	Animation        *worldsource.AnimationBinding
}

type Connection

type Connection struct {
	ID           string
	A, B         Endpoint
	Direction    worldsource.PortalDirection
	NonEuclidean bool
}

type Content

type Content struct {
	ID, SourceID, Instance, Kind string
	Position                     worldsource.Vec3
	Actor                        *Actor
}

type Endpoint

type Endpoint struct{ Room, Edge string }

type Expanded

type Expanded struct {
	Fluids      *worldsource.Fluids
	Vegetation  *worldsource.Vegetation
	Rooms       []Room
	Connections []Connection
	Environment *sdkworld.Environment
	Sky         *worldsource.Sky
	// Lighting retains authored global coordinates and order independently of
	// prefab expansion. Its payload and light slice belong to this result.
	Lighting *sdkworld.Lighting
	// UV is nil for released source versions; v5 owns complete effective settings.
	UV                   *worldsource.UVSettings
	SolidPrefabs         []SolidPrefab
	Solids               []worldsource.Solid
	Contents             []Content
	Animations           *worldsource.Animations
	Particles            *worldsource.Particles
	ParticleEmitters     []worldsource.ParticleEmitter
	ParticleEmitterRooms map[string]string
}

func Decode

func Decode(contents []byte) (Expanded, error)

Decode strictly decodes and expands one complete YAML document.

func Load

func Load(root, relative string) (Expanded, error)

Load reads one confined YAML file and expands all prefab instances.

type Room

type Room struct {
	VegetationLayers                                []worldsource.VegetationLayer
	ID, SourceRoom, Instance                        string
	Sky                                             bool
	Boundary                                        []worldsource.Edge
	Floor, Ceiling                                  worldsource.Plane
	FloorMaterial, CeilingMaterial                  string
	Contents                                        []Content
	FloorUV, CeilingUV, WallUV                      *worldsource.UVSettings
	WallBands                                       *worldsource.BandSettings
	FloorSecondary, CeilingSecondary, WallSecondary *worldsource.SecondarySettings
}

type SolidPrefab

type SolidPrefab struct {
	ID     string
	Solids []worldsource.Solid
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL