示例#1
0
 public static void Postfix(ref string __result, TechType techType)
 {
     if (!CrafterLogic.IsCraftRecipeUnlocked(techType))
     {
         __result = Main.config.UnKnownLabel;
     }
 }
示例#2
0
 public static void Postfix(TechType techType, ref TechUnlockState __result)
 {
     if (Main.config.Hardcore && (__result != TechUnlockState.Available || !CrafterLogic.IsCraftRecipeUnlocked(techType)))
     {
         __result = TechUnlockState.Hidden;
     }
 }
示例#3
0
        public static void Postfix(ITechData data, ref List <TooltipIcon> icons)
        {
            if (data == null)
            {
                return;
            }
            var ingredientCount = data.ingredientCount;

            for (var i = 0; i < ingredientCount; i++)
            {
                var ingredient = data.GetIngredient(i);
                var techType   = ingredient.techType;
                if (!KnownTech.Contains(techType) && PDAScanner.ContainsCompleteEntry(techType))
                {
                    KnownTech.Add(techType);
                    continue;
                }
                if (!CrafterLogic.IsCraftRecipeUnlocked(techType))
                {
                    var icon = icons.Find((TooltipIcon) => TooltipIcon.sprite == SpriteManager.Get(techType) && TooltipIcon.text.Contains(Language.main.GetOrFallback(TooltipFactory.techTypeIngredientStrings.Get(techType), techType)));
                    if (icons.Contains(icon))
                    {
                        icons.Remove(icon);
                        var tooltipIcon = new TooltipIcon()
                        {
                            sprite = SpriteManager.Get(TechType.None), text = Main.Config.UnKnownTitle
                        };
                        icons.Add(tooltipIcon);
                    }
                }
            }
        }
 public static void Postfix(ref bool __result)
 {
     if (Main.config.Hardcore && __result && Builder.prefab != null)
     {
         TechType techType = CraftData.GetTechType(Builder.prefab);
         __result = CrafterLogic.IsCraftRecipeUnlocked(techType);
     }
 }
 private static void UpdatePostfix(LeakingRadiation __instance)
 {
     if (__instance.radiationFixed && !CrafterLogic.IsCraftRecipeUnlocked(DeathRun.filterChip.TechType) && Config.POISONED.Equals(DeathRun.config.surfaceAir))
     {
         PDAEncyclopedia.Add("FilterChip", true);
         KnownTech.Add(DeathRun.filterChip.TechType, true);
         //DeathRun.saveData.playerSave.setCue("FilterChip", 5);
     }
 }
        public static void Postfix(ref StringBuilder sb, TechType techType)
        {
            PDAScanner.EntryData entryData = PDAScanner.GetEntryData(techType);
            if (entryData == null || PDAScanner.ContainsCompleteEntry(techType) || CrafterLogic.IsCraftRecipeUnlocked(techType))
            {
                return;
            }

            sb.Clear();
            TooltipFactory.WriteTitle(sb, Main.config.UnKnownTitle);
            TooltipFactory.WriteDescription(sb, Main.config.UnKnownDescription);
        }
示例#7
0
        public static bool Prefix()
        {
            TechType techType = PDAScanner.scanTarget.techType;

            if (Input.GetMouseButtonDown(2) && CrafterLogic.IsCraftRecipeUnlocked(techType))
            {
#if SUBNAUTICA
                GameObject prefab = CraftData.GetPrefabForTechType(techType);
                Builder.Begin(prefab);
#elif BELOWZERO
                Builder.Begin(techType);
#endif
                return(false);
            }
            return(true);
        }
        public static void Postfix()
        {
            PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget;
            PDAScanner.EntryData  entryData  = PDAScanner.GetEntryData(scanTarget.techType);
            TechType key       = entryData?.key ?? TechType.None;
            TechType blueprint = entryData?.blueprint ?? TechType.None;

            if (scanTarget.techType != TechType.None && CrafterLogic.IsCraftRecipeUnlocked(scanTarget.techType) || (entryData != null && ((blueprint != TechType.None && CrafterLogic.IsCraftRecipeUnlocked(entryData.blueprint)) || (key != TechType.None && CrafterLogic.IsCraftRecipeUnlocked(entryData.key)))) || !scanTarget.isValid || !GameModeUtils.RequiresBlueprints())
            {
                return;
            }
#if SN1
            HandReticle.main.SetInteractText(Main.config.UnKnownLabel, false, HandReticle.Hand.None);
#elif BZ
            HandReticle.main.SetText(HandReticle.TextType.Hand, Main.config.UnKnownLabel, true, GameInput.Button.None);
#endif
        }
        public static void Postfix(ScannerTool __instance)
        {
            PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget;
#if SN1
            PDAScanner.Result result = PDAScanner.CanScan();
#elif BZ
            PDAScanner.Result result = PDAScanner.CanScan(scanTarget);
#endif
            PDAScanner.EntryData entryData = PDAScanner.GetEntryData(PDAScanner.scanTarget.techType);

            if ((entryData != null && (CrafterLogic.IsCraftRecipeUnlocked(entryData.blueprint) || CrafterLogic.IsCraftRecipeUnlocked(entryData.key))) || PDAScanner.ContainsCompleteEntry(scanTarget.techType) || __instance.energyMixin.charge <= 0f || !scanTarget.isValid || result != PDAScanner.Result.Scan || !GameModeUtils.RequiresBlueprints())
            {
                return;
            }
#if SN1
            HandReticle.main.SetInteractText(Main.config.UnKnownLabel, false, HandReticle.Hand.None);
#elif BZ
            HandReticle.main.SetText(HandReticle.TextType.Hand, Main.config.UnKnownLabel, true, GameInput.Button.None);
#endif
        }
示例#10
0
        public static void randomBlueprintUnlock()
        {
            System.Random random = new System.Random();

            TechType[] blueprintTech = { TechType.BaseBioReactor, TechType.RocketBase, TechType.Constructor, TechType.Exosuit, TechType.BaseMoonpool, TechType.BaseNuclearReactor, TechType.PropulsionCannon, TechType.Seamoth, TechType.StasisRifle, TechType.ThermalPlant, TechType.Transfuser, TechType.Workbench, TechType.Techlight, TechType.LEDLight, TechType.CyclopsHullBlueprint, TechType.CyclopsBridgeBlueprint, TechType.CyclopsEngineBlueprint, TechType.CyclopsDockingBayBlueprint, TechType.Seaglide, TechType.Beacon, TechType.BatteryCharger, TechType.BaseObservatory, TechType.FiltrationMachine, TechType.CoffeeVendingMachine, TechType.BaseMapRoom, TechType.BaseLadder };
            int        randomNum     = random.Next(blueprintTech.Length);

            int counter = 0;

            while (CrafterLogic.IsCraftRecipeUnlocked(blueprintTech[randomNum]) && counter < 50)
            {
                randomNum = random.Next(blueprintTech.Length);
                counter++;
            }

            if (CraftData.IsAllowed(blueprintTech[randomNum]) && KnownTech.Add(blueprintTech[randomNum], true))
            {
                ErrorMessage.AddDebug("Unlocked " + Language.main.Get(blueprintTech[randomNum].AsString(false)));
            }
        }
        public static void Postfix(TechType techType, ref bool __result)
        {
            if (Main.config.Hardcore && GameModeUtils.RequiresBlueprints() && __result)
            {
                if (!QModServices.Main.ModPresent("UITweaks"))
                {
                    RecipeData data            = Main.GetData(techType);
                    int        ingredientCount = data?.ingredientCount ?? 0;
                    for (int i = 0; i < ingredientCount; i++)
                    {
                        Ingredient ingredient = data.Ingredients[i];
                        if (!blackList.Contains(techType) && !CrafterLogic.IsCraftRecipeUnlocked(ingredient.techType))
                        {
                            __result = false;
                            return;
                        }
                    }
                }
                else
                {
#if SN1
                    if (CraftData.techData.TryGetValue(techType, out CraftData.TechData data))
                    {
                        int ingredientCount = data?.ingredientCount ?? 0;
                        for (int i = 0; i < ingredientCount; i++)
                        {
                            IIngredient ingredient = data.GetIngredient(i);
                            if (!blackList.Contains(techType) && !CrafterLogic.IsCraftRecipeUnlocked(ingredient.techType))
                            {
                                __result = false;
                                return;
                            }
                        }
                    }
#elif BZ
#endif
                }
            }
        }
        public static bool CanTrack(TechType techType)
        {
            bool locked = !CrafterLogic.IsCraftRecipeUnlocked(techType);

            if (locked)
            {
                //Logger.Error("Can't start tracking " + techType + " because it is locked");
                return(false);
            }
            if (IsTracked(techType))
            {
                //Logger.Error("Can't start tracking " + techType + " because it is already being tracked");
                return(false);
            }
            if (instance.tracked.Count >= Mod.GetMaxPins())
            {
                //Logger.Error("Can't start tracking " + techType + " because we are tracking maximum tech");
                return(false);
            }

            return(true);
        }