Esempio n. 1
0
        private void PatchTechDataEntry()
        {
            CraftDataHandler.SetTechData(TechType, GetBlueprintRecipe());


            if (GroupForPDA != TechGroup.Uncategorized)
            {
                List <TechCategory> categories = new List <TechCategory>();
                CraftData.GetBuilderCategories(GroupForPDA, categories);
                if (categories.Contains(CategoryForPDA))
                {
                    CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType);
                }
                else
                {
                    Logger.Error($"Failed to add {TechType} to {GroupForPDA}/{CategoryForPDA} as it is not a registered combination.");
                }
            }

            if (EncyclopediaEntryData != null)
            {
                PDAEncyclopediaHandler.AddCustomEntry(EncyclopediaEntryData);
            }

            if (!UnlockedAtStart)
            {
                var unlockTech = RequiredForUnlock == TechType.None? this.TechType: RequiredForUnlock;

                KnownTechHandler.SetAnalysisTechEntry(unlockTech, new TechType[1] {
                    TechType
                }, DiscoverMessageResolved);

                if (CompoundTechsForUnlock != null && CompoundTechsForUnlock.Count > 0)
                {
                    KnownTechHandler.SetCompoundUnlock(this.TechType, CompoundTechsForUnlock);
                }

                if (AddScannerEntry)
                {
                    PDAScanner.EntryData entryData = new PDAScanner.EntryData()
                    {
                        key              = unlockTech,
                        blueprint        = TechType,
                        destroyAfterScan = DestroyFragmentOnScan,
                        isFragment       = true,
                        locked           = true,
                        scanTime         = TimeToScanFragment,
                        totalFragments   = FragmentsToScan
                    };

                    if (EncyclopediaEntryData != null)
                    {
                        entryData.encyclopedia = EncyclopediaEntryData.key;
                    }
                    PDAHandler.AddCustomScannerEntry(entryData);
                }
            }
        }