Ejemplo n.º 1
0
        private void SpawnItemsFromRemoval()
        {
            //Drop the appropriate amount of insulation material for when insulation has been removed, or when an insulated conduit has been deconstructed
            GameObject go      = null;
            int        cell    = Grid.PosToCell(gameObject);
            Element    element = ElementLoader.FindElementByHash(SimHashes.SuperInsulator);
            float      insulationMass;

            if (oldInsulationMass > 0f)
            {
                Debug.Log($"[Pressurized] Pressurized Pipe had insulation removed, but was marked for an old insulation mass. Mass returned: {oldInsulationMass}KG");
                insulationMass    = oldInsulationMass;
                oldInsulationMass = 0f;
            }
            else
            {
                insulationMass = MassToInsulate;
            }
            go = element.substance.SpawnResource(Grid.CellToPosCBC(cell, Grid.SceneLayer.Ore), insulationMass, primaryElement.Temperature, primaryElement.DiseaseIdx, primaryElement.DiseaseCount, false, false, false);
            TransformExtensions.SetPosition(go.transform, TransformExtensions.GetPosition(go.transform) + (Vector3.up * 0.5f));
            GameComps.Fallers.Add(go, Vector2.zero);
        }