world_builder

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveSpaceTypes

func ResolveSpaceTypes(t *Template) error

func ResolveSpaces

func ResolveSpaces(t *Template) error

func ResolveWorldDefinition

func ResolveWorldDefinition(t *Template) error

Types

type Space

type Space struct {
	ID                         *uuid.UUID `json:"id"`
	Name                       string     `json:"name"`
	NameHash                   string
	Mpath                      string      `json:"mpath"`
	AssetParameters            string      `json:"asset_parameters"`
	Parameters2D               string      `json:"parameters2D"`
	Parameters3D               string      `json:"parameters3D"`
	Secret                     int         `json:"secret"`
	FrameTemplates             interface{} `json:"frame_templates"`
	AllowedSubspacesJSON       *[]string   `json:"allowed_subspaces"`
	AllowedSubspaces           []uuid.UUID
	ChildPlacement             interface{} `json:"child_placement"`
	Minimap                    int         `json:"minimap"`
	Visible                    int         `json:"visible"`
	Metadata                   interface{} `json:"metadata"`
	Position                   interface{} `json:"position"`
	Asset                      interface{} `json:"asset"`
	UniqueAttributeInSpaceType interface{} `json:"uniqueAttributeInSpaceType"`
	UITypeIDJSON               string      `json:"uiTypeId"`
	SpaceTypeIDJSON            string      `json:"spaceTypeId"`
	ParentIDJSON               string      `json:"parentId"`
	SkipCreation               bool        `json:"skip_creation"`
	ParentID                   *uuid.UUID
	UITypeID                   *uuid.UUID
	SpaceTypeID                *uuid.UUID
	OwnedById                  *uuid.UUID
}

func (*Space) GenMissingUUIDs

func (t *Space) GenMissingUUIDs() *Space

func (*Space) SetOwnedByIdIfMissing

func (t *Space) SetOwnedByIdIfMissing(ownerID uuid.UUID) *Space

func (*Space) WriteToDB

func (t *Space) WriteToDB(ctx context.Context, tx *sqlx.Tx) error

type SpaceType

type SpaceType struct {
	ID              *uuid.UUID `json:"id"`
	Name            string     `json:"name"`
	DisplayCategory string     `json:"display_category"`
	Asset           *uuid.UUID `json:"asset"`
	// Here and after fields which will not be used in app code
	// just proxy to according Mysql JSON column use json.RawMessage type
	AuxiliaryTables           json.RawMessage `json:"auxiliary_tables"`
	Description               *string         `json:"description"`
	TypeParameters            json.RawMessage `json:"type_parameters"`
	DefaultInstanceParameters json.RawMessage `json:"default_instance_parameters"`
	AssetTypes                json.RawMessage `json:"asset_types"`
	TypeParameters2D          json.RawMessage `json:"type_parameters_2D"`
	TypeParameters3D          json.RawMessage `json:"type_parameters_3D"`
	DefaultTiles              json.RawMessage `json:"default_tiles"`
	FrameTemplates            json.RawMessage `json:"frame_templates"`
	AllowedSubspaces          json.RawMessage `json:"allowed_subspaces"`
	ChildPlacement            json.RawMessage `json:"child_placement"`
	Minimap                   int             `json:"minimap"`
	Visible                   int             `json:"visible"`
	InfoUIID                  interface{}     `json:"infoui_id"`
	UITypeIDJson              string          `json:"uiTypeId"`
	UITypeID                  *uuid.UUID      `json:"-"`
	SkipCreation              bool            `json:"skip_creation"`
}

func (*SpaceType) GenMissingUUIDs

func (t *SpaceType) GenMissingUUIDs() *SpaceType

func (*SpaceType) WriteToDB

func (t *SpaceType) WriteToDB(ctx context.Context, tx *sqlx.Tx) error

type Template

type Template struct {
	UITypes         map[string]UIType    `json:"ui_types"`
	SpaceTypes      map[string]SpaceType `json:"space_types"`
	Spaces          map[string]Space     `json:"spaces"`
	WorldDefinition WorldDefinition      `json:"world_definition"`
}

type UIType

type UIType struct {
	ID           *uuid.UUID `json:"id"`
	Name         string     `json:"name"`
	Tag          string     `json:"tag"`
	Parameters   struct{}   `json:"parameters"`
	SkipCreation bool       `json:"skip_creation"`
}

func (*UIType) GenMissingUUIDs

func (t *UIType) GenMissingUUIDs() *UIType

func (*UIType) WriteToDB

func (t *UIType) WriteToDB(ctx context.Context, tx *sqlx.Tx) error

type WorldBuilder

type WorldBuilder struct {
	// contains filtered or unexported fields
}

func NewWorldBuilder

func NewWorldBuilder(db *storage.Database, config *config.Config) *WorldBuilder

func (*WorldBuilder) Add

func (w *WorldBuilder) Add(ownerID uuid.UUID, templateID uuid.UUID, domain string, name string) (*WorldMeta, error)

func (*WorldBuilder) InsertRows

func (w *WorldBuilder) InsertRows(t *Template, fullDomain string, ownerID uuid.UUID) error

func (*WorldBuilder) SyncHydra

func (w *WorldBuilder) SyncHydra() error

Synchronize the world domain list with Hydra

func (*WorldBuilder) UpdateHydra

func (w *WorldBuilder) UpdateHydra(fullDomain string) error

type WorldDefinition

type WorldDefinition struct {
	ID                   uuid.UUID
	Tiers                json.RawMessage `json:"tiers"`
	UserSpacesLimit      int             `json:"userSpacesLimit"`
	GatAnchorSpaceID     uuid.UUID
	Gat_anchor_spaceJSON string                `json:"gat_anchor_space"`
	Effects_emitterJSON  string                `json:"effects_emitter"`
	GenericJSON          string                `json:"generic"`
	Config               WorldDefinitionConfig `json:"config"`
	SpawnSpaceID         uuid.UUID
	SpawnSpaceJSON       string          `json:"spawnSpace"`
	SpawnDislocation     json.RawMessage `json:"SpawnDislocation"`
	SkyboxControllerID   uuid.UUID       `json:"SkyboxController"`
	AVAControllerID      uuid.UUID       `json:"AVAController"`
	Decorations          json.RawMessage `json:"Decorations"`
	LODs                 json.RawMessage `json:"LODs"`
}

func (*WorldDefinition) WriteToDB

func (t *WorldDefinition) WriteToDB(ctx context.Context, tx *sqlx.Tx) error

type WorldDefinitionConfig

type WorldDefinitionConfig struct {
	Kind   string `json:"kind"`
	Spaces struct {
		EffectsEmitter *uuid.UUID `json:"effects_emitter"`
	} `json:"spaces"`
	Effects    struct{} `json:"effects"`
	Attributes struct{} `json:"attributes"`
	SpaceTypes struct {
		Generic *uuid.UUID `json:"generic"`
	} `json:"space_types"`
}

type WorldMeta

type WorldMeta struct {
	ID                     uuid.UUID `json:"id"`
	OwnerID                uuid.UUID `json:"owner_id"`
	Name                   string    `json:"name"`
	FullDomain             string    `json:"full_domain"`
	FullUrl                string    `json:"full_url"`
	FullAbsoluteUrl        string    `json:"full_absolute_url"`
	FullAbsoluteBuilderUrl string    `json:"builder_url"`
}

Notes

Bugs

  • currently only add, we should remove to keep it clean. But then we need to hardcode the localhost ones for development envs.

Jump to

Keyboard shortcuts

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