Esempio n. 1
0
            private static void Prefix(RandomSpawnObject __instance)
            {
                if (ExperienceModeManager.GetCurrentExperienceModeType() != ExperienceModeType.Interloper || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "CoastalRegion")
                {
                    return;
                }

                if (__instance.m_RerollAfterGameHours == 0f)
                {
                    if (Settings.settings.randomiseInterloper)
                    {
                        if (Implementation.interloperSpawner == __instance.gameObject.name)
                        {
                            __instance.m_NumObjectsToEnableInterloper = 0;
                        }
                        else if (Implementation.coastalSpawners.Contains <string>(__instance.gameObject.name))
                        {
                            __instance.m_NumObjectsToEnableInterloper = 1;
                        }
                    }
                    else
                    {
                        if (Implementation.interloperSpawner == __instance.gameObject.name)
                        {
                            __instance.m_NumObjectsToEnableInterloper = 1;
                        }
                        else if (Implementation.coastalSpawners.Contains <string>(__instance.gameObject.name))
                        {
                            __instance.m_NumObjectsToEnableInterloper = 0;
                        }
                    }
                }
            }
            private static void Prefix(RandomSpawnObject __instance)
            {
                if (!IsSpawnerRSO(__instance))
                {
                    return;
                }
                if (GameManager.IsStoryMode() && !WildlifeBegone.Config.enableInStoryMode)
                {
                    return;
                }

                float oldRerollTime = __instance.m_RerollAfterGameHours;
                int   oldMaxObjects = __instance.m_NumObjectsToEnableStalker;

                RSOSettings rsoSettings            = WildlifeBegone.Config.rsoSettings;
                float       maximumCountMultiplier = rsoSettings.ActiveSpawnerCountMultiplier;

                __instance.m_RerollAfterGameHours *= rsoSettings.RerollActiveSpawnersTimeMultiplier;
                RoundingMultiply(ref __instance.m_NumObjectsToEnablePilgrim, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableVoyageur, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableStalker, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableInterloper, maximumCountMultiplier);

                if (WildlifeBegone.Config.logging)
                {
                    Debug.LogFormat("Adjusted RSO {0}: Reroll time {1:F1} -> {2:F1}, maximum active {3:D} -> {4:D}",
                                    __instance.name,
                                    oldRerollTime, __instance.m_RerollAfterGameHours,
                                    oldMaxObjects, __instance.m_NumObjectsToEnableStalker);
                }
            }
        internal static void RerollBurntBuildings()
        {
            int numParameters = uConsole.GetNumParameters();

            if (numParameters < 1 || numParameters > 1)
            {
                uConsole.Log("|  This command requires a single argument (e.g. help)");
                PrintUsage();
                return;
            }

            string targetArea = uConsole.GetString().ToLower();

            if (targetArea.Contains("help"))
            {
                PrintUsage();
                return;
            }

            if (targetArea.Contains("interloper"))
            {
                if (ExperienceModeManager.GetCurrentExperienceModeType() != ExperienceModeType.Interloper)
                {
                    uConsole.Log("|  This command can only be used on Interloper");
                    PrintUsage();
                    return;
                }
                if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "CoastalRegion")
                {
                    uConsole.Log("|  This command can only be used outside in Coastal Highway");
                    PrintUsage();
                    return;
                }
                if (Settings.settings.randomiseInterloper)
                {
                    uConsole.Log("|  Randomising Coastal Highway building spawns on Interloper");
                }
                if (!Settings.settings.randomiseInterloper)
                {
                    uConsole.Log("|  Reverting randomisation of Coastal Highway building spawns on Interloper");
                }

                RerollSpawner(FindAllSpawners());
                return;
            }

            RandomSpawnObject spawner = FindSpawner(targetArea);

            if (!spawner)
            {
                uConsole.Log("|  Error: Could not find specified TargetArea in the current scene");
                PrintUsage();
                return;
            }
            else
            {
                RerollSpawner(spawner);
                uConsole.Log("|  Rerolled burnt buildings in TargetArea");
            }
        }
 private static bool IsSpawnerRSO(RandomSpawnObject rso)
 {
     foreach (GameObject go in rso.m_ObjectList)
     {
         if (go && !go.GetComponent <SpawnRegion>())
         {
             return(false);
         }
     }
     return(true);
 }
        public static void RerollSpawner(RandomSpawnObject spawner)
        {
            spawner.DisableAll();
            Vector3 oldPos = spawner.transform.localPosition;

            try
            {
                spawner.transform.Translate(UnityEngine.Random.onUnitSphere);
                spawner.ActivateRandomObject();
            }
            finally
            {
                spawner.transform.localPosition = oldPos;
            }
        }
Esempio n. 6
0
    static void Prefix(RandomSpawnObject __instance)
    {
        if (GameManager.IsStoryMode())
        {
            return;
        }

        if (__instance.m_RerollAfterGameHours > 0.0)
        {
            float oldRerollTime = __instance.m_RerollAfterGameHours;
            int   oldMaxObjects = __instance.m_NumObjectsToEnableStalker;

            __instance.m_RerollAfterGameHours        *= 3;
            __instance.m_NumObjectsToEnablePilgrim    = 1;
            __instance.m_NumObjectsToEnableVoyageur   = 1;
            __instance.m_NumObjectsToEnableStalker    = 1;
            __instance.m_NumObjectsToEnableInterloper = 1;

            Debug.LogFormat("Adjusted RSO {0}: Reroll time {1:F1} -> {2:F1}, maximum active {3:D} -> {4:D}",
                            __instance.name, oldRerollTime, __instance.m_RerollAfterGameHours, oldMaxObjects, __instance.m_NumObjectsToEnableStalker);
        }
    }