Skip to main content

GameCommandModule

A static class in Root.Township, Alta.Console.Commands.

Console module game (alias g) for finding, joining, starting and stopping servers from the client. Needs a logged in user, in play, and isn't allowed from the remote console.

Fields​

2 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this module. Command output goes here.
private static List<GameServerInfo> recentlyShownServersThe last listed servers, which the index arguments of other commands refer to.

Methods​

MemberWhat it is
static GameServerInfo GetServerInfo(int serverIdentifier)The server at that index in the last shown list, or the local server info if the index is out of range.
23 private and internal methods
MemberWhat it is
private static async Task ConnectToPlayer(UserInfoAccess player, PlayerMode playerMode = 0)Command game connect-player (alias cp): joins the first server the given player is on.
private static async Task ConnectToServer(int serverIdentifier, PlayerMode playerMode = 0)Command game connect (alias c): joins a server by its real API id.
private static async Task CreateServerAsync(string serverName, int sceneIndex, string region)Command game create-server (alias create): server owner only. Asks the API to create a server with a name, scene index and region.
private static void DeleteSave(int serverIdentifier)Command game delete-save: server owner only. Deletes the save of a server from the recent list.
private static void DisplayServers(string header)Logs the recent list with index, name, scene type (Tutorial, Test or Town) and player count.
private static async Task FindServerByName(string name)Command game find (alias f): lists servers whose name matches.
private static async Task JoinServerAsync(int serverIdentifier, PlayerMode playerMode = 0)Command game join-server (aliases join, j): joins the server at that index in the last shown list.
private static async Task JoinServerAtIpAsync(string serverIp, int sceneIndex = 0, PlayerMode playerMode = 0, int port = 1757)Command game join-ip (alias ip): joins a dev server at an IPv4 address, scene and port (default 1757).
private static async Task JoinServerAtLocalIpAsync(int sceneIndex = 0, PlayerMode playerMode = 0, int port = 1757)Command game ip-local (alias iplocal): joins a dev server on the local IP.
private static void SetRecentlyShownServers(IEnumerable<GameServerInfo> onlineServers)Replaces the recent list, dropping servers whose target doesn't match this build's feature set.
private static async Task ShowAllOnlineServers()Command game show-all (alias all): lists all online servers.
private static async void ShowDiscover()Command game show-discover (alias discover): lists servers from discovery.
private static async Task ShowOnlineServers()Command game show-online (aliases online, joined): lists servers you have joined, sorted by name.
private static async Task ShowOpenServers()Command game show-open (alias open): lists open servers.
private static async Task ShowOwnedServers()Command game show-owned (alias owned): needs debug_features. Lists servers you can control.
private static async Task ShowPublicServers()Command game show-public (alias public): lists public servers.
private static void ShowServers()Command game list-recent (alias list): shows the last listed servers again.
private static async Task StartLocalServerAsync(int sceneIndex, bool isExternalLaunch = true, int port = 1757, bool isHeadless = true, bool isRunningLocally = true)Command game start-local: server owner only. Starts the local server with the given scene index.
private static async Task StartLocalTestAsync(int serverIdentifier = -1, PlayerMode playerMode = 0)Command game local-test (aliases test, local): needs debug_features. Starts a local test, on a listed server or the local one.
private static async Task StartLocalTestWithSceneAsync(int scene = -1, PlayerMode playerMode = 0)Command game local-test-scene: needs debug_features. Starts a local test with a given scene index.
private static async Task StartServerAsync(int server, bool isExternalLaunch = true, int port = 1757, bool isHeadless = true, bool isRunningLocally = true)Command game start-server (aliases start, host): server owner only. Starts a listed server, headless and external by default.
private static async Task StartServerAsyncClean(int server, bool isExternalLaunch = true, int port = 1757, bool isHeadless = true, bool isRunningLocally = true)Command game startclean: server owner only. Deletes the server's save, then starts it.
private static async Task StopGameMode()Command game stop-mode (alias stop): stops the current game mode.