/// <summary> /// Sends a request to master server, to spawn a process in a given region, and with given options /// </summary> public void RequestSpawn(Dictionary <string, string> options, string region, ClientSpawnRequestCallback callback, ErrorCallback errorCallback) { if (!Client.IsConnected) { errorCallback.Invoke("Not connected"); return; } var packet = new ClientsSpawnRequestPacket { Options = options, Region = region }; Client.SendMessage((ushort)OpCodes.ClientsSpawnRequest, packet, (status, response) => { if (status != ResponseStatus.Success) { errorCallback.Invoke(response.AsString("Unknown error")); return; } // Spawn id var spawnId = response.AsInt(); var controller = new SpawnRequestController(this, spawnId, Client); _localSpawnRequests[controller.SpawnId] = controller; callback.Invoke(controller); }); }
protected virtual bool CanClientSpawn(IPeer peer, ClientsSpawnRequestPacket data) { return(EnableClientSpawnRequests); }
private bool CanClientSpawn(IPeer peer, ClientsSpawnRequestPacket data) { return(!_config.SpawnRequestsRequireAuthentication || peer.HasExtension <UserExtension>()); }