예제 #1
0
        private SpawnedAntag SetAntagDetails(Antagonist chosenAntag, ConnectedPlayer connectedPlayer)
        {
            // Generate objectives for this antag
            List <Objective> objectives = antagData.GenerateObjectives(connectedPlayer.Script, chosenAntag);
            // Set the antag
            var spawnedAntag = SpawnedAntag.Create(chosenAntag, connectedPlayer.Script.mind, objectives);

            connectedPlayer.Script.mind.SetAntag(spawnedAntag);
            return(spawnedAntag);
        }
예제 #2
0
        /// <summary>
        /// Server only. Spawn the joined viewer as the indicated antag, includes creating their player object
        /// and transferring them to it. This is used as an alternative
        /// to PlayerSpawn.ServerSpawnPlayer when an antag should be spawned.
        /// </summary>
        /// <param name="chosenAntag">antag to spawn as</param>
        /// <param name="spawnRequest">player's requested spawn</param>
        public void ServerSpawnAntag(Antagonist chosenAntag, PlayerSpawnRequest spawnRequest)
        {
            //spawn the antag using their custom spawn logic
            var spawnedPlayer = chosenAntag.ServerSpawn(spawnRequest);

            var connectedPlayer = PlayerList.Instance.Get(spawnedPlayer);

            // Generate objectives for this antag
            List <Objective> objectives = AntagData.GenerateObjectives(connectedPlayer.Script, chosenAntag);
            // Set the antag
            var spawnedAntag = SpawnedAntag.Create(chosenAntag, connectedPlayer.Script.mind, objectives);

            connectedPlayer.Script.mind.SetAntag(spawnedAntag);
            ActiveAntags.Add(spawnedAntag);
            Logger.Log($"Created new antag. Made {connectedPlayer.Name} a {chosenAntag.AntagName} with objectives:\n{spawnedAntag.GetObjectivesForLog()}", Category.Antags);
        }