public static bool TryGetTemperatureForCell(IntVec3 c, Map map, out float tempResult)
        {
            if (map == null)
            {
                Log.Error("Got temperature for null map.");
                tempResult = 21f;
                return(true);
            }
            if (!c.InBounds(map))
            {
                tempResult = 21f;
                return(false);
            }
            if (GenTemperature.TryGetDirectAirTemperatureForCell(c, map, out tempResult))
            {
                return(true);
            }
            List <Thing> list = map.thingGrid.ThingsListAtFast(c);

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].def.passability == Traversability.Impassable)
                {
                    return(GenTemperature.TryGetAirTemperatureAroundThing(list[i], out tempResult));
                }
            }
            return(false);
        }
Пример #2
0
        public static bool TryGetAirTemperatureAroundThing(Thing t, out float temperature)
        {
            float          num  = 0f;
            int            num2 = 0;
            List <IntVec3> list = GenAdjFast.AdjacentCells8Way(t);

            for (int i = 0; i < list.Count; i++)
            {
                float num3;
                if (list[i].InBounds(t.Map) && GenTemperature.TryGetDirectAirTemperatureForCell(list[i], t.Map, out num3))
                {
                    num += num3;
                    num2++;
                }
            }
            bool result;

            if (num2 > 0)
            {
                temperature = num / (float)num2;
                result      = true;
            }
            else
            {
                temperature = 21f;
                result      = false;
            }
            return(result);
        }
        private float WallEqualizationTempChangePerInterval()
        {
            if (this.equalizeCells.Count == 0)
            {
                return(0f);
            }
            float num  = 0f;
            int   num2 = Mathf.CeilToInt((float)this.equalizeCells.Count * 0.2f);

            for (int i = 0; i < num2; i++)
            {
                this.cycleIndex++;
                int   index = this.cycleIndex % this.equalizeCells.Count;
                float num3;
                if (GenTemperature.TryGetDirectAirTemperatureForCell(this.equalizeCells[index], this.Map, out num3))
                {
                    num += num3 - this.Temperature;
                }
                else
                {
                    num += Mathf.Lerp(this.Temperature, this.Map.mapTemperature.OutdoorTemp, 0.5f) - this.Temperature;
                }
            }
            float num4 = num / (float)num2;
            float num5 = num4 * (float)this.equalizeCells.Count;

            return(num5 * 120f * 0.00017f / (float)this.roomGroup.CellCount);
        }
Пример #4
0
        private float WallEqualizationTempChangePerInterval()
        {
            if (equalizeCells.Count == 0)
            {
                return(0f);
            }
            float num  = 0f;
            int   num2 = Mathf.CeilToInt((float)equalizeCells.Count * 0.2f);

            for (int i = 0; i < num2; i++)
            {
                cycleIndex++;
                int index = cycleIndex % equalizeCells.Count;
                num = ((!GenTemperature.TryGetDirectAirTemperatureForCell(equalizeCells[index], Map, out float temperature)) ? (num + (Mathf.Lerp(Temperature, Map.mapTemperature.OutdoorTemp, 0.5f) - Temperature)) : (num + (temperature - Temperature)));
            }
            return(num / (float)num2 * (float)equalizeCells.Count * 120f * 0.00017f / (float)roomGroup.CellCount);
        }
        private float WallEqualizationTempChangePerInterval()
        {
            if (this.equalizeCells.Count == 0)
            {
                return(0f);
            }
            float num  = 0f;
            int   num2 = Mathf.CeilToInt((float)((float)this.equalizeCells.Count * 0.20000000298023224));

            for (int i = 0; i < num2; i++)
            {
                this.cycleIndex++;
                int   index = this.cycleIndex % this.equalizeCells.Count;
                float num3  = default(float);
                num = ((!GenTemperature.TryGetDirectAirTemperatureForCell(this.equalizeCells[index], this.Map, out num3)) ? (num + (Mathf.Lerp(this.Temperature, this.Map.mapTemperature.OutdoorTemp, 0.5f) - this.Temperature)) : (num + (num3 - this.Temperature)));
            }
            float num4 = num / (float)num2;
            float num5 = num4 * (float)this.equalizeCells.Count;

            return((float)(num5 * 120.0 * 0.00016999999934341758 / (float)this.roomGroup.CellCount));
        }