world

package
v0.0.0-...-02723c8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNK_HEIGHT = 128
View Source
const CHUNK_LENGTH = 16

Variables

View Source
var BlockTypes = []BlockType{
	Stone,
	Grass,
	Dirt,
}
View Source
var BoundingBoxMap = map[EntityType]mgl32.Vec3{
	Player: {0.6, 1.8, 0.6},
}
View Source
var TickLength = (1000 / util.TicksPerSecond) * time.Millisecond

Functions

This section is empty.

Types

type Block

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

func CreateBlock

func CreateBlock(owningChunk *Chunk, position *mgl32.Vec3, blockType BlockType) *Block

func (Block) OwningChunk

func (self Block) OwningChunk() *Chunk

func (Block) Position

func (self Block) Position() *mgl32.Vec3

func (Block) Relative

func (self Block) Relative(face BlockFace) *Block

func (Block) Type

func (self Block) Type() BlockType

type BlockFace

type BlockFace int
const (
	None BlockFace = iota
	Top
	Bottom
	Left
	Right
	Back
	Front
)

func (BlockFace) String

func (i BlockFace) String() string

type BlockType

type BlockType int
const (
	Stone BlockType = iota
	Grass
	Dirt
)

func (BlockType) String

func (i BlockType) String() string

type Chunk

type Chunk struct {
	Blocks *[CHUNK_LENGTH][CHUNK_HEIGHT][CHUNK_LENGTH]*Block
	Dirty  bool
	// contains filtered or unexported fields
}

func CreateChunk

func CreateChunk(world *World, position *mgl32.Vec2) *Chunk

func (*Chunk) AddBlock

func (self *Chunk) AddBlock(block *Block)

func (Chunk) GetPosition

func (self Chunk) GetPosition() *mgl32.Vec2

func (Chunk) GetWorld

func (self Chunk) GetWorld() *World

type Entity

type Entity struct {
	Velocity mgl32.Vec3
	// contains filtered or unexported fields
}

func CreateEntity

func CreateEntity(id uuid.UUID, eType EntityType, world *World, position mgl32.Vec3) *Entity

func (*Entity) AddForce

func (self *Entity) AddForce(accel mgl32.Vec3)

func (*Entity) OnGround

func (self *Entity) OnGround() bool

func (*Entity) Position

func (self *Entity) Position() mgl32.Vec3

func (*Entity) Tick

func (self *Entity) Tick()

func (*Entity) Type

func (self *Entity) Type() EntityType

func (*Entity) UUID

func (self *Entity) UUID() uuid.UUID

func (*Entity) World

func (self *Entity) World() *World

type EntityType

type EntityType int
const (
	Player EntityType = iota
)

type World

type World struct {
	ChunkMap map[mgl32.Vec2]*Chunk
	Entities []*Entity
	// contains filtered or unexported fields
}

func CreateWorld

func CreateWorld(name string, seed uint64) *World

func (*World) AddChunk

func (self *World) AddChunk(chunk *Chunk)

func (*World) AddEntity

func (self *World) AddEntity(entity *Entity)

func (*World) GenerateChunk

func (self *World) GenerateChunk(position mgl32.Vec2)

func (*World) GetBlock

func (self *World) GetBlock(x, y, z int) *Block

func (World) GetName

func (self World) GetName() string

func (*World) Tick

func (self *World) Tick()

type WorldServer

type WorldServer struct {
	Player *Entity
	// contains filtered or unexported fields
}
var ServerInst WorldServer = WorldServer{}

func (*WorldServer) AddWorld

func (self *WorldServer) AddWorld(world *World)

func (WorldServer) GetWorld

func (self WorldServer) GetWorld(name string) *World

func (*WorldServer) GetWorlds

func (self *WorldServer) GetWorlds() *map[string]*World

func (*WorldServer) Init

func (self *WorldServer) Init()

func (*WorldServer) RemoveWorld

func (self *WorldServer) RemoveWorld(world *World)

func (*WorldServer) Tick

func (self *WorldServer) Tick()

Jump to

Keyboard shortcuts

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