public override void CompTick()
        {
            //base.CompTick();

            bool every5Sec = (Find.TickManager.TicksGame % CheckEvery5Second == 0);

            if (stoneComp != null && !stoneComp.SwitchIsOn)
            {
                return;
            }

            // regular consumption
            if (!this.Props.consumeFuelOnlyWhenUsed)
            {
                this.ConsumeFuel(this.ConsumptionRatePerTick);
            }
            // additionnal rain consumption
            if (this.Props.fuelConsumptionPerTickInRain > 0f && this.parent.Spawned && this.parent.Map.weatherManager.RainRate > 0.4f && !this.parent.Map.roofGrid.Roofed(this.parent.Position))
            {
                this.ConsumeFuel(this.Props.fuelConsumptionPerTickInRain);
            }

            // if on
            if (stoneComp.SwitchIsOn)
            {
                // no more fuel, extinguishing
                if (Fuel <= 0)
                {
                    stoneComp.DoFlick(false);
                    stoneComp.ResetToOff();
                }

                if (every5Sec)
                {
                    // raining, chances to extinguish
                    if (RollForRainFire())
                    {
                        return;
                    }

                    if (LaniusMod)
                    {
                        Room  room           = this.parent.GetRoom();
                        float breathablility = this.parent.Map.GetComponent <RoomBreathabilityManager>().RoomBreathability(room);

                        if (breathablility < 50f)
                        {
                            stoneComp.DoFlick(false);
                            stoneComp.ResetToOff();
                        }
                    }
                }
            }
        }
예제 #2
0
        public override void CompTick()
        {
            //base.CompTick();
            //Log.Warning("0", true);

            if (extinguishableComp == null)
            {
                Log.Warning("Cant find extinguishableComp: " + parent.Label);
                return;
            }
            //Log.Warning("1", true);
            if (!extinguishableComp.SwitchIsOn)
            {
                return;
            }

            //Log.Warning("2", true);
            // regular consumption
            if (!Props.consumeFuelOnlyWhenUsed)
            {
                ConsumeFuel(ConsumptionRatePerTick);
            }

            // additionnal rain consumption
            if (Props.fuelConsumptionPerTickInRain > 0f && parent.Spawned && RainThreshold && UnroofedBuilding)
            {
                ConsumeFuel(Props.fuelConsumptionPerTickInRain);
            }

            // Trying to extinguish bc rain / lanius
            // no more fuel, extinguishing
            if (Fuel <= 0)
            {
                parent.BroadcastCompSignal(RanOutOfFuelSignal);
                extinguishableComp.DoFlick(false);
                extinguishableComp.ResetToOff();
            }

            UpdateGlowStatus();

            //Log.Warning("6", true);
            //Log.Warning("every1sec", true);

            if (!extinguishableComp.RainVulnerable && !extinguishableComp.OxygenVulnerable)
            {
                return;
            }

            if (!parent.IsHashIntervalTick(300))
            {
                return;
            }

            //Log.Warning("7", true);
            //if(MyDebug) Log.Warning("every5sec");

            // raining, chances to extinguish
            if (extinguishableComp.RainVulnerable)
            {
                RollForRainFire();
            }

            //Log.Warning("8", true);
            // lanius mod active, checking oxygen ratio
            if (extinguishableComp.OxygenVulnerable)
            {
                if (LaniusMod)
                {
                    Room room = parent.GetRoom();
                    if (room.PsychologicallyOutdoors)
                    {
                        return;
                    }
                    float breathablility = parent.Map.GetComponent <RoomBreathabilityManager>().RoomBreathability(room);

                    if (breathablility < 50f)
                    {
                        extinguishableComp.DoFlick(false);
                        extinguishableComp.ResetToOff();
                    }
                }
            }
        }