game

package
v0.0.0-...-205331c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Log *slog.Logger

	MapName string

	Impl            igame.Impl
	ParticipantImpl igame.IParticipant
}

func (Config) New

func (c Config) New() (*Game, error)

type Game

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

func (*Game) CurrentTick

func (g *Game) CurrentTick() uint64

func (*Game) End

func (g *Game) End()

func (*Game) HandleAttackEntity

func (g *Game) HandleAttackEntity(ctx *player.Context, e world.Entity, force *float64, height *float64, critical *bool)

func (*Game) HandleBlockBreak

func (g *Game) HandleBlockBreak(ctx *player.Context, pos cube.Pos, drops *[]item.Stack, xp *int)

func (*Game) HandleBlockPlace

func (g *Game) HandleBlockPlace(ctx *player.Context, pos cube.Pos, b world.Block)

func (*Game) HandleDrop

func (g *Game) HandleDrop(ctx *inventory.Context, slot int, stack item.Stack)

func (*Game) HandleFoodLoss

func (g *Game) HandleFoodLoss(ctx *player.Context, from int, to *int)

func (*Game) HandleHeal

func (g *Game) HandleHeal(ctx *player.Context, health *float64, src world.HealingSource)

func (*Game) HandleHurt

func (g *Game) HandleHurt(ctx *player.Context, damage *float64, immune bool, immunity *time.Duration, src world.DamageSource)

func (*Game) HandleItemPickup

func (g *Game) HandleItemPickup(ctx *player.Context, i *item.Stack)

func (*Game) HandleItemUse

func (g *Game) HandleItemUse(ctx *player.Context)

func (*Game) HandleItemUseOnEntity

func (g *Game) HandleItemUseOnEntity(ctx *player.Context, e world.Entity)

func (*Game) HandleMove

func (g *Game) HandleMove(ctx *player.Context, pos mgl64.Vec3, rot cube.Rotation)

func (*Game) HandlePlace

func (g *Game) HandlePlace(ctx *inventory.Context, slot int, stack item.Stack)

func (*Game) HandleTake

func (g *Game) HandleTake(ctx *inventory.Context, slot int, stack item.Stack)

func (*Game) ID

func (g *Game) ID() string

func (*Game) IsBlockPlaced

func (g *Game) IsBlockPlaced(pos cube.Pos) bool

func (*Game) IsEnding

func (g *Game) IsEnding() bool

func (*Game) IsPlaying

func (g *Game) IsPlaying() bool

func (*Game) IsWaiting

func (g *Game) IsWaiting() bool

func (*Game) Join

func (g *Game) Join(p *player.Player) error

func (*Game) Load

func (g *Game) Load() error

func (*Game) Messaget

func (g *Game) Messaget(translationName string, args ...any)

func (*Game) OnTick

func (g *Game) OnTick()

func (*Game) ParticipantByXUID

func (g *Game) ParticipantByXUID(xuid string) (igame.IParticipant, bool)

func (*Game) Participants

func (g *Game) Participants() map[string]igame.IParticipant

func (*Game) Players

func (g *Game) Players(tx *world.Tx) []*player.Player

func (*Game) PlayingParticipants

func (g *Game) PlayingParticipants() map[string]igame.IParticipant

func (*Game) Quit

func (g *Game) Quit(p *player.Player) error

func (*Game) RemovePlacedBlock

func (g *Game) RemovePlacedBlock(pos cube.Pos)

func (*Game) SetCloseHook

func (g *Game) SetCloseHook(hook func())

func (*Game) SetDuelRequestMode

func (g *Game) SetDuelRequestMode(b bool)

func (*Game) SetPlayAgainHook

func (g *Game) SetPlayAgainHook(hook func(p *player.Player) error)

func (*Game) SetSpectator

func (g *Game) SetSpectator(p *player.Player)

func (*Game) Sound

func (g *Game) Sound(name string)

func (*Game) SpectatingParticipants

func (g *Game) SpectatingParticipants() map[string]igame.IParticipant

func (*Game) Start

func (g *Game) Start()

func (*Game) State

func (g *Game) State() State

func (*Game) Stop

func (g *Game) Stop()

func (*Game) StorePlacedBlock

func (g *Game) StorePlacedBlock(pos cube.Pos)

func (*Game) World

func (g *Game) World() *world.World

type Participant

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

func (*Participant) IsPlaying

func (p *Participant) IsPlaying() bool

func (*Participant) IsSpectating

func (p *Participant) IsSpectating() bool

func (*Participant) PearlCooldown

func (p *Participant) PearlCooldown() time.Time

func (*Participant) SetPearlCooldown

func (p *Participant) SetPearlCooldown(d time.Time)

func (*Participant) User

func (p *Participant) User() igame.User

func (*Participant) XUID

func (p *Participant) XUID() string

type ParticipantState

type ParticipantState int
const (
	ParticipantStatePlaying ParticipantState = iota
	ParticipantStateSpectating
)

type State

type State int
const (
	StateWaiting State = iota
	StatePlaying
	StateEnding
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳