コード例 #1
0
        /// <summary>
        /// Gets the default spawn settings file. This is closest to base game.
        /// </summary>
        public static SpawnSettings GetDefaultSpawnSettings()
        {
            var spawnSettings = new SpawnSettings();

            spawnSettings.DefineSharedSpawns(RoleType.Scp93953, RoleType.Scp93989);
            spawnSettings.DefineSharedSpawns(RoleType.NtfScientist, RoleType.NtfCadet, RoleType.NtfCommander,
                                             RoleType.NtfLieutenant);

            var configs = CustomPlayerSpawning.Configs;

            if (configs.UseDefaultSafeSpawns)
            {
                spawnSettings.DefineSafeSpawnDistances(new DistanceCheckInfo(
                                                           new[] { RoleType.ChaosInsurgency, RoleType.ClassD },
                                                           configs.DefaultSafeSpawnDistance, configs.DefaultEnemySafeSpawnDistance));

                spawnSettings.DefineSafeSpawnDistances(new DistanceCheckInfo(
                                                           new[]
                {
                    RoleType.NtfCadet, RoleType.NtfCommander, RoleType.NtfLieutenant, RoleType.NtfScientist,
                    RoleType.Scientist, RoleType.FacilityGuard
                },
                                                           configs.DefaultSafeSpawnDistance, configs.DefaultEnemySafeSpawnDistance));

                spawnSettings.DefineSafeSpawnDistances(new DistanceCheckInfo(
                                                           new[]
                {
                    RoleType.Scp93953, RoleType.Scp049, RoleType.Scp096, RoleType.Scp106, RoleType.Scp93989,
                    RoleType.Scp173
                },
                                                           configs.DefaultSafeSpawnDistance, configs.DefaultEnemySafeSpawnDistance));
            }

            return(spawnSettings);
        }
コード例 #2
0
        private void OrganizeSpawns()
        {
            if (!_spawnFileExists)
            {
                CreateDefaultSpawnPointFile();
            }
            if (SpawnSettings == null)
            {
                SpawnSettings = SpawnSettings.GetDefaultSpawnSettings();
            }

            RoleGameObjectDictionary.Clear();

            // For each role, get who they share spawns with.
            for (int i = 0; i < RoleTypeSize; i++)
            {
                var role = (RoleType)i;

                // Make sure the role isn't already populated
                if (RoleGameObjectDictionary.ContainsKey(role))
                {
                    continue;
                }

                var sharedRoles     = SpawnSettings.PopulatedSharedSpawnInfo[role];
                var sharedRolesSize = sharedRoles.Count;

                var sharedSpawnPoints = new List <PlayerSpawnPoint>();

                // Create a list of GameObjects using those shared spawn points.
                for (int j = 0; j < sharedRolesSize; j++)
                {
                    var sharedRole = sharedRoles[j];
                    if (_pointList.IdGroupedFixedPoints.TryGetValue(((int)sharedRole).ToString(), out var spawnList))
                    {
                        var spawnCount = spawnList.Count;

                        for (int k = 0; k < spawnCount; k++)
                        {
                            var spawn = spawnList[k];

                            var go = new GameObject(spawn.Id);
                            go.transform.position = spawn.Position;
                            go.transform.rotation = spawn.Rotation;

                            sharedSpawnPoints.Add(new PlayerSpawnPoint(go, spawn.Room));
                        }
                    }
                }

                if (sharedSpawnPoints.Count == 0)
                {
                    continue;
                }

                // Assign the shared roles the Game Objects.
                for (int j = 0; j < sharedRolesSize; j++)
                {
                    var sharedRole = sharedRoles[j];

                    RoleGameObjectDictionary.Add(sharedRole, sharedSpawnPoints);
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Apply your custom settings on OnEnabled() or ignore to use default game settings.
 /// </summary>
 /// <param name="settings"><see cref="SpawnSettings"/>"/></param>
 public static void ApplySettings(SpawnSettings settings) =>
 CustomPlayerSpawning.SpawnSettings = settings;