internal

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PersistentData will allow the server to load and save it's state
	PersistentData = iota

	// EphemeralData will let the server neither load or save out any of it's data
	EphemeralData
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server contains the relevant data to run a game server

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer sets up a new server

func (*Server) Addr

func (s *Server) Addr() string

Addr will return the server address set after the listen

func (*Server) Close

func (s *Server) Close() error

Close waits until the server is finished and closes up shop

func (*Server) Command added in v0.27.0

Command issues commands to the world based on a gRPC request

func (*Server) Initialise

func (s *Server) Initialise(fillWorld bool) (err error)

Initialise sets up internal state ready to serve

func (*Server) LoadWorld

func (s *Server) LoadWorld() error

LoadWorld will load all persistent data

func (*Server) Radar

Radar returns the radar information for a rover

func (*Server) Register

Register registers a new account for a gRPC request

func (*Server) Run

func (s *Server) Run()

Run executes the server

func (*Server) SaveWorld

func (s *Server) SaveWorld() error

SaveWorld will save out the world file

func (*Server) ServerStatus added in v0.25.0

ServerStatus returns the status of the current server to a gRPC request

func (*Server) SpawnRoverForAccount

func (s *Server) SpawnRoverForAccount(account string) (string, error)

SpawnRoverForAccount spawns the rover rover for an account

func (*Server) Status

func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (response *roveapi.StatusResponse, err error)

Status returns rover information for a gRPC request

func (*Server) Stop

func (s *Server) Stop() error

Stop will stop the current server

func (*Server) StopAndClose

func (s *Server) StopAndClose() error

StopAndClose waits until the server is finished and closes up shop

type ServerOption

type ServerOption func(s *Server)

ServerOption defines a server creation option

func OptionAddress

func OptionAddress(address string) ServerOption

OptionAddress sets the server address for hosting

func OptionPersistentData

func OptionPersistentData() ServerOption

OptionPersistentData sets the server data to be persistent

func OptionTick

func OptionTick(minutes int) ServerOption

OptionTick defines the number of minutes per tick 0 means no automatic server tick

Jump to

Keyboard shortcuts

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