public static void Postfix()
        {
            if (PDAScanner.ContainsCompleteEntry(techType) || KnownTech.Contains(techType))
            {
                if (techType == TechType.ScrapMetal && !KnownTech.Contains(TechType.Titanium))
                {
                    PDAScanner.AddByUnlockable(TechType.Titanium, 1);
                    KnownTech.Add(TechType.Titanium);
                }

                if (!KnownTech.Contains(techType))
                {
                    KnownTech.Add(techType);
                }

                var entryData = PDAScanner.GetEntryData(techType);

                if (entryData != null && entryData.locked)
                {
                    PDAScanner.Unlock(entryData, true, true);

                    if (!KnownTech.Contains(entryData.blueprint))
                    {
                        KnownTech.Add(entryData.blueprint);
                    }
                }
#if SN1
                var techType2 = CraftData.GetHarvestOutputData(techType);
#elif BZ
                var techType2 = TechData.GetHarvestOutput(techType);
#endif
                if (techType2 != TechType.None)
                {
                    if (!KnownTech.Contains(techType2))
                    {
                        KnownTech.Add(techType2);
                    }

                    var entryData2 = PDAScanner.GetEntryData(techType2);
                    if (entryData2 != null && entryData2.locked)
                    {
                        PDAScanner.Unlock(entryData, true, true);

                        if (!KnownTech.Contains(entryData2.blueprint))
                        {
                            KnownTech.Add(entryData2.blueprint);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void Postfix(Pickupable pickupable)
        {
            if (newgame && Main.config.Hardcore && !Utils.GetContinueMode() && pickupable.GetTechType() != TechType.FireExtinguisher)
            {
                CoroutineHost.StartCoroutine(GiveHardcoreScanner());
                newgame = false;
                SMLHelper.V2.Handlers.IngameMenuHandler.RegisterOnQuitEvent(() => newgame = true);
            }

            TechType techType = pickupable.GetTechType();

            PDAScanner.EntryData entryData  = PDAScanner.GetEntryData(techType);
            GameObject           gameObject = pickupable.gameObject;

            if (Main.config.ScanOnPickup && Inventory.main.container.Contains(TechType.Scanner) && entryData != null)
            {
                if (!PDAScanner.GetPartialEntryByKey(techType, out PDAScanner.Entry entry))
                {
                    entry = PDAScanner.Add(techType, 1);
                }
                if (entry != null)
                {
                    PDAScanner.partial.Remove(entry);
                    PDAScanner.complete.Add(entry.techType);
                    PDAScanner.NotifyRemove(entry);
                    PDAScanner.Unlock(entryData, true, true, true);
                    KnownTech.Add(techType, false);
                    if (gameObject != null)
                    {
                        gameObject.SendMessage("OnScanned", null, SendMessageOptions.DontRequireReceiver);
                    }
#if SN1
                    ResourceTracker.UpdateFragments();
#endif
                }
            }

            if (!Main.config.Hardcore && entryData == null)
            {
                KnownTech.Add(techType, true);
            }
        }