Skip to content

Go: Server, ticks and system information

Functions

CurrentTick

Go
func CurrentTick() (uint64, error)

CurrentTick is the server's tick counter.

TickDeltaTime

Go
func TickDeltaTime() (float64, error)

TickDeltaTime is the length of the last tick, in seconds.

PlayerCount

Go
func PlayerCount() (int32, error)

PlayerCount is how many players are online.

SimPaused

Go
func SimPaused() (bool, error)

SimPaused reports whether the simulation is paused.

Tps

Go
func Tps(windowSeconds int32) (float64, error)

Tps is the ticks per second over the last windowSeconds. A negative answer, which the host gives before it has measured anything, is an error and not a rate.

  • Parameters:
    • windowSeconds : int32
  • Return type: (float64, error)
  • Slots: get_tps

Mspt

Go
func Mspt(windowSeconds int32) (float64, error)

Mspt is the milliseconds per tick over the last windowSeconds, with Tps's rule.

  • Parameters:
    • windowSeconds : int32
  • Return type: (float64, error)
  • Slots: get_mspt

Env

Go
func Env(name string) (string, error)

Env reads an environment variable of the server process.

  • Parameters:
    • name : string
  • Return type: (string, error)
  • Slots: sys_get_env

SetEnv

Go
func SetEnv(name, value string) error

SetEnv sets an environment variable of the server process.

  • Parameters:
    • name : string
    • value : string
  • Return type: error
  • Slots: sys_set_env

ServerBdsVersion

Go
func ServerBdsVersion() (string, error)

ServerBdsVersion reads PIER_SRV_BDS_VERSION: Common::getGameVersionString

ServerProtocolVersion

Go
func ServerProtocolVersion() (string, error)

ServerProtocolVersion reads PIER_SRV_PROTOCOL_VERSION: LevelData::mNetworkVersion: the protocol the level was last written by. Says how old the save is, not what the server speaks.

ServerLevelProtocolVersion

Go
func ServerLevelProtocolVersion() (string, error)

ServerLevelProtocolVersion reads PIER_SRV_LEVEL_PROTOCOL_VERSION: "major.minor.patch" of the running build, from CurrentGameSemVersion. Lets a mod carry its own version→protocol table instead of waiting for a Pier release.

ServerGameSemVersion

Go
func ServerGameSemVersion() (string, error)

ServerGameSemVersion reads PIER_SRV_GAME_SEM_VERSION: PIER_SRV_GAME_SEM_VERSION

SystemOsName

Go
func SystemOsName() (string, error)

SystemOsName reads PIER_SYS_OS_NAME: sys_utils::getSystemName

SystemOsVersion

Go
func SystemOsVersion() (string, error)

SystemOsVersion reads PIER_SYS_OS_VERSION: sys_utils::getSystemVersion → string

SystemLocale

Go
func SystemLocale() (string, error)

SystemLocale reads PIER_SYS_LOCALE: sys_utils::getSystemLocaleCode

SystemLocalTime

Go
func SystemLocalTime() (string, error)

SystemLocalTime reads PIER_SYS_LOCAL_TIME: sys_utils::getLocalTime → SNBT {year,month,day,hour,minute,second,ms}

Srv*

Name Value Description
SrvBdsVersion 0 SrvBdsVersion is PIER_SRV_BDS_VERSION: Common::getGameVersionString
SrvProtocolVersion 1 SrvProtocolVersion is PIER_SRV_PROTOCOL_VERSION: LevelData::mNetworkVersion: the protocol the level was last written by. Says how old the save is, not what the server speaks.
SrvLevelProtocolVersion 2 SrvLevelProtocolVersion is PIER_SRV_LEVEL_PROTOCOL_VERSION: "major.minor.patch" of the running build, from CurrentGameSemVersion. Lets a mod carry its own version→protocol table instead of waiting for a Pier release.
SrvGameSemVersion 3 SrvGameSemVersion is PIER_SRV_GAME_SEM_VERSION: PIER_SRV_GAME_SEM_VERSION

Sys*

Name Value Description
SysOsName 0 SysOsName is PIER_SYS_OS_NAME: sys_utils::getSystemName
SysOsVersion 1 SysOsVersion is PIER_SYS_OS_VERSION: sys_utils::getSystemVersion → string
SysLocale 2 SysLocale is PIER_SYS_LOCALE: sys_utils::getSystemLocaleCode
SysLocalTime 3 SysLocalTime is PIER_SYS_LOCAL_TIME: sys_utils::getLocalTime → SNBT