world

package
v0.0.0-...-fe76f8b Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHUNK              = 16
	SECTION_SIZE       = CHUNK * 15
	SECTION_Z_SIZE     = 48
	OLD_SECTION_Z_SIZE = 24
	VERSION            = 6
	EDITOR_MODE        = 0
	RUNNER_MODE        = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader struct {
	X, Y int

	ReadOnly bool
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(observer WorldObserver, userDir, gameDir string) *Loader

func (*Loader) AddExtra

func (loader *Loader) AddExtra(x, y, z int, shapeIndex int) bool

func (*Loader) ClearEdge

func (loader *Loader) ClearEdge(x, y int)

func (*Loader) EraseAllExtras

func (loader *Loader) EraseAllExtras(x, y, z int) bool

func (*Loader) EraseExtra

func (loader *Loader) EraseExtra(x, y, z, shapeIndex int) bool

func (*Loader) EraseShape

func (loader *Loader) EraseShape(x, y, z int) bool

func (*Loader) GetEdge

func (loader *Loader) GetEdge(x, y int) (int, bool)

func (*Loader) GetExtra

func (loader *Loader) GetExtra(worldX, worldY, worldZ, i int) (int, bool)

func (*Loader) GetExtras

func (loader *Loader) GetExtras(worldX, worldY, worldZ int) []int

func (*Loader) GetPos

func (loader *Loader) GetPos(worldX, worldY, worldZ int) *SectionPosition

func (*Loader) GetSectionPos

func (loader *Loader) GetSectionPos() (int, int)

func (*Loader) GetShape

func (loader *Loader) GetShape(worldX, worldY, worldZ int) (int, bool)

func (*Loader) IsEditorMode

func (loader *Loader) IsEditorMode() bool

func (*Loader) MoveTo

func (loader *Loader) MoveTo(x, y int) bool

func (*Loader) SaveAll

func (loader *Loader) SaveAll() error

func (*Loader) SetEdge

func (loader *Loader) SetEdge(x, y int, shapeIndex int)

func (*Loader) SetIoMode

func (loader *Loader) SetIoMode(mode int)

func (*Loader) SetShape

func (loader *Loader) SetShape(x, y, z int, shapeIndex int) bool

type Section

type Section struct {
	X, Y int
	Pos  [SECTION_SIZE][SECTION_SIZE][SECTION_Z_SIZE]SectionPosition
	// contains filtered or unexported fields
}

type SectionCache

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

func NewSectionCache

func NewSectionCache() *SectionCache

type SectionPosition

type SectionPosition struct {
	Block int
	Edge  int
	// extra non blocking shapes: plants, items, etc.
	Extras []int
	Under  int
}

func (*SectionPosition) Clone

func (p *SectionPosition) Clone() *SectionPosition

type WorldObserver

type WorldObserver interface {
	SectionLoad(x, y int, data map[string]interface{})
	SectionSave(x, y int) map[string]interface{}
	Loading(working bool)
}

Jump to

Keyboard shortcuts

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