Documentation
¶
Index ¶
- Variables
- func IsAIClass(s string) bool
- func IsClass(s string) bool
- type AIClass
- type Client
- func (client *Client) AddWhitelistID(playerID ...string) error
- func (client *Client) Announce(message string) error
- func (client *Client) Auth(password string) error
- func (client *Client) Close() error
- func (client *Client) DisableAIClasses(classes []AIClass) error
- func (client *Client) ExecCommand(command byte, params ...string) (string, error)
- func (client *Client) GetPlayerData() ([]Player, error)
- func (client *Client) GetPlayerList() ([]Player, error)
- func (client *Client) GetServerDetails() (*ServerDetails, error)
- func (client *Client) KickPlayer(playerID, reason string) error
- func (client *Client) RemoveWhitelistID(playerID ...string) error
- func (client *Client) Save() error
- func (client *Client) SendDirectMessage(playerID, message string) error
- func (client *Client) SetAIDensity(density float32) error
- func (client *Client) ToggleAI() (bool, error)
- func (client *Client) ToggleGlobalChat() (bool, error)
- func (client *Client) ToggleHumans() (bool, error)
- func (client *Client) ToggleWhitelist() (bool, error)
- func (client *Client) UpdatePlayables(classes []DinoClass) error
- func (client *Client) WipeCorpses() error
- type DinoClass
- type Location
- type MessageType
- type Player
- type Response
- type ServerDetails
Constants ¶
This section is empty.
Variables ¶
var AllAIClasses = [6]AIClass{Boar, Compsognathus, Deer, Goat, Pterodactylus, Seaturtle}
var AllClasses = [17]DinoClass{Beipiaosaurus, Carnotaurus, Ceratosaurus, Deinosuchus, Diabloceratops, Dilophosaurus, Dryosaurus, Gallimimus, Herrerasaurus, Hypsilophodon, Maiasaura, Omniraptor, Pachycephalosaurus, Pteranodon, Stegosaurus, Tenontosaurus, Troodon}
var ErrIncorrectPassword = errors.New("incorrect password")
var ErrMalformedResponse = errors.New("malformed response")
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The Client type contains methods for all RCON commands.
func (*Client) AddWhitelistID ¶
AddWhitelistID adds one or more PlayerIDs to the whitelist.
func (*Client) Announce ¶
Announce sends a message to all currently connected players.
The message will be displayed in a large text box at the top of the screen.
func (*Client) Auth ¶
Auth tries to authenticate with the gameserver.
If the reason for failure is an incorrect password, the function will return ErrIncorrectPassword.
func (*Client) DisableAIClasses ¶
DisableAIClasses defines the list of AI classes that cannot spawn.
func (*Client) ExecCommand ¶
ExecCommand formats a command and sends it to the server.
The client should have a corresponding method for every supported command. However, there may be undocumented features in the RCON protocol or this library may become out-of-date. In those cases, you can use ExecCommand directly to send commands that the client does not support (yet).
While command can be any byte, you should normally use one of the MessageType constants.
This function returns the server's response as a string.
func (*Client) GetPlayerData ¶
GetPlayerData returns a list of all players that have spawned in.
In contrast to Client.GetPlayerList, this function returns complete Player structs and not just IDs and names. However, it excludes players that are still in the class selection screen.
func (*Client) GetPlayerList ¶
GetPlayerList returns a list of all connected players.
The list contains both players that are playing and players that are connected, but not playing (i.e. players that are in the class selection screen). However, the list only contains IDs and names.
func (*Client) GetServerDetails ¶
func (client *Client) GetServerDetails() (*ServerDetails, error)
GetServerDetails returns some information about the server.
func (*Client) KickPlayer ¶
KickPlayer kicks the player from the server.
func (*Client) RemoveWhitelistID ¶
RemoveWhitelistID removes one or more PlayerIDs from the whitelist.
func (*Client) SendDirectMessage ¶
SendDirectMessage sends an announcement message to one specific user.
The message will be shown in the same way as a regular announcement.
func (*Client) SetAIDensity ¶
SetAIDensity sets the AI density that can also be defined in Game.ini.
func (*Client) ToggleGlobalChat ¶
ToggleGlobalState turns on or off the global chat feature on the server.
If you need to know whether global chat is already enabled, use Client.GetServerDetails.
func (*Client) ToggleHumans ¶
ToggleHumans turns on or off the humans feature in the game.
func (*Client) ToggleWhitelist ¶
ToggleWhitelist turns the whielist on or off and returns true, if the new state is on.
func (*Client) UpdatePlayables ¶
UpdatePlayables defines the list of playable classes.
func (*Client) WipeCorpses ¶
WipeCorpses removes all dead entities from the map.
type DinoClass ¶ added in v1.1.0
type DinoClass string
Classes are the different types of dinosaurs that players can choose to play.
const ( Beipiaosaurus DinoClass = "Beipiaosaurus" Carnotaurus DinoClass = "Carnotaurus" Ceratosaurus DinoClass = "Ceratosaurus" Deinosuchus DinoClass = "Deinosuchus" Diabloceratops DinoClass = "Diabloceratops" Dilophosaurus DinoClass = "Dilophosaurus" Dryosaurus DinoClass = "Dryosaurus" Gallimimus DinoClass = "Gallimimus" Herrerasaurus DinoClass = "Herrerasaurus" Hypsilophodon DinoClass = "Hypsilophodon" Maiasaura DinoClass = "Maiasaura" Omniraptor DinoClass = "Omniraptor" Pachycephalosaurus DinoClass = "Pachycephalosaurus" Pteranodon DinoClass = "Pteranodon" Stegosaurus DinoClass = "Stegosaurus" Tenontosaurus DinoClass = "Tenontosaurus" Troodon DinoClass = "Troodon" )
type MessageType ¶
type MessageType = byte
const ( Auth MessageType = 0x01 ExecCommand MessageType = 0x02 ResponseValue MessageType = 0x03 Announce MessageType = 0x10 DirectMessage MessageType = 0x11 GetServerDetails MessageType = 0x12 WipeCorpses MessageType = 0x13 UpdatePlayables MessageType = 0x15 BanPlayer MessageType = 0x20 KickPlayer MessageType = 0x30 GetPlayerList MessageType = 0x40 Save MessageType = 0x50 GetPlayerData MessageType = 0x77 ToggleWhitelist MessageType = 0x81 AddWhitelistID MessageType = 0x82 RemoveWhitelistID MessageType = 0x83 ToggleGlobalChat MessageType = 0x84 ToggleHumans MessageType = 0x86 ToggleAI MessageType = 0x90 DisableAIClasses MessageType = 0x91 SetAIDensity MessageType = 0x92 )
type Player ¶
type Player struct {
ID string // Steam or EOS ID
Name string
Location Location
DinoClass DinoClass
Growth int8 // Growth as percentage. 75% means fully grown in the current game version.
Health int8 // Health as percentage
Stamina int8 // Stamina as percentage
Hunger int8 // Hunger as percentage
Thirst int8 // Thirst as percentage
}
type ServerDetails ¶
type ServerDetails struct {
Name string
Password string
Map string
MaxPlayers int
CurrentPlayers int
EnableMutations bool
EnableHumans bool
HasPassword bool
QueueEnabled bool
Whitelist bool
SpawnAI bool
AllowRecordingGameplay bool
UseRegionSpawning bool
UseRegionSpawnCooldown bool
RegionSpawnCooldownTimeSeconds int
DayLengthMinutes int
NightLengthMinutes int
EnableGlobalChat bool
}