status

package
v0.0.0-...-f88b513 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package status contains logic reguarding the current Executor state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadOnlyStatus

type ReadOnlyStatus interface {
	PB() *gdpb.ServerStatus
	TickDuration() time.Duration
	Tick() id.Tick
	IsStarted() bool
	IsStopped() bool
	StartTime() time.Time
}

type Status

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

Status represents the internal Executor state.

func New

func New(tickDuration time.Duration) *Status

New returns a new Status instance.

func (*Status) IncrementTick

func (s *Status) IncrementTick()

IncrementTick adds one to the current game tick -- this is called at the beginning of each tick loop.

func (*Status) IsStarted

func (s *Status) IsStarted() bool

IsStarted returns if the Executor is currently executing ticks.

func (*Status) IsStopped

func (s *Status) IsStopped() bool

IsStopped returns if the Executor has finished running the game loop.

func (*Status) PB

func (s *Status) PB() *gdpb.ServerStatus

PB exports the Status instance into an associated protobuf.

func (*Status) SetIsStarted

func (s *Status) SetIsStarted() error

SetIsStarted sets the internal Executor status as running the core loop.

func (*Status) SetIsStopped

func (s *Status) SetIsStopped() error

SetIsStopped sets the internal Executor status as having finished the core loop. This may be called because the game ended, or if it crashed.

func (*Status) SetStartTime

func (s *Status) SetStartTime()

SetStartTime sets the time at which the server initially started running the core loop.

func (*Status) StartTime

func (s *Status) StartTime() time.Time

StartTime returns the wall-clock time at which the server started executing the core loop.

func (*Status) Tick

func (s *Status) Tick() id.Tick

Tick returns the current game tick.

func (*Status) TickDuration

func (s *Status) TickDuration() time.Duration

Jump to

Keyboard shortcuts

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