Пример #1
0
        public void Load()
        {
            var assembly = Assembly.GetExecutingAssembly();

            new Harmony($"DaWrecka_{assembly.GetName().Name}").PatchAll(assembly);
            foreach (string s in new HashSet <string>()
            {
                "Gravsphere", "GravTrapMk2"
            })
            {
                TechType tt = TechTypeUtils.GetTechType(s);
                if (tt == TechType.None)
                {
                    Log.LogWarning($"Could not retrieve TechType for string {s}");
                }
                else
                {
                    var classid = CraftData.GetClassIdForTechType(TechType.Gravsphere);
                    if (WorldEntityDatabase.TryGetInfo(classid, out var worldEntityInfo))
                    {
                        worldEntityInfo.cellLevel = LargeWorldEntity.CellLevel.Global;

                        WorldEntityDatabase.main.infos[classid] = worldEntityInfo;
                    }
                }
            }
        }
        private static float fActiveModeHealthRegenMultiplier    = 5f; // Health regeneration is multiplied by this amount in active mode


        protected void Start()
        {
            string RCFilename;

            if (thermalReactorCharge is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Exosuit), out RCFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(RCFilename).Completed += (x) =>
                {
                    GameObject gameObject1 = x.Result;
                    Exosuit    exosuit     = gameObject1?.GetComponent <Exosuit>();
                    thermalReactorCharge = exosuit?.thermalReactorCharge;
                };
            }

            if (sonarSound is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Seamoth), out RCFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(RCFilename).Completed += (x) =>
                {
                    GameObject gameObject1 = x.Result;
                    SeaMoth    seamoth     = gameObject1?.GetComponent <SeaMoth>();
                    if (seamoth?.sonarSound != null)
                    {
                        sonarSound = this.gameObject.AddComponent <FMOD_CustomEmitter>();
                        sonarSound.SetAsset(seamoth.sonarSound.asset);
                        sonarSound.UpdateEventAttributes();
                    }
                    foreach (var r in gameObject1.GetComponentsInChildren <Renderer>())
                    {
                    }
                };
            }
        }
Пример #3
0
        public override GameObject GetGameObject()
        {
            if (PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Seamoth), out string seamothFileName))
            {
                GameObject prefab     = Resources.Load <GameObject>(seamothFileName);
                GameObject gameObject = GameObject.Instantiate(prefab);
                prefab.SetActive(false);
                gameObject.SetActive(false);

                SeaMoth seaMoth = gameObject.GetComponent <SeaMoth>();

                SeamothCloneBehaviour seamothCloneBehaviour = gameObject.EnsureComponent <SeamothCloneBehaviour>();

                typeof(SeaMoth).GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Static).ForEach((x) => { try { x.SetValue(seamothCloneBehaviour, x.GetValue(seaMoth)); } catch { } });

                seamothCloneBehaviour.energyInterface = seaMoth.energyInterface;

                GameObject.DestroyImmediate(seaMoth);

                gameObject.SetActive(true);
                return(gameObject);
            }

            return(GameObject.CreatePrimitive(PrimitiveType.Cube));
        }
Пример #4
0
        private WorldEntityInfo GetEntityInfo()
        {
            WorldEntityInfo newEntityInfo;

            if (WorldEntityDatabase.TryGetInfo(CraftData.GetClassIdForTechType(TechType.Seamoth), out WorldEntityInfo entityInfo))
            {
                newEntityInfo = new WorldEntityInfo()
                {
                    cellLevel  = entityInfo.cellLevel,
                    classId    = this.ClassID,
                    localScale = entityInfo.localScale,
                    prefabZUp  = entityInfo.prefabZUp,
                    slotType   = entityInfo.slotType,
                    techType   = this.TechType
                };

                return(newEntityInfo);
            }

            newEntityInfo = new WorldEntityInfo()
            {
                cellLevel  = LargeWorldEntity.CellLevel.Global,
                classId    = this.ClassID,
                localScale = Vector3.one,
                prefabZUp  = false,
                slotType   = EntitySlot.Type.Medium,
                techType   = this.TechType
            };

            return(newEntityInfo);
        }
Пример #5
0
        public static void Load()
        {
            Harmony.CreateAndPatchAll(assembly, $"MrPurple6411_{assembly.GetName().Name}");
            var classid = CraftData.GetClassIdForTechType(TechType.TimeCapsule);

            if (WorldEntityDatabase.TryGetInfo(classid, out var worldEntityInfo))
            {
                worldEntityInfo.cellLevel = LargeWorldEntity.CellLevel.VeryFar;

                WorldEntityDatabase.main.infos[classid] = worldEntityInfo;
            }
        }
Пример #6
0
        public override GameObject GetGameObject()
        {
            string classid = CraftData.GetClassIdForTechType(TechType.VehicleArmorPlating);

            if (PrefabDatabase.TryGetPrefabFilename(classid, out string filename))
            {
                var prefab = Resources.Load <GameObject>(filename);
                var obj    = GameObject.Instantiate(prefab);

                // Get the TechTags and PrefabIdentifiers
                var techTag          = obj.EnsureComponent <TechTag>();
                var prefabIdentifier = obj.GetComponent <PrefabIdentifier>();

                // Change them so they fit to our requirements.
                techTag.type             = TechType;
                prefabIdentifier.ClassId = ClassID;

                return(obj);
            }
            return(null);

            /*
             * // Get the ElectricalDefense module prefab and instantiate it
             * var path = "WorldEntities/Tools/Compass";
             * var prefab = Resources.Load<GameObject>(path);
             * var obj = GameObject.Instantiate(prefab);
             *
             * // Get the TechTags and PrefabIdentifiers
             * var techTag = obj.GetComponent<TechTag>();
             * var prefabIdentifier = obj.GetComponent<PrefabIdentifier>();
             *
             * // Change them so they fit to our requirements.
             * techTag.type = TechType;
             * prefabIdentifier.ClassId = ClassID;
             *
             * var pick = obj.GetComponent<Pickupable>();
             * if (pick == null)
             * {
             *  CattleLogger.Message("Pickupable is Null");
             * } else
             * {
             *  if (pick.AllowedToPickUp())
             *  {
             *      CattleLogger.Message("Allowed to pick up");
             *  } else
             *  {
             *      CattleLogger.Message("NOT Allowed to pick up");
             *  }
             * }
             *
             * return obj;
             */
        }
Пример #7
0
        internal List <BiomeData> GetBiomeData()
        {
            if (this.TechToCopy != TechType.None && !BiomeData.Any())
            {
                // This will load the games distribution data and then return the biome distribution list for the techtype you tried to copy from if it has one.
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                if (data.GetPrefabData(CraftData.GetClassIdForTechType(TechToCopy), out SrcData srcData))
                {
                    return(srcData.distribution);
                }
            }

            return(BiomeData ?? new List <BiomeData>());
        }
        protected void Start()
        {
#pragma warning disable CS0612 // Type or member is obsolete
            if (repulsionCannonFireSound is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.RepulsionCannon), out var RCFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(RCFilename).Completed += (x) =>
                {
                    var gameObject1 = x.Result;
                    var component   = gameObject1?.GetComponent <RepulsionCannon>();
                    repulsionCannonFireSound = component?.shootSound;
                };
            }

            if ((stasisRifleFireSound is null || stasisRifleEvent is null) && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.StasisRifle), out var SRFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(SRFilename).Completed += (x) =>
                {
                    var gameObject2 = x.Result;
                    var component2  = gameObject2?.GetComponent <StasisRifle>();
                    stasisRifleFireSound = component2?.fireSound;
                    stasisRifleEvent     = component2?.chargeBegin;
                };
            }

            if (modeChangeSound is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.PropulsionCannon), out var PCFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(PCFilename).Completed += (x) =>
                {
                    var gameObject3 = x.Result;
                    var component3  = gameObject3?.GetComponent <PropulsionCannon>();
                    modeChangeSound = component3?.shootSound;
                };
            }

            if (laserShootSound is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Welder), out var WFilename))
            {
                AddressablesUtility.LoadAsync <GameObject>(WFilename).Completed += (x) =>
                {
                    var gameObject4 = x.Result;
                    var component4  = gameObject4?.GetComponent <Welder>();
                    laserShootSound = component4?.weldSound;
                };
            }
#pragma warning restore CS0612 // Type or member is obsolete

            laserEndParticleSystem = LaserParticles.transform.Find("Laserend").gameObject.GetComponent <ParticleSystem>();
            scaleParticleSystem    = LaserParticles.transform.Find("scale").GetComponent <ParticleSystem>();
        }
        protected void Start()
        {
            if (repulsionCannonFireSound is null)
            {
                if (PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.RepulsionCannon), out var RCFilename))
                {
                    var gameObject1 = Resources.Load <GameObject>(RCFilename);
                    var component   = gameObject1.GetComponent <RepulsionCannon>();
                    repulsionCannonFireSound = component.shootSound;
                    gameObject1.SetActive(false);
                }

                if (PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.StasisRifle), out var SRFilename))
                {
                    var gameObject2 = Resources.Load <GameObject>(SRFilename);
                    var component2  = gameObject2.GetComponent <StasisRifle>();
                    stasisRifleFireSound = component2.fireSound;
                    stasisRifleEvent     = component2.chargeBegin;
                    gameObject2.SetActive(false);
                }

                if (PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.PropulsionCannon), out var PCFilename))
                {
                    var gameObject3 = Resources.Load <GameObject>(PCFilename);
                    var component3  = gameObject3.GetComponent <PropulsionCannon>();
                    modeChangeSound = component3.shootSound;
                    gameObject3.SetActive(false);
                }

                if (PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Welder), out var WFilename))
                {
                    var gameObject4 = Resources.Load <GameObject>(WFilename);
                    var component4  = gameObject4.GetComponent <Welder>();
                    laserShootSound = component4.weldSound;
                    gameObject4.SetActive(false);
                }

                Transform transform1;
                laserEndParticleSystem = LaserParticles.transform.Find("Laserend").gameObject.GetComponent <ParticleSystem>();
                scaleParticleSystem    = LaserParticles.transform.Find("scale").GetComponent <ParticleSystem>();
            }
            else
            {
                rigidbody.detectCollisions = true;
            }
        }
        private static void CreateButtonPrefab()
        {
            GameObject prefab  = null;
            string     classId = CraftData.GetClassIdForTechType(TechType.SmallLocker);

            string logtmp = ("InLine CreateButton Prefab - MrPurple6411 way - " + classId);

            QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Warn, logtmp);

            string filename;

            if (PrefabDatabase.TryGetPrefabFilename(classId, out filename))
            {
                QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Warn, "InLine CreateButton Prefab - MrPurple6411 way - trygetprefabfilename");
                prefab = Resources.Load <GameObject>(filename);
                Mod.PrintObject(prefab, "asdf1234");
            }
            else
            {
                QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Warn, "InLine CreateButton Prefab - MrPurple6411 way - bad 1");
            }

            if (prefab != null)
            {
                /*
                 *                              GameObject smallLocker = Resources.Load<GameObject>("Submarine/Build/SmallLocker.prefab");
                 *                              //QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Warn, "InLine CreateButton Prefab - DEV Step 02");
                 *                                      //Mod.PrintObject(smallLocker, "asdf1234"); //Thats the Problem for the Null Reference Error
                 *                              QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Warn, "InLine CreateButton Prefab - DEV Step 02-01");
                 */

                var signInput = prefab.GetComponentInChildren <uGUI_SignInput>();
                var original  = signInput.transform.GetChild(1).gameObject.GetComponent <Button>();
                buttonPrefab = GameObject.Instantiate(original);
                var go = buttonPrefab.gameObject;
                GameObject.DestroyImmediate(buttonPrefab);
                buttonPrefab               = go.AddComponent <Button>();
                buttonPrefab.transition    = original.transition;
                buttonPrefab.targetGraphic = go.GetComponentInChildren <Image>();
                buttonPrefab.colors        = original.colors;
                go.SetActive(true);
            }
        }
Пример #11
0
        public void Awake()
        {
            if (completeSound is null && PrefabDatabase.TryGetPrefabFilename(CraftData.GetClassIdForTechType(TechType.Builder), out var BuilderFilename))
            {
#if SUBNAUTICA_STABLE
                var builderPrefab = Resources.Load <GameObject>(BuilderFilename).GetComponent <BuilderTool>();
                completeSound = Instantiate(builderPrefab.completeSound, gameObject.transform);
#else
                AddressablesUtility.LoadAsync <GameObject>(BuilderFilename).Completed += (x) =>
                {
                    var gameObject1   = x.Result;
                    var builderPrefab = gameObject1 != null?gameObject1.GetComponent <BuilderTool>() : null;

                    if (builderPrefab is not null)
                    {
                        completeSound = Instantiate(builderPrefab.completeSound, gameObject.transform);
                    }
                };
#endif
            }
        }
Пример #12
0
        public static void Load()
        {
            LootDistributionData data       = LootDistributionData.Load("Balance/EntityDistributions");
            List <TechType>      Drillables = Enum.GetValues(typeof(TechType)).OfType <TechType>().Where((tt) => tt.AsString().Contains("Drillable")).ToList();

            data.GetPrefabData(CraftData.GetClassIdForTechType(TechType.DrillableUranium), out SrcData UraniumData);
            foreach (TechType techType in Drillables)
            {
                string classId = CraftData.GetClassIdForTechType(techType);

                if (CraftData.GetPrefabForTechType(techType, false) == null)
                {
                    continue;
                }

                if (WorldEntityDatabase.TryGetInfo(classId, out WorldEntityInfo info))
                {
                    if (!data.GetPrefabData(classId, out SrcData srcData))
                    {
                        SMLHelper.V2.Handler.LootDistributionHandler.AddLootDistributionData(classId, UraniumData);
                    }
                }
            }
        }
Пример #13
0
        private static void InventoryAndWaterParkSetup()
        {
            // Setting a name for the Rockgrub
            LanguageHandler.SetTechTypeName(TechType.Rockgrub, "Rockgrub");
            // Setting a Tooltip for the Rockgrub
            LanguageHandler.SetTechTypeTooltip(TechType.Rockgrub, "A small, luminescent scavenger");

            // Setting a Sprite for the Rockgrub
            Sprite rockgrub = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "RockGrub.png"));

            if (rockgrub != null)
            {
                SpriteHandler.RegisterSprite(TechType.Rockgrub, rockgrub);
            }
            // Setting Rockgrub's size in the Inventory
            CraftDataHandler.SetItemSize(TechType.Rockgrub, new Vector2int(1, 1));
            // Setting WPC Parameters for Rockgrub so it can grow and breed normaly
            WaterParkCreature.waterParkCreatureParameters[TechType.Rockgrub] = new WaterParkCreatureParameters(0.03f, 0.7f, 1f, 1f);
            // Setting Fuel value for the Rockgrub
            BioReactorHandler.SetBioReactorCharge(TechType.Rockgrub, 350f);
            // Totally origina.. *cough* taken from MrPurple's CYS code
            #region BiomeData stuff
            Dictionary <TechType, List <BiomeData> > rockgrubBiomeData = new Dictionary <TechType, List <BiomeData> >()
            {
                {
                    TechType.Rockgrub,
                    new List <BiomeData>()
                    {
                        new BiomeData()
                        {
                            biome       = BiomeType.SafeShallows_CaveSpecial,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.GrassyPlateaus_CaveCeiling,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.MushroomForest_CaveRecess,
                            count       = 5,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.MushroomForest_CaveSpecial,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.MushroomForest_GiantTreeInteriorRecess,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.MushroomForest_GiantTreeInteriorSpecial,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.KooshZone_CaveWall,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.SparseReef_DeepWall,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.GrassyPlateaus_CaveCeiling,
                            count       = 3,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.Dunes_Rock,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.Dunes_SandPlateau,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.Dunes_CaveCeiling,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.Dunes_CaveWall,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.Mountains_CaveWall,
                            count       = 4,
                            probability = 1f
                        },
                        new BiomeData()
                        {
                            biome       = BiomeType.GrassyPlateaus_CaveFloor,
                            count       = 4,
                            probability = 1f
                        },
                    }
                }
            };
            foreach (KeyValuePair <TechType, List <BiomeData> > pair in rockgrubBiomeData)
            {
                string classId = CraftData.GetClassIdForTechType(pair.Key) ?? pair.Key.AsString();
                if (PrefabDatabase.TryGetPrefabFilename(classId, out string prefabpath))
                {
                    if (!WorldEntityDatabase.TryGetInfo(classId, out WorldEntityInfo info))
                    {
                        info = new WorldEntityInfo()
                        {
                            cellLevel  = LargeWorldEntity.CellLevel.Medium,
                            classId    = classId,
                            localScale = UnityEngine.Vector3.one,
                            prefabZUp  = false,
                            slotType   = EntitySlot.Type.Medium,
                            techType   = pair.Key
                        };
                    }
                    WorldEntityDatabaseHandler.AddCustomInfo(classId, info);
                }
                SrcData data = new SrcData()
                {
                    prefabPath = prefabpath, distribution = pair.Value
                };
                LootDistributionHandler.AddLootDistributionData(classId, data);
            }
            #endregion
        }
Пример #14
0
        public static void Patch()
        {
            assetBundle = ECCHelpers.LoadAssetBundleFromAssetsFolder(Assembly.GetExecutingAssembly(), "deextinctionassets");
            ECCAudio.RegisterClips(assetBundle);

            clownPincherSpecialEdible = (EcoTargetType)531513; //Just a random value. Please don't copy this! It will cause incompatibility. Thanks.

            MakeItemClownPincherEdible("WorldEntities/Natural/SeaTreaderPoop");
            MakeItemClownPincherEdible("WorldEntities/Eggs/StalkerEgg");

            #region Creatures

            stellarThalassacean = new StellarThalassaceanPrefab("StellarThalassacean", "Stellar thalassacean", "Large filter feeder, raised in containment.", assetBundle.LoadAsset <GameObject>("StellarThalassaceanPrefab"), assetBundle.LoadAsset <Texture2D>("Stellar_Item"));
            stellarThalassacean.Patch();

            jasperThalassacean = new JasperThalassaceanPrefab("JasperThalassacean", "Jasper thalassacean", "Large cave-dwelling filter feeder, raised in containment.", assetBundle.LoadAsset <GameObject>("JasperThalassaceanPrefab"), assetBundle.LoadAsset <Texture2D>("Jasper_Item"));
            jasperThalassacean.Patch();

            grandGlider = new GrandGliderPrefab("GrandGlider", "Grand glider", "Medium sized prey animal, raised in containment.", assetBundle.LoadAsset <GameObject>("GrandGliderPrefab"), assetBundle.LoadAsset <Texture2D>("GrandGlider_Item"));
            grandGlider.Patch();

            gulper = new GulperPrefab("GulperLeviathan", "Gulper leviathan", "Leviathan-class predator with a huge mouth.", assetBundle.LoadAsset <GameObject>("Gulper_Prefab"), assetBundle.LoadAsset <Texture2D>("Gulper_ScannerRoom"));
            gulper.Patch();

            axetail = new AxetailPrefab("Axetail", "Axetail", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("Axetail_Prefab"), assetBundle.LoadAsset <Texture2D>("Axetail_Item"));
            axetail.Patch();

            ribbonRay = new RibbonRayPrefab("RibbonRay", "Ribbon ray", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("RibbonRay_Prefab"), assetBundle.LoadAsset <Texture2D>("RibbonRay_Item"));
            ribbonRay.Patch();

            twisteel = new TwisteelPrefab("Twisteel", "Twisteel", "Thin eel-like organism, raised in containment.", assetBundle.LoadAsset <GameObject>("Twisteel_Prefab"), assetBundle.LoadAsset <Texture2D>("Twisteel_Item"));
            twisteel.Patch();

            filtorb = new FiltorbPrefab("Filtorb", "Filtorb", "Small, filter feeding organism.", assetBundle.LoadAsset <GameObject>("Filtorb_Prefab"), assetBundle.LoadAsset <Texture2D>("Filtorb_Item"));
            filtorb.Patch();

            jellySpinner = new JellySpinnerPrefab("JellySpinner", "Jelly spinner", "Small organism.", assetBundle.LoadAsset <GameObject>("JellySpinner_Prefab"), assetBundle.LoadAsset <Texture2D>("JellySpinner_Item"));
            jellySpinner.Patch();

            triangleFish = new TrianglefishPrefab("TriangleFish", "Trianglefish", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("Trianglefish_Prefab"), assetBundle.LoadAsset <Texture2D>("Trianglefish_Item"));
            triangleFish.Patch();

            #region ClownPinchers
            rubyClownPincher = new ClownPincherRuby("RubyClownPincher", "Ruby clown pincher", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("RCP_Prefab"), assetBundle.LoadAsset <Texture2D>("RCP_Item"));
            rubyClownPincher.Patch();

            sapphireClownPincher = new ClownPincherSapphire("SapphireClownPincher", "Sapphire clown pincher", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("SCP_Prefab"), assetBundle.LoadAsset <Texture2D>("SCP_Item"));
            sapphireClownPincher.Patch();

            emeraldClownPincher = new ClownPincherEmerald("EmeraldClownPincher", "Emerald clown pincher", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("ECP_Prefab"), assetBundle.LoadAsset <Texture2D>("ECP_Item"));
            emeraldClownPincher.Patch();

            amberClownPincher = new ClownPincherAmber("AmberClownPincher", "Amber clown pincher", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("ACP_Prefab"), assetBundle.LoadAsset <Texture2D>("ACP_Item"));
            amberClownPincher.Patch();

            citrineClownPincher = new ClownPincherCitrine("CitrineClownPincher", "Citrine clown pincher", "Small, edible prey fish.", assetBundle.LoadAsset <GameObject>("CCP_Prefab"), assetBundle.LoadAsset <Texture2D>("CCP_Item"));
            citrineClownPincher.Patch();
            #endregion

            #endregion

            #region Eggs

            stellarEgg = new StellarThalassaceanEggPrefab("StellarThalassaceanEgg", "Stellar Thalassacean Egg", "Stellar Thallasaceans hatch from these.", assetBundle.LoadAsset <GameObject>("StellarThalassaceanEggPrefab"), stellarThalassacean.TechType, assetBundle.LoadAsset <Texture2D>("StellarThalassaceanEgg_Icon"), 2f);
            stellarEgg.Patch();

            jasperEgg = new JasperThalassaceanEggPrefab("JasperThalassaceanEgg", "Jasper Thalassacean Egg", "Jasper Thallasaceans hatch from these.", assetBundle.LoadAsset <GameObject>("JasperThalassaceanEggPrefab"), jasperThalassacean.TechType, assetBundle.LoadAsset <Texture2D>("JasperThalassaceanEgg_Icon"), 2f);
            jasperEgg.Patch();

            grandGliderEgg = new GrandGliderEggPrefab("GrandGliderEgg", "Grand Glider Egg", "Grand Gliders hatch from these.", assetBundle.LoadAsset <GameObject>("GGEggPrefab"), grandGlider.TechType, assetBundle.LoadAsset <Texture2D>("GGEgg_Item"), 1f);
            grandGliderEgg.Patch();

            twisteelEgg = new TwisteelEggPrefab("TwisteelEgg", "Twisteel Egg", "Twisteels hatch from these", assetBundle.LoadAsset <GameObject>("TwisteelEgg_Prefab"), twisteel.TechType, assetBundle.LoadAsset <Texture2D>("TwisteelEgg_Item"), 1.5f);
            twisteelEgg.Patch();

            #endregion

            #region Edibles
            rcpCooked = new EatableAsset("CookedRubyClownPincher", "Cooked ruby clown pincher", "1,219 Scoville Heat Unit meal.", assetBundle.LoadAsset <GameObject>("RCP_Prefab"), rubyClownPincher.TechType, new EatableData(true, 30f, 9f, true), false, assetBundle.LoadAsset <Texture2D>("RCP_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("RCP_Popup"));
            rcpCooked.Patch();
            rcpCured = new EatableAsset("CuredRubyClownPincher", "Cured ruby clown pincher", "Tastes like igneous. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("RCP_Prefab"), rubyClownPincher.TechType, new EatableData(true, 30f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("RCP_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("RCP_Popup"));
            rcpCured.Patch();

            scpCooked = new EatableAsset("CookedSapphireClownPincher", "Cooked sapphire clown pincher", "The slime enhances flavor.", assetBundle.LoadAsset <GameObject>("SCP_Prefab"), sapphireClownPincher.TechType, new EatableData(true, 30f, 9f, true), false, assetBundle.LoadAsset <Texture2D>("SCP_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("SCP_Popup"));
            scpCooked.Patch();
            scpCured = new EatableAsset("CuredSapphireClownPincher", "Cured sapphire clown pincher", "Tastes like milk. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("SCP_Prefab"), sapphireClownPincher.TechType, new EatableData(true, 30f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("SCP_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("SCP_Popup"));
            scpCured.Patch();

            ecpCooked = new EatableAsset("CookedEmeraldClownPincher", "Cooked emerald clown pincher", "Pre-sautéed.", assetBundle.LoadAsset <GameObject>("ECP_Prefab"), emeraldClownPincher.TechType, new EatableData(true, 30f, 9f, true), false, assetBundle.LoadAsset <Texture2D>("ECP_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("ECP_Popup"));
            ecpCooked.Patch();
            ecpCured = new EatableAsset("CuredEmeraldClownPincher", "Cured emerald clown pincher", "Tastes like lettuce. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("ECP_Prefab"), emeraldClownPincher.TechType, new EatableData(true, 30f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("ECP_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("ECP_Popup"));
            ecpCured.Patch();

            acpCooked = new EatableAsset("CookedAmberClownPincher", "Cooked amber clown pincher", "Not the worst tasting thing on the planet.", assetBundle.LoadAsset <GameObject>("ACP_Prefab"), amberClownPincher.TechType, new EatableData(true, 30f, 9f, true), false, assetBundle.LoadAsset <Texture2D>("ACP_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("ACP_Popup"));
            acpCooked.Patch();
            acpCured = new EatableAsset("CuredAmberClownPincher", "Cured amber clown pincher", "Tastes like radish. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("ACP_Prefab"), amberClownPincher.TechType, new EatableData(true, 30f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("ACP_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("ACP_Popup"));
            acpCured.Patch();

            ccpCooked = new EatableAsset("CookedCitrineClownPincher", "Cooked citrine clown pincher", "The secret is in the claws.", assetBundle.LoadAsset <GameObject>("CCP_Prefab"), citrineClownPincher.TechType, new EatableData(true, 30f, 9f, true), false, assetBundle.LoadAsset <Texture2D>("CCP_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("CCP_Popup"));
            ccpCooked.Patch();
            ccpCured = new EatableAsset("CuredCitrineClownPincher", "Cured citrine clown pincher", "Tastes like potatoes. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("CCP_Prefab"), citrineClownPincher.TechType, new EatableData(true, 30f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("CCP_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("CCP_Popup"));
            ccpCured.Patch();

            axetailCooked = new EatableAsset("CookedAxetail", "Cooked axetail", "A sharp taste. Somewhat hydrating.", assetBundle.LoadAsset <GameObject>("Axetail_Prefab"), axetail.TechType, new EatableData(true, 20f, 13f, true), false, assetBundle.LoadAsset <Texture2D>("Axetail_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("Axetail_Popup"));
            axetailCooked.Patch();
            axetailCured = new EatableAsset("CuredAxetail", "Cured axetail", "Eat around the pointy bits. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("Axetail_Prefab"), axetail.TechType, new EatableData(true, 20f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("Axetail_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("Axetail_Popup"));
            axetailCured.Patch();

            ribbonRayCooked = new EatableAsset("CookedRibbonRay", "Cooked ribbon ray", "A hefty meal.", assetBundle.LoadAsset <GameObject>("RibbonRay_Prefab"), ribbonRay.TechType, new EatableData(true, 36f, 7f, true), false, assetBundle.LoadAsset <Texture2D>("RibbonRay_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("RibbonRay_Popup"));
            ribbonRayCooked.Patch();
            ribbonRayCured = new EatableAsset("CuredRibbonRay", "Cured ribbon ray", "Rubbery and stringy. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("RibbonRay_Prefab"), ribbonRay.TechType, new EatableData(true, 36f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("RibbonRay_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("RibbonRay_Popup"));
            ribbonRayCured.Patch();

            filtorbCooked = new EatableAsset("CookedFiltorb", "Cooked filtorb", "Juicy.", assetBundle.LoadAsset <GameObject>("Filtorb_Prefab"), filtorb.TechType, new EatableData(true, 5f, 20f, true), false, assetBundle.LoadAsset <Texture2D>("Filtorb_Cooked"), ItemSoundsType.StillSuitWater, assetBundle.LoadAsset <Sprite>("Filtorb_Popup"));
            filtorbCooked.Patch();
            filtorbCured = new EatableAsset("CuredFiltorb", "Cured filtorb", "Chalky. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("Filtorb_Prefab"), filtorb.TechType, new EatableData(true, 5f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("Filtorb_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("Filtorb_Popup"));
            filtorbCured.Patch();

            jellySpinnerCooked = new EatableAsset("CookedJellySpinner", "Cooked jelly spinner", "Pops in your mouth.", assetBundle.LoadAsset <GameObject>("JellySpinner_Prefab"), jellySpinner.TechType, new EatableData(true, 9f, 2f, true), false, assetBundle.LoadAsset <Texture2D>("JellySpinner_Cooked"), ItemSoundsType.StillSuitWater, assetBundle.LoadAsset <Sprite>("JellySpinner_Popup"));
            jellySpinnerCooked.Patch();
            jellySpinnerCured = new EatableAsset("CuredJellySpinner", "Cured jelly spinner", "Like eating bubble wrap. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("JellySpinner_Prefab"), jellySpinner.TechType, new EatableData(true, 9f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("JellySpinner_Cured"), ItemSoundsType.StillSuitWater, assetBundle.LoadAsset <Sprite>("JellySpinner_Popup"));
            jellySpinnerCured.Patch();

            trianglefishCooked = new EatableAsset("CookedTriangleFish", "Cooked trianglefish", "Small yet filling.", assetBundle.LoadAsset <GameObject>("Trianglefish_Prefab"), triangleFish.TechType, new EatableData(true, 22f, 3f, true), false, assetBundle.LoadAsset <Texture2D>("Trianglefish_Cooked"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("Trianglefish_Popup"));
            trianglefishCooked.Patch();
            trianglefishCured = new EatableAsset("CuredTriangleFish", "Cured trianglefish", "Unusually crunchy. Dehydrating, but keeps well.", assetBundle.LoadAsset <GameObject>("Trianglefish_Prefab"), triangleFish.TechType, new EatableData(true, 22f, -2f, false), true, assetBundle.LoadAsset <Texture2D>("Trianglefish_Cured"), ItemSoundsType.Default, assetBundle.LoadAsset <Sprite>("Trianglefish_Popup"));
            trianglefishCured.Patch();
            #endregion

            const float gulperSpawnDistance = 125f;
            //Mountains
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(1169, -370, 903), "Mountains+KooshGulper", gulperSpawnDistance));
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(1400, -348, 1281), "Mountains+KooshGulper2", gulperSpawnDistance));

            //Underwater islands
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-72, -300, 867), "UWIGulper1", gulperSpawnDistance));
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-174, -460, 1070), "UWIGulper2", gulperSpawnDistance));
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-49, -308, 1184), "Mountains+UWIGulper", gulperSpawnDistance));
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-265, -287, 1118), "BK+UWIGulper", gulperSpawnDistance));

            //Shallow
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-717, -100, -1088), "FloatingIslandGulper", gulperSpawnDistance));

            //Blood kelp
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-573, -448, 1311), "Lifepod2Gulper", gulperSpawnDistance));
            StaticCreatureSpawns.RegisterStaticSpawn(new StaticSpawn(gulper, new Vector3(-970, -216, -509), "BKTGulper", gulperSpawnDistance));

            Harmony harmony = new Harmony("Lee23.DeExtinctionMod");

            FixSpikeTrap();

            string bonesharkClassId         = CraftData.GetClassIdForTechType(TechType.BoneShark);
            string bloomPlanktonClassId     = CraftData.GetClassIdForTechType(TechType.Bloom);
            string mohawkClassId            = CraftData.GetClassIdForTechType(TechType.Mohawk);
            string jellyrayPrefab           = CraftData.GetClassIdForTechType(TechType.Jellyray);
            string plantMiddle11ClassId     = "a4ad13d2-8f28-4b0b-abb3-d51cc4271d7a";
            string reefbackCoral01ClassId   = "a711c0fa-f31e-4426-9164-a9a65557a9a2";
            string breakableBarnacleClassId = "31ccc496-c26b-4ed9-8e86-3334582d8d5b";
            string barnacleClusterId        = "73658f8a-7f66-404e-a645-466bc604e15b";
            string drillableSulphurId       = "697beac5-e39a-4809-854d-9163da9f997e";
            string drillableRubyId          = "109bbd29-c445-4ad8-a4bf-be7bc6d421d6";
            string drillableDiamondId       = "e7c097ac-e7be-4808-aaaa-70178d96f68b";
            string whiteCaveCrawler         = "7ce2ca9d-6154-4988-9b02-38f670e741b8";
            string grandReefCrystal         = "d0be2a21-7134-4641-a058-20e9da4a9b37";
            LootDistributionHandler.EditLootDistributionData(bonesharkClassId, BiomeType.UnderwaterIslands_OpenDeep_CreatureOnly, 0f, 0);
            LootDistributionHandler.EditLootDistributionData(bonesharkClassId, BiomeType.UnderwaterIslands_ValleyFloor, 0f, 0);
            LootDistributionHandler.EditLootDistributionData(bonesharkClassId, BiomeType.UnderwaterIslands_IslandSides, 0f, 0);
            LootDistributionHandler.EditLootDistributionData(bonesharkClassId, BiomeType.UnderwaterIslands_ValleyLedge, 0f, 0);
            //Bloom plankton
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.TreeCove_Ground, 0.05f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.TreeCove_Wall, 0.05f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.TreeCove_Ceiling, 0.05f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.TreeCove_TreeOpen_CreatureOnly, 0.25f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.Kelp_CaveFloor, 0.3f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.GrassyPlateaus_CaveCeiling, 0.4f, 1);
            LootDistributionHandler.EditLootDistributionData(bloomPlanktonClassId, BiomeType.DeepGrandReef_Ceiling, 0.25f, 1);
            //Random mohawk stuff
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.DeepGrandReef_BlueCoral, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.SafeShallows_Plants, 0.3f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.KooshZone_CaveFloor, 0.2f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.UnderwaterIslands_IslandPlants, 0.5f, 1);
            //Underwater islands
            LootDistributionHandler.EditLootDistributionData(reefbackCoral01ClassId, BiomeType.UnderwaterIslands_IslandPlants, 0.5f, 1);
            //Grand reef deco
            LootDistributionHandler.EditLootDistributionData(reefbackCoral01ClassId, BiomeType.DeepGrandReef_BlueCoral, 0.2f, 1);
            LootDistributionHandler.EditLootDistributionData(whiteCaveCrawler, BiomeType.DeepGrandReef_Ceiling, 1f, 3);
            LootDistributionHandler.EditLootDistributionData(whiteCaveCrawler, BiomeType.DeepGrandReef_Wall, 0.2f, 3);
            LootDistributionHandler.EditLootDistributionData(reefbackCoral01ClassId, BiomeType.GrandReef_Grass, 0.2f, 1);
            LootDistributionHandler.EditLootDistributionData(reefbackCoral01ClassId, BiomeType.GrandReef_Ground, 0.2f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.GrandReef_Grass, 0.3f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.GrandReef_Ground, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(grandReefCrystal, BiomeType.DeepGrandReef_Ceiling, 0.7f, 1);
            LootDistributionHandler.EditLootDistributionData(grandReefCrystal, BiomeType.DeepGrandReef_Wall, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(grandReefCrystal, BiomeType.DeepGrandReef_Ground, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(jellyrayPrefab, BiomeType.GrandReef_OpenShallow_CreatureOnly, 0.04f, 2);
            LootDistributionHandler.EditLootDistributionData(jellyrayPrefab, BiomeType.GrandReef_OpenDeep_CreatureOnly, 0.02f, 1);
            //Sea Treader's path Twistybridge-ification
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.SeaTreaderPath_CaveFloor, 2f, 1);
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.SeaTreaderPath_CaveCeiling, 2f, 1);
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.SeaTreaderPath_CaveWall, 2f, 1);
            LootDistributionHandler.EditLootDistributionData(barnacleClusterId, BiomeType.SeaTreaderPath_CaveFloor, 1f, 1);
            LootDistributionHandler.EditLootDistributionData(barnacleClusterId, BiomeType.SeaTreaderPath_CaveCeiling, 1f, 1);
            LootDistributionHandler.EditLootDistributionData(barnacleClusterId, BiomeType.SeaTreaderPath_CaveWall, 1f, 1);
            LootDistributionHandler.EditLootDistributionData(mohawkClassId, BiomeType.SeaTreaderPath_CaveFloor, 1.2f, 1);
            LootDistributionHandler.EditLootDistributionData(whiteCaveCrawler, BiomeType.SeaTreaderPath_CaveCeiling, 2f, 1);
            //Drillable crystalline sulphur
            LootDistributionHandler.EditLootDistributionData(drillableSulphurId, BiomeType.GhostTree_Lake_Floor, 0.4f, 1);
            //Dunes
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.Dunes_Rock, 1.3f, 1);
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.Dunes_CaveCeiling, 1.3f, 1);
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.Dunes_CaveFloor, 1.3f, 1);
            LootDistributionHandler.EditLootDistributionData(breakableBarnacleClassId, BiomeType.Dunes_CaveWall, 1.3f, 1);
            LootDistributionHandler.EditLootDistributionData(drillableRubyId, BiomeType.Dunes_SandDune, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(drillableRubyId, BiomeType.Dunes_SandPlateau, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(drillableDiamondId, BiomeType.Dunes_SandDune, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(drillableDiamondId, BiomeType.Dunes_SandPlateau, 0.1f, 1);
            LootDistributionHandler.EditLootDistributionData(plantMiddle11ClassId, BiomeType.Dunes_SandPlateau, 0.4f, 1);
            LootDistributionHandler.EditLootDistributionData(plantMiddle11ClassId, BiomeType.Dunes_SandDune, 0.4f, 1);
            LootDistributionHandler.EditLootDistributionData(plantMiddle11ClassId, BiomeType.Dunes_Grass, 0.4f, 1);

            PatchPlantPDAEntry(TechType.Mohawk, "Mohawk", "Mohawk plant", "A similar, albeit more resilient relative to the Scaly Maw Anemone found on other sections of the planet. Thrives off of abundances of microorganisms found in the water. Lives in both shallow waters and deep cave systems.");

            PatchAudio();

            harmony.PatchAll(Assembly.GetExecutingAssembly());
        }
Пример #15
0
        internal static IEnumerator PostPatchCoroutine()
        {
            foreach (TechType tt in new HashSet <TechType>()
            {
                TechType.Exosuit,
#if SUBNAUTICA_STABLE
                TechType.Seamoth,
                TechType.Cyclops,
#elif BELOWZERO
                TechType.SeaTruck,
                TechType.Hoverbike
#endif
            })
            {
                CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(tt);
                yield return(task);

                GameObject prefab = task.GetResult();
                if (prefab != null)
                {
                    LiveMixin mixin = prefab.GetComponent <LiveMixin>();
                    if (mixin?.data != null)
                    {
                        Main.defaultHealth.Add(tt, mixin.data.maxHealth);
                        Log.LogDebug($"For TechType {tt.AsString()}, got default health of {mixin.data.maxHealth}");
                    }
                    else
                    {
                        Log.LogDebug($"Failed to get LiveMixin for TechType {tt.AsString()}");
                    }
                }
                else
                {
                    Log.LogDebug($"Failed to get prefab for TechType {tt.AsString()}");
                }
            }

            foreach (TechType tt in new HashSet <TechType>()
            {
                TechType.DrillableAluminiumOxide,
                TechType.DrillableCopper,
                TechType.DrillableDiamond,
                TechType.DrillableGold,
                TechType.DrillableKyanite,
                TechType.DrillableLead,
                TechType.DrillableLithium,
                TechType.DrillableMagnetite,
                TechType.DrillableMercury,
                TechType.DrillableNickel,
                TechType.DrillableQuartz,
                TechType.DrillableSalt,
                TechType.DrillableSilver,
                TechType.DrillableSulphur,
                TechType.DrillableTitanium,
                TechType.DrillableUranium
            })
            {
                Log.LogInfo($"Fixing Cell Level for TechType {tt.AsString()}");
                var classid = CraftData.GetClassIdForTechType(tt);
                if (WorldEntityDatabase.TryGetInfo(classid, out var worldEntityInfo))
                {
                    worldEntityInfo.cellLevel = LargeWorldEntity.CellLevel.VeryFar;

                    WorldEntityDatabase.main.infos[classid] = worldEntityInfo;
                }

                CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(tt);
                yield return(task);

                GameObject prefab = task.GetResult();
                if (prefab != null)
                {
                    LargeWorldEntity lwe = prefab.GetComponent <LargeWorldEntity>();
                    if (lwe != null)
                    {
                        lwe.cellLevel = LargeWorldEntity.CellLevel.VeryFar;
                        Log.LogDebug($"CellLevel for TechType {tt.AsString()} updated to Far");
                    }
                    else
                    {
                        Log.LogWarning($"Could not find LargeWorldEntity component in prefab for TechType {tt.AsString()}");
                    }
#if SUBNAUTICA_STABLE
                    // Since we're here, make kyanite less troll-tastic.
                    Drillable drillable = prefab.GetComponent <Drillable>();
                    if (drillable != null && drillable.kChanceToSpawnResources < DWConstants.newKyaniteChance)
                    {
                        drillable.kChanceToSpawnResources = DWConstants.newKyaniteChance;
                    }
#endif
                }
                else
                {
                    Log.LogWarning($"Could not get prefab for TechType {tt.AsString()}");
                }
            }

            yield break;
        }
Пример #16
0
 public static string getPrefabClassId(TechType techType) => CraftData.GetClassIdForTechType(techType);