public override void TickRare()
 {
     if (FlickUtility.WantsToBeOn(this))
     {
         GenTemperature.EqualizeTemperaturesThroughBuilding(this, ORIGINAL_VENT_RATE * VENT_RATE_MULTIPLIER, true);
     }
 }
 public override void TickRare()
 {
     if (FlickUtility.WantsToBeOn(this))
     {
         GenTemperature.EqualizeTemperaturesThroughBuilding(this, 14f, true);
     }
 }
        public override void TickRare()
        {
            if (!compPowerTrader.PowerOn || !FlickUtility.WantsToBeOn(this))
            {
                airFlowComp.isAirFlowing = false;

                return;
            }

            IntVec3 intVec  = Position + IntVec3.South.RotatedBy(Rotation);
            IntVec3 intVec2 = Position + IntVec3.North.RotatedBy(Rotation);

            if (intVec2.Impassable(Map) || intVec.Impassable(Map))
            {
                airFlowComp.isAirFlowing = false;

                return;
            }
            float temperatureRed = intVec2.GetTemperature(Map);
            float temperature    = intVec.GetTemperature(Map);

            if (temperatureRed == airFlowComp.targetTemperature || temperatureRed == temperature || (temperatureRed < airFlowComp.targetTemperature && temperatureRed > temperature) || (temperatureRed > airFlowComp.targetTemperature && temperatureRed < temperature))
            {
                airFlowComp.isAirFlowing = false;

                return;
            }

            GenTemperature.EqualizeTemperaturesThroughBuilding(this, 14f, twoWay: true);
            airFlowComp.isAirFlowing = true;
        }
Esempio n. 4
0
 public override void TickRare()
 {
     if (Spawned)
     {
         if (venting)
         {
             float vent = open ? VentRate : VentRate * closedVentFactor;
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, vent, true);
         }
         else if (leaks && !open)
         {
             float vent = VentRate * leakVentFactor;
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, vent, true);
         }
         if (autoVent && !emergencyShut && isFacingSet && AttachedRoom != null && !AttachedRoom.UsesOutdoorTemperature)
         {
             AutoVentControl();
         }
     }
     if (needsUpdate)
     {
         if (!isFacingSet)
         {
             CheckFacing();
         }
         CastLight();
         Map.GetComponent <MapComp_Windows>().IncludeTileRange(illuminated);
         needsUpdate = false;
     }
     base.TickRare();
 }
Esempio n. 5
0
 public override void Tick()
 {
     base.Tick();
     if (FreePassage != freePassageWhenClearedReachabilityCache)
     {
         ClearReachabilityCache(base.Map);
     }
     if (!openInt)
     {
         if (ticksSinceOpen > 0)
         {
             ticksSinceOpen--;
         }
         if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % 375 == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, twoWay: false);
         }
     }
     else
     {
         if (!openInt)
         {
             return;
         }
         if (ticksSinceOpen < TicksToOpenNow)
         {
             ticksSinceOpen++;
         }
         List <Thing> thingList = base.Position.GetThingList(base.Map);
         for (int i = 0; i < thingList.Count; i++)
         {
             Pawn pawn = thingList[i] as Pawn;
             if (pawn != null)
             {
                 CheckFriendlyTouched(pawn);
             }
         }
         if (ticksUntilClose > 0)
         {
             if (base.Map.thingGrid.CellContains(base.Position, ThingCategory.Pawn))
             {
                 ticksUntilClose = 110;
             }
             ticksUntilClose--;
             if (ticksUntilClose <= 0 && !holdOpenInt && !DoorTryClose())
             {
                 ticksUntilClose = 1;
             }
         }
         else if (CanTryCloseAutomatically)
         {
             ticksUntilClose = 110;
         }
         if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % 34 == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, twoWay: false);
         }
     }
 }
Esempio n. 6
0
 public override void Tick()
 {
     base.Tick();
     if (FreePassage != freePassageWhenClearedReachabilityCache)
     {
         ClearReachabilityCache(Map);
     }
     if (!openInt)
     {
         if (ticksSinceOpen > 0)
         {
             ticksSinceOpen--;
         }
         if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % TemperatureTuning.Door_TempEqualizeIntervalClosed == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, TemperatureTuning.Door_TempEqualizeRate, twoWay: false);
         }
     }
     else
     {
         if (!openInt)
         {
             return;
         }
         if (ticksSinceOpen < TicksToOpenNow)
         {
             ticksSinceOpen++;
         }
         var thingList = Position.GetThingList(Map);
         for (var i = 0; i < thingList.Count; i++)
         {
             if (thingList[i] is Pawn pawn)
             {
                 CheckFriendlyTouched(pawn);
             }
         }
         if (ticksUntilClose > 0)
         {
             if (Map.thingGrid.CellContains(Position, ThingCategory.Pawn))
             {
                 ticksUntilClose = CloseDelayTicks;
             }
             ticksUntilClose--;
             if (ticksUntilClose <= 0 && !holdOpenInt && !DoorTryClose())
             {
                 ticksUntilClose = 1;
             }
         }
         else if (CanTryCloseAutomatically)
         {
             ticksUntilClose = CloseDelayTicks;
         }
         if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % TemperatureTuning.Door_TempEqualizeIntervalOpen == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, TemperatureTuning.Door_TempEqualizeRate, twoWay: false);
         }
     }
 }
Esempio n. 7
0
 public override void Tick()
 {
     base.Tick();
     if (this.FreePassage != this.freePassageWhenClearedReachabilityCache)
     {
         this.ClearReachabilityCache(base.Map);
     }
     if (!this.openInt)
     {
         if (this.visualTicksOpen > 0)
         {
             this.visualTicksOpen--;
         }
         if ((Find.TickManager.TicksGame + base.thingIDNumber.HashOffset()) % 375 == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, false);
         }
     }
     else if (this.openInt)
     {
         if (this.visualTicksOpen < this.VisualTicksToOpen)
         {
             this.visualTicksOpen++;
         }
         if (!this.holdOpenInt)
         {
             if (base.Map.thingGrid.CellContains(base.Position, ThingCategory.Pawn))
             {
                 this.ticksUntilClose = 60;
             }
             else
             {
                 this.ticksUntilClose--;
                 if (this.ticksUntilClose <= 0 && this.CanCloseAutomatically)
                 {
                     this.DoorTryClose();
                 }
             }
         }
         if ((Find.TickManager.TicksGame + base.thingIDNumber.HashOffset()) % 22 == 0)
         {
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, false);
         }
     }
 }
Esempio n. 8
0
 public override void TickRare()
 {
     if (Spawned)
     {
         if (venting)
         {
             float vent = open ? VentRate : VentRate * closedVentFactor;
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, vent, true);
         }
         else if (leaks && !open)
         {
             float vent = VentRate * leakVentFactor;
             GenTemperature.EqualizeTemperaturesThroughBuilding(this, vent, true);
         }
         if (autoVent && !emergencyShut && isFacingSet && AttachedRoom != null && !AttachedRoom.UsesOutdoorTemperature)
         {
             AutoVentControl();
         }
     }
     base.TickRare();
 }
Esempio n. 9
0
        // Token: 0x0600006E RID: 110 RVA: 0x00004338 File Offset: 0x00002538
        public override void TickRare()
        {
            var tempRange = default(FloatRange);

            GetSafeTemps(this, UseFixed, out var tempMin, out var tempMax);
            tempRange.min = tempMin;
            tempRange.max = tempMax;
            if (UseFixed && RPGVentCheckTemps(this, tempRange) || !UseFixed)
            {
                if (!InRangeATM && VentIsWorking(this))
                {
                    InRangeATM = !InRangeATM;
                    if (!flickableComp.SwitchIsOn)
                    {
                        flickableComp.DoFlick();
                    }
                }

                if (!FlickUtility.WantsToBeOn(this))
                {
                    return;
                }

                if (VentIsWorking(this))
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, 20f, true);
                    return;
                }

                GenTemperature.EqualizeTemperaturesThroughBuilding(this, 14f, true);
            }
            else
            {
                InRangeATM = false;
                if (VentIsWorking(this) && flickableComp.SwitchIsOn)
                {
                    flickableComp.DoFlick();
                }
            }
        }
Esempio n. 10
0
        public override void TickRare()
        {
            base.TickRare();

            if (WindowComp.state == State.Ajar)
            {
                float rate = Size * 14f; // following in suit of the default '14f' of a vent in vanilla
                GenTemperature.EqualizeTemperaturesThroughBuilding(this, rate, true);
            }

            if (LastUpdate-- <= 0)
            {
                if (WindowComp.facing == LinkDirections.None)
                {
                    WindowComp.TryResolveFacing();
                }

                LastUpdate = 25;
                if (ElifsDecorationsSettings.BeautyEnabled)
                {
                    WindowComp.GetBeauty();
                }
            }
        }
        public override void Tick()
        {
            base.Tick();
            if (!this.Spawned || this.DestroyedOrNull())
            {
                return;
            }
            if (this.invisDoors.NullOrEmpty())
            {
                this.SpawnDoors();
            }

            if (forbiddenComp.Forbidden != lastForbidSetting)
            {
                lastForbidSetting = forbiddenComp.Forbidden;
                foreach (var doorToForbid in this.invisDoors)
                {
                    doorToForbid.SetForbidden(forbiddenComp.Forbidden);
                }
                this.Map.reachability.ClearCache();
            }

            int closedTempLeakRate = Def?.tempLeakRate ?? 375;

            if (Find.TickManager.TicksGame % friendlyTouchTicks == 0)
            {
                if (ShouldKeepDoorOpen())
                {
                    temp = new List <Pawn>(crossingPawns);
                    foreach (Pawn p in temp)
                    {
                        int curDist = p.PositionHeld.LengthHorizontalSquared;
                        //Log.Message(curDist.ToString());
                        if (curDist > Mathf.Max(this.def.Size.x, this.def.Size.z) + 1)
                        {
                            //Log.Message("Removed " + p.LabelShort);
                            crossingPawns.Remove(p);
                        }
                    }
                }
                else
                {
                    this.DoorTryClose();
                }
            }

            if (this.FreePassage != this.freePassageWhenClearedReachabilityCache)
            {
                this.ClearReachabilityCache(base.Map);
            }

            if (!this.openInt)
            {
                if (this.visualTicksOpen > 0)
                {
                    this.visualTicksOpen--;
                }
                if ((Find.TickManager.TicksGame + this.thingIDNumber.HashOffset()) % closedTempLeakRate == 0)
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, false);
                }
            }
            else if (this.openInt)
            {
                if (this.visualTicksOpen < this.VisualTicksToOpen)
                {
                    this.visualTicksOpen++;
                }
                if (!this.holdOpenInt)
                {
                    bool isPawnPresent = false;
                    foreach (var door in invisDoors)
                    {
                        if (!base.Map.thingGrid.CellContains(door.PositionHeld, ThingCategory.Pawn))
                        {
                            continue;
                        }
                        door.OpenValue       = true;
                        door.TicksUntilClose = 60;
                        isPawnPresent        = true;
                    }

                    if (!isPawnPresent)
                    {
                        this.ticksUntilClose--;
                        if (this.ticksUntilClose <= 0 && this.CanCloseAutomatically)
                        {
                            this.DoorTryClose();
                            foreach (var door in invisDoors)
                            {
                                AccessTools.Method(typeof(Building_Door), "DoorTryClose").Invoke(door, null);
                            }
                        }
                    }
                    else
                    {
                        this.ticksUntilClose = 60;
                    }
                }

                if ((Find.TickManager.TicksGame + this.thingIDNumber.HashOffset()) % 22 == 0)
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, 1f, false);
                }
            }
        }
Esempio n. 12
0
        public override void Tick()
        {
            base.Tick();

            //Check if we should clear the reachability cache
            if (FreePassage != freePassageWhenClearedReachabilityCache)
            {
                ClearReachabilityCache(Map);
            }

            if (!openInt)
            {
                //Visual - slide door closed
                if (visualTicksOpen > 0)
                {
                    visualTicksOpen--;
                }

                //Equalize temperatures
                if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % TemperatureTuning.Door_TempEqualizeIntervalClosed == 0)
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, TemperatureTuning.Door_TempEqualizeRate, twoWay: false);
                }
            }
            else if (openInt)
            {
                //Visual - slide door open
                if (visualTicksOpen < VisualTicksToOpen)
                {
                    visualTicksOpen++;
                }

                //Check friendly touched
                var things = Position.GetThingList(Map);
                for (int i = 0; i < things.Count; i++)
                {
                    var p = things[i] as Pawn;
                    if (p != null)
                    {
                        CheckFriendlyTouched(p);
                    }
                }

                //Count down to closing
                if (ticksUntilClose > 0)
                {
                    //Pawn moving
                    if (Map.thingGrid.CellContains(Position, ThingCategory.Pawn))
                    {
                        //This is important for doors which !SlowsPawns, this will override their default long approach close delay when the pawn actually enters the cell,
                        //note that we do this only if ticksUntilClose is already > 0
                        ticksUntilClose = CloseDelayTicks;
                    }

                    ticksUntilClose--;
                    if (ticksUntilClose <= 0 && !holdOpenInt)
                    {
                        if (!DoorTryClose())
                        {
                            ticksUntilClose = 1;                     //Something blocking - try next tick
                        }
                    }
                }
                else
                {
                    //Not assigned to close, check if we want to close automatically
                    if (CanTryCloseAutomatically)
                    {
                        ticksUntilClose = CloseDelayTicks;
                    }
                }

                //Equalize temperatures
                if ((Find.TickManager.TicksGame + thingIDNumber.HashOffset()) % TemperatureTuning.Door_TempEqualizeIntervalOpen == 0)
                {
                    GenTemperature.EqualizeTemperaturesThroughBuilding(this, TemperatureTuning.Door_TempEqualizeRate, twoWay: false);
                }
            }
        }