public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings); return(newPlayer); }
public bool Initiate(TestRunSO TestRunSO) { CharacterSettings characterSettings; if (string.IsNullOrEmpty(SerialisedCharacterSettings)) { characterSettings = new CharacterSettings(); } else { characterSettings = JsonConvert.DeserializeObject <CharacterSettings>(SerialisedCharacterSettings); } var Connectedplayer = PlayerList.Instance.Get(PlayerManager.LocalPlayer); var Request = PlayerSpawnRequest.RequestOccupation(PlayerManager.LocalViewerScript, Occupation, characterSettings, Connectedplayer.UserId); PlayerSpawn.ServerSpawnPlayer(Request, PlayerManager.LocalViewerScript, Occupation, characterSettings, spawnPos: PositionToSpawn.RoundToInt(), existingMind: PlayerManager.LocalPlayerScript.mind, conn: Connectedplayer.Connection); return(true); }
private void CmdRequestJob(JobType jobType, string jsonCharSettings) { var characterSettings = JsonConvert.DeserializeObject <CharacterSettings>(jsonCharSettings); if (GameManager.Instance.CurrentRoundState != RoundState.Started) { Logger.LogWarningFormat("Round hasn't started yet, can't request job {0} for {1}", Category.Jobs, jobType, characterSettings); return; } int slotsTaken = GameManager.Instance.GetOccupationsCount(jobType); int slotsMax = GameManager.Instance.GetOccupationMaxCount(jobType); if (slotsTaken >= slotsMax) { return; } var spawnRequest = PlayerSpawnRequest.RequestOccupation(this, GameManager.Instance.GetRandomFreeOccupation(jobType), characterSettings); //regardless of their chosen occupation, they might spawn as an antag instead. //If they do, bypass the normal spawn logic. if (GameManager.Instance.TrySpawnAntag(spawnRequest)) { return; } PlayerSpawn.ServerSpawnPlayer(spawnRequest); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest); UpdateChatMessage.Send(newPlayer, ChatChannel.System, ChatModifier.None, "<color=red>As a member of the Cargonian Members Federation you have been ordered to help in the efforts to secede from the rest of the station.</color>"); // spawn them normally, with their preferred occupation return(newPlayer); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest); UpdateChatMessage.Send(newPlayer, ChatChannel.System, ChatModifier.None, "<color=red>Something has awoken in you. You feel the urgent need to rebel with your brothers against this station.</color>"); // spawn them normally, with their preferred occupation return(newPlayer); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { // spawn them normally, with their preferred occupation var spawn = PlayerSpawn.ServerSpawnPlayer(spawnRequest); //Add blob player to game object spawn.AddComponent <BlobStarter>(); return(spawn); }
/// <summary> /// Start the round /// </summary> public virtual void StartRound() { Logger.LogFormat("Starting {0} round!", Category.GameMode, Name); List <PlayerSpawnRequest> playerSpawnRequests; List <PlayerSpawnRequest> antagSpawnRequests; int antagsToSpawn = CalculateAntagCount(PlayerList.Instance.ReadyPlayers.Count); var jobAllocator = new JobAllocator(); var playerPool = PlayerList.Instance.ReadyPlayers; if (AllocateJobsToAntags) { // Allocate jobs to all players first then choose antags playerSpawnRequests = jobAllocator.DetermineJobs(playerPool); var antagCandidates = playerSpawnRequests.Where(p => !NonAntagJobTypes.Contains(p.RequestedOccupation.JobType) && HasPossibleAntagEnabled(ref p.CharacterSettings.AntagPreferences) && HasPossibleAntagNotBanned(p.UserID)); antagSpawnRequests = antagCandidates.PickRandom(antagsToSpawn).ToList(); // Player and antag spawn requests are kept separate to stop players being spawned twice playerSpawnRequests.RemoveAll(antagSpawnRequests.Contains); } else { // Choose antags first then allocate jobs to all other players var antagCandidates = playerPool.Where(p => HasPossibleAntagEnabled(ref p.CharacterSettings.AntagPreferences) && HasPossibleAntagNotBanned(p.UserId)); var chosenAntags = antagCandidates.PickRandom(antagsToSpawn).ToList(); // Player and antag spawn requests are kept separate to stop players being spawned twice playerPool.RemoveAll(chosenAntags.Contains); playerSpawnRequests = jobAllocator.DetermineJobs(playerPool); antagSpawnRequests = chosenAntags.Select(player => PlayerSpawnRequest.RequestOccupation(player, null)).ToList(); } // Spawn all players and antags foreach (var spawnReq in playerSpawnRequests) { PlayerSpawn.ServerSpawnPlayer(spawnReq); } foreach (var spawnReq in antagSpawnRequests) { SpawnAntag(spawnReq); } var msg = $"{PlayerList.Instance.ReadyPlayers.Count} players ready, {antagsToSpawn} antags to spawn. {playerSpawnRequests.Count} players spawned (excludes antags), {antagSpawnRequests.Count} antags spawned"; DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAdminLogURL, msg, "[GameMode]"); StationObjectiveManager.Instance.ServerChooseObjective(); GameManager.Instance.CurrentRoundState = RoundState.Started; EventManager.Broadcast(Event.RoundStarted, true); }
public void ProcessSpawnPlayerQueue() { if (QueueProcessing) { return; } QueueProcessing = true; var count = SpawnPlayerRequestQueue.Count; if (count == 0) { QueueProcessing = false; return; } for (var i = 1; i <= count; i++) { var player = SpawnPlayerRequestQueue.Peek(); if (player == null || player.JoinedViewer == null) { SpawnPlayerRequestQueue.Dequeue(); continue; } int slotsTaken = GameManager.Instance.GetOccupationsCount(player.RequestedOccupation.JobType); int slotsMax = GameManager.Instance.GetOccupationMaxCount(player.RequestedOccupation.JobType); if (slotsTaken >= slotsMax) { SpawnPlayerRequestQueue.Dequeue(); continue; } //regardless of their chosen occupation, they might spawn as an antag instead. //If they do, bypass the normal spawn logic. if (GameManager.Instance.TrySpawnAntag(player)) { SpawnPlayerRequestQueue.Dequeue(); continue; } PlayerSpawn.ServerSpawnPlayer(player); SpawnPlayerRequestQueue.Dequeue(); } QueueProcessing = false; }
public void CmdRequestJob(JobType jobType, CharacterSettings characterSettings) { var spawnRequest = PlayerSpawnRequest.RequestOccupation(this, GameManager.Instance.GetRandomFreeOccupation(jobType), characterSettings); //regardless of their chosen occupation, they might spawn as an antag instead. //If they do, bypass the normal spawn logic. if (GameManager.Instance.TrySpawnAntag(spawnRequest)) { return; } PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, spawnRequest.RequestedOccupation, characterSettings); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings); UpdateChatMessage.Send(newPlayer, ChatChannel.Local, ChatModifier.Whisper, "I can't believe we managed to break out of a Nanotrasen superjail! Sadly though," + " our work is not done. The emergency teleport at the station logs everyone who uses it," + " and where they went. It won't be long until Centcom tracks where we've gone off to." + " I need to move in the shadows and keep out of sight," + " I'm not going back."); _ = StationWarning(newPlayer.Player().Name); return(newPlayer); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { GameObject newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings); ConnectedPlayer player = newPlayer.Player(); GiveRandomSpells(player); if (assignRandomNameOnSpawn) { player.Script.SetPermanentName(GetRandomWizardName()); } SetPapers(player); return(newPlayer); }
// add any NuclearOperative specific logic here public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { //spawn as a nuke op regardless of the requested occupation var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings); //send the code: //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = Object.FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(newPlayer, ChatChannel.Syndicate, ChatModifier.None, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } return(newPlayer); }
/// <summary> /// Start the round /// </summary> public virtual void StartRound() { Logger.LogFormat("Starting {0} round!", Category.GameMode, Name); List <PlayerSpawnRequest> playerSpawnRequests; List <PlayerSpawnRequest> antagSpawnRequests; int antagsToSpawn = CalculateAntagCount(PlayerList.Instance.ReadyPlayers.Count); var jobAllocator = new JobAllocator(); var playerPool = PlayerList.Instance.ReadyPlayers; if (AllocateJobsToAntags) { // Allocate jobs to all players first then choose antags playerSpawnRequests = jobAllocator.DetermineJobs(playerPool); var antagCandidates = playerSpawnRequests.Where(p => !NonAntagJobTypes.Contains(p.RequestedOccupation.JobType) && HasPossibleAntagEnabled(ref p.CharacterSettings.AntagPreferences)); antagSpawnRequests = antagCandidates.PickRandom(antagsToSpawn).ToList(); // Player and antag spawn requests are kept separate to stop players being spawned twice playerSpawnRequests.RemoveAll(antagSpawnRequests.Contains); } else { // Choose antags first then allocate jobs to all other players var antagCandidates = playerPool.Where(p => HasPossibleAntagEnabled(ref p.CharacterSettings.AntagPreferences)); var chosenAntags = antagCandidates.PickRandom(antagsToSpawn).ToList(); // Player and antag spawn requests are kept separate to stop players being spawned twice playerPool.RemoveAll(chosenAntags.Contains); playerSpawnRequests = jobAllocator.DetermineJobs(playerPool); antagSpawnRequests = chosenAntags.Select(player => PlayerSpawnRequest.RequestOccupation(player, null)).ToList(); } // Spawn all players and antags foreach (var spawnReq in playerSpawnRequests) { PlayerSpawn.ServerSpawnPlayer(spawnReq); } foreach (var spawnReq in antagSpawnRequests) { SpawnAntag(spawnReq); } }
public void TrySpawnPlayer(PlayerSpawnRequest player) { if (player == null || player.JoinedViewer == null) { return; } int slotsTaken = Instance.ClientGetOccupationsCount(player.RequestedOccupation.JobType); int slotsMax = Instance.GetOccupationMaxCount(player.RequestedOccupation.JobType); if (slotsTaken >= slotsMax) { return; } //regardless of their chosen occupation, they might spawn as an antag instead. //If they do, bypass the normal spawn logic. if (Instance.GameMode.TrySpawnAntag(player)) { return; } PlayerSpawn.ServerSpawnPlayer(player); }
public void CmdRequestJob(JobType jobType, CharacterSettings characterSettings) { PlayerSpawn.ServerSpawnPlayer(this, GameManager.Instance.GetRandomFreeOccupation(jobType), characterSettings); }
/// <summary> /// Server only. Spawn the joined viewer as the indicated antag, includes creating their player object /// and transferring them to it. /// </summary> /// <param name="spawnRequest">player's requested spawn</param> /// <returns>gameobject of the spawned antag that he player is now in control of</returns> public virtual GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { // spawn them normally but override the player-requested occupation with the antagonist occupation return(PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings)); }
public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { // spawn them normally, with their preferred occupation return(PlayerSpawn.ServerSpawnPlayer(spawnRequest)); }