public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active());
     //Debug.Log("RoomsExpanded: Loaded DLC version of the mod. Last update: 2021.05.14 for build 463874.");
     Debug.Log("RoomsExpanded: Loaded Vanilla version of the mod. Last update: 2021.05.14 for build 460672.");
     Debug.Log("ResearchRequirements: Loaded from: " + Assembly.GetExecutingAssembly().Location);
 }
Example #2
0
        public static float Resources(Tag tag)
        {
            GVD.VersionAlert(false);
            // Works for DLC

            /*
             * if(ClusterManager.Instance.GetAllWorldsAccessibleAmounts().ContainsKey(tag))
             *  return ClusterManager.Instance.GetAllWorldsAccessibleAmounts()[tag];
             * return 0;*/
            // Works for vanilla
            return(WorldInventory.Instance.GetTotalAmount(tag));
        }
Example #3
0
        public static int WorldsWithBeds()
        {
            GVD.VersionAlert(false);
            // Vanilla - default return
            return(0);
            // DLC only code

            /*
             * List<int> UniqueWorldIds = new List<int>();
             * foreach (Sleepable sleepable in Components.Sleepables)
             *  if (!UniqueWorldIds.Contains(sleepable.GetMyWorldId()) && !sleepable.GetMyWorld().IsModuleInterior)
             *      UniqueWorldIds.Add(sleepable.GetMyWorldId());
             *
             * foreach (int i in UniqueWorldIds)
             *  Debug.Log($"Unique sleepable world: {i}");
             *
             * return UniqueWorldIds.Count;*/
        }
            public static void Postfix(ResearchCenter __instance)
            {
                GVD.VersionAlert(false);

                /*
                 * Works vor vanilla
                 * */
                TechInstance activeResearch = Research.Instance.GetActiveResearch();
                Tech         tech           = activeResearch.tech;

                TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id);

                if (req.ContinuousCheck)
                {
                    if (!req.ReqUnlocked())
                    {
                        __instance.StopWork(__instance.worker, true);
                        ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen;
                        researchScreen.CancelResearch();
                        Research.Instance.SetActiveResearch(null, true);
                    }
                }


                /*
                 * Works vor DLC
                 *
                 * TechInstance activeResearch = Research.Instance.GetActiveResearch();
                 * Tech tech = activeResearch.tech;
                 * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id);
                 *
                 * if (req.ContinuousCheck)
                 *  if (!req.ReqUnlocked())
                 *  {
                 *      __instance.StopWork(__instance.worker, true);
                 *      ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue<ResearchScreen>();
                 *      if (researchScreen == null)
                 *          return;
                 *      researchScreen.CancelResearch();
                 *      Research.Instance.SetActiveResearch(null, true);
                 *      Debug.Log("ResearchRequirements: research canceled");
                 *  }
                 */
            }
            public static void Postfix(ResearchCenter __instance)
            {
                //throw new System.NotImplementedException("ResearchCenter_OnWorkTick_Patch - not implemented for DLC");

                /*
                 * Works vor vanilla
                 *
                 * TechInstance activeResearch = Research.Instance.GetActiveResearch();
                 * Tech tech = activeResearch.tech;
                 * TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id);
                 *
                 * if (req.ContinuousCheck)
                 *  if(!req.ReqUnlocked())
                 *  {
                 *      __instance.StopWork(__instance.worker, true);
                 *      ResearchScreen researchScreen = (ResearchScreen)ManagementMenu.Instance.researchScreen;
                 *      researchScreen.CancelResearch();
                 *      Research.Instance.SetActiveResearch(null, true);
                 *  }
                 */
                GVD.VersionAlert(true);

                TechInstance activeResearch = Research.Instance.GetActiveResearch();
                Tech         tech           = activeResearch.tech;

                TechRequirements.TechReq req = TechRequirements.Instance.GetTechReq(tech.Id);

                if (req.ContinuousCheck)
                {
                    if (!req.ReqUnlocked())
                    {
                        __instance.StopWork(__instance.worker, true);
                        ResearchScreen researchScreen = Traverse.Create(ManagementMenu.Instance).Field("researchScreen").GetValue <ResearchScreen>();
                        if (researchScreen == null)
                        {
                            return;
                        }
                        researchScreen.CancelResearch();
                        Research.Instance.SetActiveResearch(null, true);
                        Debug.Log("ResearchRequirements: research canceled");
                    }
                }
            }
Example #6
0
        public static int RevealedSpaceHexes(int radiusMin, int radiusMax)
        {
            GVD.VersionAlert(false);
            // Vanilla - default return
            return(0);
            // DLC only code

            /*
             * int count = 0;
             * ClusterFogOfWarManager.Instance smi = SaveGame.Instance.GetSMI<ClusterFogOfWarManager.Instance>();
             * if (smi == null)
             *  return 0;
             *
             * List<AxialI> ColonisedWorlds = new List<AxialI>();
             * foreach (Sleepable sleepable in Components.Sleepables)
             *  if (!ColonisedWorlds.Contains(sleepable.GetMyWorldLocation()))
             *      ColonisedWorlds.Add(sleepable.GetMyWorldLocation());
             *
             * List<AxialI> HexesMinRad = new List<AxialI>();
             * List<AxialI> HexesMaxRad = new List<AxialI>();
             * List<AxialI> SearchedHexes = new List<AxialI>();
             *
             * foreach(AxialI world in ColonisedWorlds)
             * {
             *  foreach (AxialI hex in AxialUtil.GetAllPointsWithinRadius(world, radiusMin))
             *      if (!HexesMinRad.Contains(hex))
             *          HexesMinRad.Add(hex);
             *
             *  foreach (AxialI hex in AxialUtil.GetAllPointsWithinRadius(world, radiusMax))
             *      if (!HexesMaxRad.Contains(hex))
             *          HexesMaxRad.Add(hex);
             * }
             * foreach (AxialI hex in HexesMaxRad)
             *  if (!HexesMinRad.Contains(hex))
             *      SearchedHexes.Add(hex);
             *
             * foreach (AxialI hex in SearchedHexes)
             *  if (smi.IsLocationRevealed(hex))
             *      count++;
             *
             * return count;*/
        }
 public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active());
     Debug.Log("ResearchRequirements: Loaded DLC version of the mod. Last update: 16.03.2021 for 455509 build.");
     Debug.Log("ResearchRequirements: Loaded from: " + Assembly.GetExecutingAssembly().Location);
 }