Esempio n. 1
0
        /// <summary>
        /// Updates the shader parameters that do not change often.
        /// </summary>
        private void ConstantParamsUpdate()
        {
            var inst = ClusterManager.Instance;
            int id   = inst.activeWorldId;

            if (constantsDirty || id != lastWorldID)
            {
                float   w = Grid.WidthInCells, h = Grid.HeightInCells;
                var     activeWorld = inst.GetWorld(id);
                Vector4 clusterSize;
                var     worldOffset = activeWorld.WorldOffset;
                var     worldSize   = activeWorld.WorldSize;
                Shader.SetGlobalVector(tIDWorldSize, new Vector4(w, h, 1.0f / w, 1.0f / h));
                if (DlcManager.IsPureVanilla() || (CameraController.Instance != null &&
                                                   CameraController.Instance.ignoreClusterFX))
                {
                    clusterSize = new Vector4(w, h, 0f, 0f);
                }
                else
                {
                    clusterSize = new Vector4(worldSize.x, worldSize.y, 1.0f / (worldSize.x +
                                                                                worldOffset.x), 1.0f / (worldSize.y + worldOffset.y));
                }
                Shader.SetGlobalVector(tIDClusterWorldSize, clusterSize);
                Shader.SetGlobalFloat(tIDTopBorderHeight, activeWorld.FullyEnclosedBorder ?
                                      0f : Grid.TopBorderHeight);
                constantsDirty = false;
                lastWorldID    = id;
            }
            // This one could be updated even if constants are the same
            Shader.SetGlobalFloat(tIDFogOfWarScale, PropertyTextures.FogOfWarScale);
        }
Esempio n. 2
0
        public GameObject CreatePrefab()
        {
            var go = EntityTemplates.CreateLooseEntity(
                id: ID,
                name: STRINGS.ITEMS.MASSIVE_HEATSINK_CORE.NAME,
                desc: STRINGS.ITEMS.MASSIVE_HEATSINK_CORE.DESC,
                mass: MASS,
                unitMass: true,
                anim: Assets.GetAnim("massiveheatsink_core_kanim"),
                initialAnim: "idle_crystal",
                sceneLayer: Grid.SceneLayer.Ore,
                collisionShape: EntityTemplates.CollisionShape.RECTANGLE,
                width: 1f,
                height: 1f,
                isPickupable: true,
                sortOrder: SORTORDER.BUILDINGELEMENTS,
                element: SimHashes.Unobtanium,
                additionalTags: new List <Tag> {
                GameTags.IndustrialIngredient,
                GameTags.PedestalDisplayable,
                GameTags.Artifact,
            });

            // это частично спокировано из ArtifactConfig.CreateArtifact, надо поглядывать если что то поменяют
            var occupyArea = go.AddOrGet <OccupyArea>();

            occupyArea.OccupiedCellsOffsets = EntityTemplates.GenerateOffsets(1, 1);
            var decorProvider = go.AddOrGet <DecorProvider>();

            decorProvider.SetValues(TIER_CORE.decorValues);
            decorProvider.overrideName = STRINGS.ITEMS.MASSIVE_HEATSINK_CORE.NAME;
            var spaceArtifact = go.AddOrGet <SpaceArtifact>();

            spaceArtifact.SetUIAnim("ui_crystal");
            spaceArtifact.SetArtifactTier(TIER_CORE);
            spaceArtifact.uniqueAnimNameFragment = "idle_crystal";
            spaceArtifact.artifactType           = ArtifactType.Any;
            go.AddOrGet <KSelectable>();
            go.GetComponent <KBatchedAnimController>().initialMode = KAnim.PlayMode.Loop;

            var pe = go.GetComponent <PrimaryElement>();

            pe.Mass        = MASS;
            pe.Temperature = TEMPERATURE;

            // добавляем в список артифактов только в ваниле, воизбежание непредвиденных последствий на длц
            if (DlcManager.IsPureVanilla())
            {
                ArtifactConfig.artifactItems[ArtifactType.Any].Add(go.name);
            }
            return(go);
        }
Esempio n. 3
0
        private static void AfterDbInit()
        {
            Utils.AddBuildingToPlanScreen("Utilities", MassiveHeatSinkConfig.ID);
            Utils.AddBuildingToTechnology("Catalytics", MassiveHeatSinkConfig.ID);
            GameTags.MaterialBuildingElements.Add(ID);
            // добавляем ядра -выдры- в космос в ванилле
            var chance = ReBuildableAETNOptions.Instance.VanillaPlanetChance;

            if (DlcManager.IsPureVanilla() && chance.Enabled)
            {
                var sdp = Db.Get().SpaceDestinationTypes;
                CloneArtifactDropRateTable(sdp.IcyDwarf, TIER_CORE, chance.IcyDwarfChance / 100f);
                CloneArtifactDropRateTable(sdp.IceGiant, TIER_CORE, chance.IceGiantChance / 100f);
            }
        }