Documentation
¶
Index ¶
- Constants
- type Server
- func (s *Server) Addr() string
- func (s *Server) Close() error
- func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*roveapi.CommandResponse, error)
- func (s *Server) Initialise(fillWorld bool) (err error)
- func (s *Server) LoadWorld() error
- func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi.RadarResponse, error)
- func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*roveapi.RegisterResponse, error)
- func (s *Server) Run()
- func (s *Server) SaveWorld() error
- func (s *Server) ServerStatus(context.Context, *roveapi.ServerStatusRequest) (*roveapi.ServerStatusResponse, error)
- func (s *Server) SpawnRoverForAccount(account string) (string, error)
- func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (response *roveapi.StatusResponse, err error)
- func (s *Server) Stop() error
- func (s *Server) StopAndClose() error
- type ServerOption
Constants ¶
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 (*Server) Command ¶ added in v0.27.0
func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*roveapi.CommandResponse, error)
Command issues commands to the world based on a gRPC request
func (*Server) Initialise ¶
Initialise sets up internal state ready to serve
func (*Server) Radar ¶
func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi.RadarResponse, error)
Radar returns the radar information for a rover
func (*Server) Register ¶
func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*roveapi.RegisterResponse, error)
Register registers a new account for a gRPC request
func (*Server) ServerStatus ¶ added in v0.25.0
func (s *Server) ServerStatus(context.Context, *roveapi.ServerStatusRequest) (*roveapi.ServerStatusResponse, error)
ServerStatus returns the status of the current server to a gRPC request
func (*Server) SpawnRoverForAccount ¶
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) StopAndClose ¶
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