Пример #1
0
 static void RemoveMinLevelUpDistance(ref SpawnSystem.SpawnData __0)
 {
     if (Settings.isDefaultDifficulty)
     {
         return;
     }
     __0.m_levelUpMinCenterDistance = 0f;
 }
Пример #2
0
    private static void ApplyWorldSpawnerTemplates(List <SpawnSystemList> spawnLists)
    {
        var templates = WorldSpawnTemplateManager
                        .GetTemplates()
                        .Where(x => x.template.TemplateEnabled)
                        .OrderBy(x => x.id)
                        .ToList();

        Log.LogTrace($"Found {templates.Count} world spawner templates to apply.");

        if (templates.Count == 0)
        {
            return;
        }

        var spawners = spawnLists
                       .SelectMany(x => x.m_spawners)
                       .ToList();

        var mainSpawnList = spawnLists.FirstOrDefault();

        if (mainSpawnList.IsNull())
        {
            Log.LogWarning("Something is really wrong. No SpawnSystemLists found. Skipping configuration of world spawners.");
            return;
        }

        foreach ((int id, WorldSpawnTemplate template) in templates)
        {
            // Validate
            if (!template.TemplateEnabled)
            {
                continue;
            }

            SpawnSystem.SpawnData entry;

            if (ConfigurationManager.GeneralConfig?.AlwaysAppend?.Value == true ||
                id >= spawners.Count)
            {
                entry = new SpawnSystem.SpawnData();
                mainSpawnList.m_spawners.Add(entry);

                Log.LogTrace($"Creating spawner entry for template [{id}:{template.PrefabName}]");

                ConfigureNewEntry(entry, template);
            }
            else
            {
                Log.LogTrace($"Overriding spawner entry [{id}:{spawners[id].m_prefab.name}] with template '{template.TemplateName}'");
                entry = spawners[id];

                ConfigureExistingEntry(entry, template);
            }

            WorldSpawnerManager.SetTemplate(entry, template);
        }
    }
        public static void ToSpawnLog(double totalSeconds, int result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Min(MaxSpawned, (TotalSeconds / SpawnInterval)): {result}");

            if (result == 0)
            {
                Log.LogTrace($"[{spawnData.m_prefab.name}] Conditions invalid. Additional info; MaxSpawned: {spawnData.m_maxSpawned}, TotalSeconds: {totalSeconds}, SpawnInterval: {spawnData.m_spawnInterval}");
            }
        }
Пример #4
0
        /// <summary>
        ///     Converts the <see cref="SpawnConfig">SpawnConfigs</see> to Valheim style <see cref="SpawnSystem.SpawnData"/> array.
        /// </summary>
        /// <returns>The Valheim <see cref="SpawnSystem.SpawnData"/> array</returns>
        public SpawnSystem.SpawnData[] GetSpawns()
        {
            SpawnSystem.SpawnData[] spawns = new SpawnSystem.SpawnData[SpawnConfigs.Length];

            for (int i = 0; i < spawns.Length; i++)
            {
                spawns[i] = SpawnConfigs[i].GetSpawnData();
            }

            return(spawns);
        }
Пример #5
0
    private static void ConfigureExistingEntry(SpawnSystem.SpawnData entry, WorldSpawnTemplate template)
    {
        if (!template.Enabled)
        {
            entry.m_enabled = template.Enabled;
        }

        GameObject prefab = entry.m_prefab;

        if (!string.IsNullOrWhiteSpace(template.PrefabName))
        {
            prefab = ZNetScene.instance.GetPrefab(template.PrefabHash);

            if (prefab.IsNull())
            {
                Log.LogWarning($"Unable to find prefab '{template.PrefabName}' for {template.PrefabName}. Skipping world spawn template {template.TemplateName}");
                DetectedUnableToFindPrefab = true;
                return;
            }
        }

        Configure(ref entry.m_name, template.TemplateName);
        Configure(ref entry.m_enabled, template.Enabled);
        Configure(ref entry.m_biome, template.BiomeMask);
        Configure(ref entry.m_prefab, prefab);
        Configure(ref entry.m_huntPlayer, template.ModifierHuntPlayer);
        Configure(ref entry.m_maxSpawned, template.MaxSpawned);
        Configure(ref entry.m_spawnInterval, (float?)template.SpawnInterval?.TotalSeconds);
        Configure(ref entry.m_spawnChance, template.SpawnChance);
        Configure(ref entry.m_minLevel, template.MinLevel);
        Configure(ref entry.m_maxLevel, template.MaxLevel);
        Configure(ref entry.m_levelUpMinCenterDistance, template.DistanceToCenterForLevelUp);
        Configure(ref entry.m_spawnDistance, template.MinDistanceToOther);
        Configure(ref entry.m_spawnRadiusMin, template.SpawnAtDistanceToPlayerMin);
        Configure(ref entry.m_spawnRadiusMax, template.SpawnAtDistanceToPlayerMax);
        Configure(ref entry.m_requiredGlobalKey, template.ConditionRequiredGlobalKey);
        Configure(ref entry.m_requiredEnvironments, template.ConditionEnvironments);
        Configure(ref entry.m_groupSizeMin, template.PackSizeMin);
        Configure(ref entry.m_groupSizeMax, template.PackSizeMax);
        Configure(ref entry.m_groupRadius, template.PackSpawnCircleRadius);
        Configure(ref entry.m_groundOffset, template.SpawnAtDistanceToGround);
        Configure(ref entry.m_spawnAtDay, template.ConditionAllowDuringDay);
        Configure(ref entry.m_spawnAtNight, template.ConditionAllowDuringNight);
        Configure(ref entry.m_minAltitude, template.ConditionMinAltitude);
        Configure(ref entry.m_maxAltitude, template.ConditionMaxAltitude);
        Configure(ref entry.m_minTilt, template.ConditionMinTilt);
        Configure(ref entry.m_maxTilt, template.ConditionMaxTilt);
        Configure(ref entry.m_inForest, template.ConditionAllowInForest);
        Configure(ref entry.m_outsideForest, template.ConditionAllowOutsideForest);
        Configure(ref entry.m_minOceanDepth, template.ConditionMinOceanDepth);
        Configure(ref entry.m_maxOceanDepth, template.ConditionMaxOceanDepth);
    }
Пример #6
0
    public static void StartSpawnSession(SpawnSystem.SpawnData currentEntry)
    {
        try
        {
#if DEBUG && VERBOSE
            Log.LogDebug("WorldSpawnSessionManager.StartSpawnSession");
#endif
            SpawnDataEntry = currentEntry;
            SpawnTemplate  = WorldSpawnerManager.GetTemplate(SpawnDataEntry);
        }
        catch (Exception e)
        {
            Log.LogError("Error during initialization of spawner entry session.", e);
        }
    }
    private static bool CheckValidPositionConditions(SpawnSystem.SpawnData spawn, Vector3 spawnPoint, ref bool __result)
    {
        if (spawn is null)
        {
            return(true);
        }

        if (!WorldSpawnSessionManager.ValidSpawnPosition(spawnPoint))
        {
            // Early stop. Return immediately and don't try vanilla positional requirements.
            __result = false;
            return(false);
        }

        return(true);
    }
Пример #8
0
    // Token: 0x06000BD0 RID: 3024 RVA: 0x00054428 File Offset: 0x00052628
    private void Spawn(SpawnSystem.SpawnData critter, Vector3 spawnPoint, bool eventSpawner)
    {
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(critter.m_prefab, spawnPoint, Quaternion.identity);
        BaseAI     component  = gameObject.GetComponent <BaseAI>();

        if (component != null)
        {
            if (critter.m_huntPlayer)
            {
                component.SetHuntPlayer(true);
            }
            if (critter.m_maxLevel > 1 && (critter.m_levelUpMinCenterDistance <= 0f || spawnPoint.magnitude > critter.m_levelUpMinCenterDistance))
            {
                Character component2 = gameObject.GetComponent <Character>();
                if (component2)
                {
                    int num = critter.m_minLevel;
                    while (num < critter.m_maxLevel && UnityEngine.Random.Range(0f, 100f) <= this.m_levelupChance)
                    {
                        num++;
                    }
                    if (num > 1)
                    {
                        component2.SetLevel(num);
                    }
                }
            }
            MonsterAI monsterAI = component as MonsterAI;
            if (monsterAI)
            {
                if (!critter.m_spawnAtDay)
                {
                    monsterAI.SetDespawnInDay(true);
                }
                if (eventSpawner)
                {
                    monsterAI.SetEventCreature(true);
                }
            }
        }
    }
Пример #9
0
    // Token: 0x06000BD2 RID: 3026 RVA: 0x00054674 File Offset: 0x00052874
    private bool FindBaseSpawnPoint(SpawnSystem.SpawnData spawn, List <Player> allPlayers, out Vector3 spawnCenter, out Player targetPlayer)
    {
        float min = (spawn.m_spawnRadiusMin > 0f) ? spawn.m_spawnRadiusMin : 40f;
        float max = (spawn.m_spawnRadiusMax > 0f) ? spawn.m_spawnRadiusMax : 80f;

        for (int i = 0; i < 20; i++)
        {
            Player  player = allPlayers[UnityEngine.Random.Range(0, allPlayers.Count)];
            Vector3 a      = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f) * Vector3.forward;
            Vector3 vector = player.transform.position + a * UnityEngine.Random.Range(min, max);
            if (this.IsSpawnPointGood(spawn, ref vector))
            {
                spawnCenter  = vector;
                targetPlayer = player;
                return(true);
            }
        }
        spawnCenter  = Vector3.zero;
        targetPlayer = null;
        return(false);
    }
    internal static List <string> WriteSpawner(SpawnSystem.SpawnData spawner, int index, bool postChange)
    {
        List <string> lines = new List <string>();

        // Try get template.
        var template = WorldSpawnerManager.GetTemplate(spawner);

        //Write header
        if (template is not null)
        {
            lines.Add($"[WorldSpawner.{template.Index}]");
        }
        else
        {
            lines.Add($"[WorldSpawner.{index}]");
        }

        string environmentArray = "";

        try
        {
            if ((spawner.m_requiredEnvironments?.Count ?? 0) > 0)
            {
                environmentArray = spawner.m_requiredEnvironments.Join();
            }
        }
        catch (Exception e)
        {
            Log.LogWarning($"Error while attempting to read required environments of spawner {spawner}", e);
        }

        //Write lines
        lines.Add($"{nameof(SpawnConfiguration.Name)}={spawner.m_name}");
        lines.Add($"{nameof(SpawnConfiguration.Enabled)}={spawner.m_enabled}");
        try
        {
            lines.Add($"{nameof(SpawnConfiguration.Biomes)}={BiomeArray(spawner.m_biome)}");
        }
        catch (Exception e)
        {
            Log.LogWarning($"Failed to read biome of {spawner}", e);
        }

        try
        {
            lines.Add($"{nameof(SpawnConfiguration.PrefabName)}={spawner.m_prefab.GetCleanedName()}");
        }
        catch (Exception e)
        {
            Log.LogWarning($"Error while attempting to read name of prefab for world spawn {spawner?.m_name}, to print to debug file.", e);
        }

        lines.Add($"{nameof(SpawnConfiguration.HuntPlayer)}={spawner.m_huntPlayer}");
        lines.Add($"{nameof(SpawnConfiguration.MaxSpawned)}={spawner.m_maxSpawned}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnInterval)}={spawner.m_spawnInterval.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnChance)}={spawner.m_spawnChance.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.LevelMin)}={spawner.m_minLevel}");
        lines.Add($"{nameof(SpawnConfiguration.LevelMax)}={spawner.m_maxLevel}");
        lines.Add($"{nameof(SpawnConfiguration.LevelUpMinCenterDistance)}={spawner.m_levelUpMinCenterDistance.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnDistance)}={spawner.m_spawnDistance.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnRadiusMin)}={spawner.m_spawnRadiusMin.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnRadiusMax)}={spawner.m_spawnRadiusMax.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.RequiredGlobalKey)}={spawner.m_requiredGlobalKey}");
        lines.Add($"{nameof(SpawnConfiguration.RequiredEnvironments)}={environmentArray}");
        lines.Add($"{nameof(SpawnConfiguration.GroupSizeMin)}={spawner.m_groupSizeMin}");
        lines.Add($"{nameof(SpawnConfiguration.GroupSizeMax)}={spawner.m_groupSizeMax}");
        lines.Add($"{nameof(SpawnConfiguration.GroupRadius)}={spawner.m_groupRadius.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.GroundOffset)}={spawner.m_groundOffset.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnDuringDay)}={spawner.m_spawnAtDay}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnDuringNight)}={spawner.m_spawnAtNight}");
        lines.Add($"{nameof(SpawnConfiguration.ConditionAltitudeMin)}={spawner.m_minAltitude.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.ConditionAltitudeMax)}={spawner.m_maxAltitude.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.ConditionTiltMin)}={spawner.m_minTilt.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.ConditionTiltMax)}={spawner.m_maxTilt.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnInForest)}={spawner.m_inForest}");
        lines.Add($"{nameof(SpawnConfiguration.SpawnOutsideForest)}={spawner.m_outsideForest}");
        lines.Add($"{nameof(SpawnConfiguration.OceanDepthMin)}={spawner.m_minOceanDepth.ToString(CultureInfo.InvariantCulture)}");
        lines.Add($"{nameof(SpawnConfiguration.OceanDepthMax)}={spawner.m_maxOceanDepth.ToString(CultureInfo.InvariantCulture)}");

        try
        {
            if (template is null)
            {
                Character character = spawner.m_prefab.IsNull()
                    ? null
                    : spawner.m_prefab.GetComponent <Character>();

                string factionName = "";

                if (character.IsNotNull())
                {
                    factionName = character.m_faction.ToString();
                }

                lines.Add($"{nameof(SpawnConfiguration.SetFaction)}={factionName}");
            }
        }
        catch (Exception e)
        {
            Log.LogWarning($"Error while attempting to write faction of spawner {spawner}", e);
        }

        HashSet <Type> AddedOptions = new();

        if (template is not null)
        {
            // Add custom settings.
            foreach (var condition in template.SpawnConditions)
            {
                switch (condition)
                {
                case ConditionDistanceToCenter con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        if ((con.MinDistance ?? 0) != 0)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.ConditionDistanceToCenterMin)}={(con.MinDistance ?? 0).ToString(CultureInfo.InvariantCulture)}");
                        }
                        if ((con.MaxDistance ?? 0) != 0)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.ConditionDistanceToCenterMax)}={(con.MaxDistance ?? 0).ToString(CultureInfo.InvariantCulture)}");
                        }
                    }
                    break;

                case ConditionWorldAge con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        if ((con.MinDays ?? 0) != 0)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.ConditionWorldAgeDaysMin)}={con.MinDays ?? 0}");
                        }
                        if ((con.MaxDays ?? 0) != 0)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.ConditionWorldAgeDaysMax)}={con.MaxDays ?? 0}");
                        }
                    }
                    break;

                case ConditionNearbyPlayersCarryValue con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionNearbyPlayersCarryValue)}={con.RequiredValue}");
                    }
                    break;

                case ConditionNearbyPlayersCarryItem con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionNearbyPlayerCarriesItem)}={con.ItemsSearchedFor.Join()}");
                    }
                    break;

                case ConditionNearbyPlayersNoise con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionNearbyPlayersNoiseThreshold)}={con.NoiseThreshold.ToString(CultureInfo.InvariantCulture)}");
                    }
                    break;

                case ConditionNearbyPlayersStatus con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionNearbyPlayersStatus)}={con.RequiredStatusEffects.Join()}");
                    }
                    break;

                case ConditionGlobalKeysRequiredMissing con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.RequiredNotGlobalKey)}={con.RequiredMissing.Join()}");
                    }
                    break;

                case ConditionLocation con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionLocation)}={con.Locations.Join()}");
                    }
                    break;

                case ConditionAreaSpawnChance con:
                    // Can't select entity ids in cfg files, so only output if it matches the template id to properly simulate what is possible.
                    if (con.EntityId == template.Index)
                    {
                        if (con.AreaChance != 100)
                        {
                            if (AddedOptions.Add(con.GetType()))
                            {
                                lines.Add($"{nameof(SpawnConfiguration.ConditionAreaSpawnChance)}={con.AreaChance.ToString(CultureInfo.InvariantCulture)}");
                            }
                        }
                    }
                    break;

                case ConditionAreaIds con:
                    if (AddedOptions.Add(con.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.ConditionAreaIds)}={con.RequiredAreaIds.Join()}");
                    }
                    break;

                default:
                    break;
                }
            }

            foreach (var modifier in template.SpawnModifiers)
            {
                switch (modifier)
                {
                case ModifierSetFaction mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        lines.Add($"{nameof(SpawnConfiguration.SetFaction)}={mod.Faction?.ToString() ?? ""}");
                    }
                    break;

                case ModifierSetRelentless mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        if (mod.Relentless)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.SetRelentless)}={mod.Relentless}");
                        }
                    }
                    break;

                case ModifierDespawnOnConditionsInvalid mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        // Can't truly reflect the internal settings, so just treat it as set if the type is present.
                        lines.Add($"{nameof(SpawnConfiguration.SetTryDespawnOnConditionsInvalid)}=true");
                    }
                    break;

                case ModifierDespawnOnAlert mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        if (mod.DespawnOnAlert)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.SetTryDespawnOnAlert)}={mod.DespawnOnAlert}");
                        }
                    }
                    break;

                case ModifierSetTamed mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        if (mod.Tamed)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.SetTamed)}={mod.Tamed}");
                        }
                    }
                    break;

                case ModifierSetTamedCommandable mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        if (mod.Commandable)
                        {
                            lines.Add($"{nameof(SpawnConfiguration.SetTamedCommandable)}={mod.Commandable}");
                        }
                    }
                    break;

                case ModifierSetTemplateId mod:
                    if (AddedOptions.Add(mod.GetType()))
                    {
                        if (!string.IsNullOrWhiteSpace(mod.TemplateId))
                        {
                            lines.Add($"{nameof(SpawnConfiguration.TemplateId)}={mod.TemplateId}");
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            if (Integrations.IntegrationManager.InstalledCLLC)
            {
                AddCllcIntegrationLines(lines, template);
            }

            if (Integrations.IntegrationManager.InstalledEpicLoot)
            {
                AddEpicLootLines(lines, template);
            }

            if (Integrations.IntegrationManager.InstalledMobAI)
            {
                AddMobAiLines(lines, template);
            }
        }

        lines.Add("");

        return(lines);
    }
        public static bool MaxSpawnedLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Spawned: {result}, MaxSpawned: {spawnData.m_maxSpawned}");

            return(result);
        }
Пример #12
0
 // Token: 0x0600118B RID: 4491 RVA: 0x00078E49 File Offset: 0x00077049
 public SpawnSystem.SpawnData Clone()
 {
     SpawnSystem.SpawnData spawnData = base.MemberwiseClone() as SpawnSystem.SpawnData;
     spawnData.m_requiredEnvironments = new List <string>(this.m_requiredEnvironments);
     return(spawnData);
 }
Пример #13
0
 // Token: 0x06000BDD RID: 3037 RVA: 0x00054C75 File Offset: 0x00052E75
 private bool HaveGlobalKeys(SpawnSystem.SpawnData ev)
 {
     return(string.IsNullOrEmpty(ev.m_requiredGlobalKey) || ZoneSystem.instance.GetGlobalKey(ev.m_requiredGlobalKey));
 }
Пример #14
0
    // Token: 0x06000BD1 RID: 3025 RVA: 0x00054504 File Offset: 0x00052704
    private bool IsSpawnPointGood(SpawnSystem.SpawnData spawn, ref Vector3 spawnPoint)
    {
        Vector3 vector;

        Heightmap.Biome     biome;
        Heightmap.BiomeArea biomeArea;
        Heightmap           heightmap;

        ZoneSystem.instance.GetGroundData(ref spawnPoint, out vector, out biome, out biomeArea, out heightmap);
        if ((spawn.m_biome & biome) == Heightmap.Biome.None)
        {
            return(false);
        }
        if ((spawn.m_biomeArea & biomeArea) == (Heightmap.BiomeArea) 0)
        {
            return(false);
        }
        if (ZoneSystem.instance.IsBlocked(spawnPoint))
        {
            return(false);
        }
        float num = spawnPoint.y - ZoneSystem.instance.m_waterLevel;

        if (num < spawn.m_minAltitude || num > spawn.m_maxAltitude)
        {
            return(false);
        }
        float num2 = Mathf.Cos(0.017453292f * spawn.m_maxTilt);
        float num3 = Mathf.Cos(0.017453292f * spawn.m_minTilt);

        if (vector.y < num2 || vector.y > num3)
        {
            return(false);
        }
        float range = (spawn.m_spawnRadiusMin > 0f) ? spawn.m_spawnRadiusMin : 40f;

        if (Player.IsPlayerInRange(spawnPoint, range))
        {
            return(false);
        }
        if (EffectArea.IsPointInsideArea(spawnPoint, EffectArea.Type.PlayerBase, 0f))
        {
            return(false);
        }
        if (!spawn.m_inForest || !spawn.m_outsideForest)
        {
            bool flag = WorldGenerator.InForest(spawnPoint);
            if (!spawn.m_inForest && flag)
            {
                return(false);
            }
            if (!spawn.m_outsideForest && !flag)
            {
                return(false);
            }
        }
        if (spawn.m_minOceanDepth != spawn.m_maxOceanDepth && heightmap != null)
        {
            float oceanDepth = heightmap.GetOceanDepth(spawnPoint);
            if (oceanDepth < spawn.m_minOceanDepth || oceanDepth > spawn.m_maxOceanDepth)
            {
                return(false);
            }
        }
        return(true);
    }
 public static void LogIsEnabled(SpawnSystem.SpawnData spawnData)
 {
     Log.LogTrace($"[{spawnData.m_prefab.name}] Is enabled: {spawnData.m_enabled}");
 }
        public static bool FindBaseSpawnPointLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Found base spawn point: {result}");

            return(result);
        }
        public static bool SpawnAtNightLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Is Environment: {result}");

            return(result);
        }
        public static float LogSpawnChance(float result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Spawn Roll: {result}, Spawn Chance: {spawnData.m_spawnChance}");

            return(result);
        }
        public static bool HaveInstanceInRangeLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Have instance in range: {result}");

            return(result);
        }
        public static bool LogHaveBiome(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Have Biome: {result}");

            return(result);
        }
        public static bool HaveGlobalKeyLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Have Global Key: {result}");

            return(result);
        }
        public static bool isSpawnPointGoodLog(bool result, SpawnSystem.SpawnData spawnData)
        {
            Log.LogTrace($"[{spawnData.m_prefab.name}] Is spawn point good: {result}");

            return(result);
        }