session

package
v0.0.0-...-0e8e2b8 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGadget

func AddGadget(inv *inventory.Inventory)

Types

type Data

type Data struct {
	Markers map[string]Marker `json:"markers"`
}

func NewData

func NewData() *Data

type Gadget

type Gadget struct{}

func (Gadget) Category

func (Gadget) Category() category.Category

func (Gadget) Cooldown

func (Gadget) Cooldown() time.Duration

func (Gadget) EncodeItem

func (Gadget) EncodeItem() (name string, meta int16)

func (Gadget) Name

func (Gadget) Name() string

func (Gadget) Texture

func (Gadget) Texture() image.Image

func (Gadget) Use

func (s Gadget) Use(_ *world.World, user item.User, _ *item.UseContext) bool

type GameMode

type GameMode struct{}

func (GameMode) AllowsEditing

func (GameMode) AllowsEditing() bool

func (GameMode) AllowsFlying

func (GameMode) AllowsFlying() bool

func (GameMode) AllowsInteraction

func (GameMode) AllowsInteraction() bool

func (GameMode) AllowsTakingDamage

func (GameMode) AllowsTakingDamage() bool

func (GameMode) CreativeInventory

func (GameMode) CreativeInventory() bool

func (GameMode) HasCollision

func (GameMode) HasCollision() bool

func (GameMode) Visible

func (GameMode) Visible() bool

type InvHandler

type InvHandler struct {
	inventory.NopHandler
	// contains filtered or unexported fields
}

func (InvHandler) HandleDrop

func (i InvHandler) HandleDrop(ctx *event.Context, _ int, stk item.Stack)

func (InvHandler) HandleTake

func (i InvHandler) HandleTake(ctx *event.Context, _ int, stk item.Stack)

type Marker

type Marker struct {
	Room cube.Pos `json:"room"`
	Hex  string   `json:"hex"`
	Desc string   `json:"desc"`
}

func (Marker) Format

func (m Marker) Format() string

type Provider

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

func NewProvider

func NewProvider(path string) (*Provider, error)

func (*Provider) Close

func (p *Provider) Close() error

func (*Provider) Load

func (p *Provider) Load(id uuid.UUID) (Data, error)

func (*Provider) Save

func (p *Provider) Save(id uuid.UUID, d Data) error

type Session

type Session struct {
	player.NopHandler
	// contains filtered or unexported fields
}

func Get

func Get(p *player.Player) *Session

func Init

func Init(p *player.Player, s *server.Server, quit func(session *Session)) *Session

func (*Session) Addr

func (s *Session) Addr() net.Addr

func (*Session) Data

func (s *Session) Data() *Data

func (*Session) HandleFoodLoss

func (s *Session) HandleFoodLoss(ctx *event.Context, _ int, _ *int)

func (*Session) HandleItemDrop

func (s *Session) HandleItemDrop(ctx *event.Context, _ *entity.Item)

func (*Session) HandleItemPickup

func (s *Session) HandleItemPickup(ctx *event.Context, _ item.Stack)

func (*Session) HandleItemUseOnBlock

func (s *Session) HandleItemUseOnBlock(ctx *event.Context, pos cube.Pos, _ cube.Face, _ mgl64.Vec3)

func (*Session) HandleMove

func (s *Session) HandleMove(ctx *event.Context, newPos mgl64.Vec3, _ float64, _ float64)

func (*Session) HandleQuit

func (s *Session) HandleQuit()

func (*Session) Hex

func (s *Session) Hex() string

func (*Session) Inventory

func (s *Session) Inventory() *inventory.Inventory

func (*Session) Local

func (s *Session) Local() bool

func (*Session) Marker

func (s *Session) Marker(name string) Marker

func (*Session) Markers

func (s *Session) Markers() map[string]Marker

func (*Session) Message

func (s *Session) Message(a ...any)

func (*Session) Messagef

func (s *Session) Messagef(f string, a ...any)

func (*Session) Player

func (s *Session) Player() *player.Player

func (*Session) RemMarker

func (s *Session) RemMarker(name string)

func (*Session) RemoveScoreboard

func (s *Session) RemoveScoreboard()

func (*Session) Room

func (s *Session) Room() cube.Pos

func (*Session) SendForm

func (s *Session) SendForm(f form.Form)

func (*Session) SendFormF

func (s *Session) SendFormF(f func(ses *Session) form.Form)

func (*Session) SendScoreboard

func (s *Session) SendScoreboard(scb *scoreboard.Scoreboard)

func (*Session) Server

func (s *Session) Server() *server.Server

func (*Session) SetData

func (s *Session) SetData(dat *Data)

func (*Session) SetHex

func (s *Session) SetHex(new string)

func (*Session) SetMarker

func (s *Session) SetMarker(name string, mar Marker)

func (*Session) SetRoom

func (s *Session) SetRoom(new cube.Pos)

func (*Session) Teleport

func (s *Session) Teleport(pos mgl64.Vec3)

func (*Session) TeleportRoom

func (s *Session) TeleportRoom(pos cube.Pos)

func (*Session) UUID

func (s *Session) UUID() uuid.UUID

func (*Session) World

func (s *Session) World() *world.World

Jump to

Keyboard shortcuts

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