verse

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAP_EXPIRE = time.Hour * 24
)

Variables

View Source
var (
	SPACE_ALIAS_REGEX = regexp.MustCompile(`^[a-z0-9-_.:]+$`)
)

Functions

func EditEntity

func EditEntity(entities *[]maps.Entity, edit P.EditEntity)

func IsValidAlias

func IsValidAlias(alias string) bool

func NewEntity

func NewEntity(entities *[]maps.Entity, index int, entity maps.Entity) *maps.Entity

Types

type Edit

type Edit struct {
	Time    time.Time
	Sender  ingress.ClientID
	Message P.Message
}

func NewEdit

func NewEdit(sender ingress.ClientID, message P.Message) *Edit

type EditingState

type EditingState struct {
	Clipboards map[ingress.ClientID]worldio.Editinfo
	Edits      []*Edit
	GameMap    *maps.GameMap
	Map        *Map
	Space      *UserSpace
	OpenEdit   bool
	// contains filtered or unexported fields
}

func NewEditingState

func NewEditingState(verse *Verse, space *UserSpace, map_ *Map) *EditingState

func (*EditingState) Apply

func (e *EditingState) Apply(edits []*Edit) error

func (*EditingState) Checkpoint

func (e *EditingState) Checkpoint(ctx context.Context) error

Apply all of the edits to the map.

func (*EditingState) ClearClipboard

func (e *EditingState) ClearClipboard(sender ingress.ClientID)

func (*EditingState) Destroy

func (e *EditingState) Destroy()

func (*EditingState) IsOpenEdit

func (e *EditingState) IsOpenEdit() bool

func (*EditingState) LoadMap

func (e *EditingState) LoadMap(map_ *maps.GameMap) error

func (*EditingState) Process

func (e *EditingState) Process(sender ingress.ClientID, message P.Message)

func (*EditingState) SavePeriodically

func (e *EditingState) SavePeriodically(ctx context.Context)

func (*EditingState) SetOpenEdit

func (e *EditingState) SetOpenEdit(val bool)
type Link struct {
	Teleport    uint8
	Teledest    uint8
	Destination string
}

type Map

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

func (*Map) GetID

func (m *Map) GetID() string

func (*Map) GetMap

func (m *Map) GetMap(ctx context.Context) (*state.MapPointer, *state.Map, error)

func (*Map) GetPointer

func (m *Map) GetPointer(ctx context.Context) (*state.MapPointer, error)

func (*Map) LoadGameMap

func (m *Map) LoadGameMap(ctx context.Context) (*maps.GameMap, error)

func (*Map) LoadMapData

func (m *Map) LoadMapData(ctx context.Context) ([]byte, error)

func (*Map) SaveGameMap

func (m *Map) SaveGameMap(ctx context.Context, creator *state.User, gameMap *maps.GameMap) (*state.Map, error)

type SpaceConfig

type SpaceConfig struct {
	Alias       string
	Map         string
	Description string
	Links       []Link
}

type SpaceInstance

type SpaceInstance struct {
	utils.Session

	SpaceConfig

	Space       *UserSpace
	PresetSpace *config.PresetSpace
	Editing     *EditingState
	Server      *gameServers.GameServer
	// contains filtered or unexported fields
}

func (*SpaceInstance) GetAlias

func (s *SpaceInstance) GetAlias(ctx context.Context) (string, error)

func (*SpaceInstance) GetDescription

func (s *SpaceInstance) GetDescription(ctx context.Context) (string, error)

func (*SpaceInstance) GetID

func (s *SpaceInstance) GetID() string
func (s *SpaceInstance) GetLinks(ctx context.Context) ([]Link, error)

func (*SpaceInstance) GetMap

func (s *SpaceInstance) GetMap(ctx context.Context) (string, error)

func (*SpaceInstance) GetServerInfo

func (s *SpaceInstance) GetServerInfo(ctx context.Context) (string, error)

Combine the description and alias (or ID) to make the servinfo string.

func (*SpaceInstance) IsOpenEdit

func (s *SpaceInstance) IsOpenEdit() bool

func (*SpaceInstance) PollEdits

func (s *SpaceInstance) PollEdits(ctx context.Context)

type SpaceManager

type SpaceManager struct {
	utils.Session
	// contains filtered or unexported fields
}

func NewSpaceManager

func NewSpaceManager(servers *gameServers.ServerManager, maps *assets.AssetFetcher) *SpaceManager

func (*SpaceManager) DoExploreMode

func (s *SpaceManager) DoExploreMode(ctx context.Context, gameServer *gameServers.GameServer, skipRoot string)

func (*SpaceManager) FindInstance

func (s *SpaceManager) FindInstance(server *gameServers.GameServer) *SpaceInstance

func (*SpaceManager) Logger

func (s *SpaceManager) Logger() zerolog.Logger

func (*SpaceManager) SearchSpace

func (s *SpaceManager) SearchSpace(ctx context.Context, id string) (*UserSpace, error)

func (*SpaceManager) StartPresetSpace

func (s *SpaceManager) StartPresetSpace(ctx context.Context, presetSpace config.PresetSpace) (*SpaceInstance, error)

func (*SpaceManager) StartSpace

func (s *SpaceManager) StartSpace(ctx context.Context, id string) (*SpaceInstance, error)

func (*SpaceManager) WatchInstance

func (s *SpaceManager) WatchInstance(ctx context.Context, space *SpaceInstance)

type UserSpace

type UserSpace struct {
	*state.Space
	// contains filtered or unexported fields
}

func (*UserSpace) GetConfig

func (s *UserSpace) GetConfig(ctx context.Context) (*SpaceConfig, error)

func (*UserSpace) GetID

func (u *UserSpace) GetID() string

func (*UserSpace) GetMap

func (s *UserSpace) GetMap(ctx context.Context) (*Map, error)

func (*UserSpace) GetSpace

func (s *UserSpace) GetSpace(ctx context.Context) (*state.Space, error)

func (*UserSpace) Reference

func (u *UserSpace) Reference() string

func (*UserSpace) SetAlias

func (s *UserSpace) SetAlias(ctx context.Context, alias string) error

func (*UserSpace) SetDescription

func (s *UserSpace) SetDescription(ctx context.Context, description string) error

type Verse

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

func NewVerse

func NewVerse() *Verse

func (*Verse) FindMap

func (v *Verse) FindMap(ctx context.Context, needle string) (*Map, error)

Find a map by a prefix

func (*Verse) FindSpace

func (v *Verse) FindSpace(ctx context.Context, needle string) (*UserSpace, error)

Find a space by a prefix

func (*Verse) GetMap

func (v *Verse) GetMap(ctx context.Context, id string) (*Map, error)

func (*Verse) GetSpace

func (v *Verse) GetSpace(ctx context.Context, id string) (*UserSpace, error)

func (*Verse) HaveMap

func (v *Verse) HaveMap(ctx context.Context, id string) (bool, error)

func (*Verse) HaveSpace

func (v *Verse) HaveSpace(ctx context.Context, id string) (bool, error)

func (*Verse) NewMap

func (v *Verse) NewMap(ctx context.Context, creator *state.User) (*Map, error)

func (*Verse) NewSpace

func (v *Verse) NewSpace(ctx context.Context, creator *state.User) (*UserSpace, error)

func (*Verse) NewSpaceID

func (v *Verse) NewSpaceID(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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