public void SteamSprayerTick()
 {
     if (sprayTicksLeft > 0)
     {
         sprayTicksLeft--;
         if (Rand.Value < 0.6f)
         {
             MoteMaker.ThrowAirPuffUp(parent.TrueCenter(), parent.Map);
         }
         if (Find.TickManager.TicksGame % 20 == 0)
         {
             GenTemperature.PushHeat(parent, 40f);
         }
         if (sprayTicksLeft <= 0)
         {
             if (endSprayCallback != null)
             {
                 endSprayCallback();
             }
             ticksUntilSpray = Rand.RangeInclusive(500, 2000);
         }
     }
     else
     {
         ticksUntilSpray--;
         if (ticksUntilSpray <= 0)
         {
             if (startSprayCallback != null)
             {
                 startSprayCallback();
             }
             sprayTicksLeft = Rand.RangeInclusive(200, 500);
         }
     }
 }
        public override void Tick()
        {
            base.Tick();
            if (this.compPowerTrader.PowerOn)
            {
                timeTillEval--;
                if (timeTillEval <= 0)
                {
                    IntVec3 intVec3_1 = this.Position + IntVec3.North.RotatedBy(this.Rotation);

                    IntVec3 intVec3_2 = this.Position + IntVec3.South.RotatedBy(this.Rotation);
                    IntVec3 intVec3_3 = this.Position + (IntVec3.South.RotatedBy(this.Rotation) * 2);
                    IntVec3 intVec3_4 = this.Position + (IntVec3.South.RotatedBy(this.Rotation) * 3);
                    bool    flag      = false;
                    if (!intVec3_4.Impassable(this.Map) && !intVec3_3.Impassable(this.Map) && !intVec3_2.Impassable(this.Map) && !intVec3_1.Impassable(this.Map))
                    {
                        float temperature1 = intVec3_2.GetTemperature(this.Map);
                        float temperature2 = intVec3_1.GetTemperature(this.Map);
                        float num1         = temperature1 - temperature2;
                        if ((double)temperature1 - 40.0 > (double)num1)
                        {
                            num1 = temperature1 - 40f;
                        }
                        float num2 = (float)(1.0 - (double)num1 * (1.0 / 130.0));
                        if ((double)num2 < 0.0)
                        {
                            num2 = 0.0f;
                        }
                        float energyLimit = (float)(((double)this.compTempControl.Props.energyPerSecond) * (double)num2 * 4.16666650772095);
                        float a           = GenTemperature.ControlTemperatureTempChange(intVec3_1, this.Map, energyLimit, this.compTempControl.targetTemperature);
                        flag = !Mathf.Approximately(a, 0.0f);
                        if (flag)
                        {
                            intVec3_1.GetRoomGroup(this.Map).Temperature += a;
                            GenTemperature.PushHeat(intVec3_2, this.Map, (float)(-(double)energyLimit * 1.25));
                            GenTemperature.PushHeat(intVec3_3, this.Map, (float)(-(double)energyLimit * 1.25));
                            GenTemperature.PushHeat(intVec3_4, this.Map, (float)(-(double)energyLimit * 1.25));
                        }
                    }
                    CompProperties_Power props = this.compPowerTrader.Props;
                    if (flag)
                    {
                        this.compPowerTrader.PowerOutput = -props.basePowerConsumption;
                    }
                    else
                    {
                        this.compPowerTrader.PowerOutput = -props.basePowerConsumption * this.compTempControl.Props.lowPowerConsumptionFactor;
                    }
                    this.compTempControl.operatingAtHighPower = flag;

                    unfoldComponent.Target = flag ? 1.0f : 0.0f;

                    timeTillEval = EVAL_TIME;
                }
            }
            else
            {
                unfoldComponent.Target = 0.0f;
            }
        }
Example #3
0
 private void TryConsumeFuelAndSetPowerGeneration()
 {
     if (HasPowerComp)
     {
         if (HasFuel && isActive)
         {
             UseFuel();
             power.powerOutputInt = powerOutputInt;
             if (glower != null)
             {
                 glower.Lit = true;
             }
             if (Find.TickManager.TicksGame % 200 == 0)
             {
                 GenTemperature.PushHeat(this, 2f);
             }
         }
         else
         {
             power.powerOutputInt = 0;
             if (glower != null)
             {
                 glower.Lit = false;
             }
         }
     }
 }
        public override void CompPostTick(ref float severityAdjustment)
        {
            if (Pawn.Negligible())
            {
                if (MyDebug)
                {
                    Log.Warning("null pawn");
                }
                return;
            }

            // Puff
            if (sprayTicksLeft <= 0)
            {
                // Smoke if random ok
                if (Rand.Chance(Props.puffingChance))
                {
                    //Log.Warning("Puffing");
                    //MoteMaker.ThrowAirPuffUp(Pawn.TrueCenter(), MyMap);
                    FleckMaker.ThrowAirPuffUp(Pawn.TrueCenter(), MyMap);
                    GenTemperature.PushHeat(Pawn.Position, MyMap, Props.temperatureIncreasePerPuff);
                }

                // reset avec random // ça fait x10 ?!
                sprayTicksLeft = ticksUntilSpray = Rand.RangeInclusive(Props.MinTicksBetweenSprays, Props.MaxTicksBetweenSprays);
            }
            // decrease ticks
            else
            {
                sprayTicksLeft--;
            }
        }
Example #5
0
        public override void                CompTick()
        {
            base.CompTick();

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

            // If power is off, abort
            if (!CompPowerTrader.PowerOn)
            {
                return;
            }

            // If it's in low power mode, abort
            if (CompPowerLowIdleDraw.LowPowerMode)
            {
                return;
            }

            // If the local temp is higher than the max heat pushed, abort
            if (parent.Position.GetTemperature() >= props.heatPushMaxTemperature)
            {
                return;
            }

            // Push some heat
            GenTemperature.PushHeat(parent.Position, props.heatPerSecond);
        }
 public override void CompTickRare()
 {
     base.CompTickRare();
     if (this.ShouldPushHeatNow)
     {
         GenTemperature.PushHeat(this.parent.PositionHeld, this.parent.MapHeld, HeatPerSecondVariable * 4.16666651f);
     }
 }
 public void PushHeat(float amount)
 {
     if (VecNorth.UsesOutdoorTemperature())
     {
         return;
     }
     GenTemperature.PushHeat(VecNorth, amount);
 }
Example #8
0
 public override void CompTick()
 {
     base.CompTick();
     if (Find.TickManager.TicksGame % 60 == this.HashCodeToMod(60) && ShouldPushHeat)
     {
         GenTemperature.PushHeat(parent.Position, parent.Map, PushAmount);
     }
 }
Example #9
0
 public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
 {
     if (this.def.explosionHeatEnergyPerCell > 1.401298E-45f)
     {
         GenTemperature.PushHeat(explosion.Position, explosion.Map, this.def.explosionHeatEnergyPerCell * (float)cellsToAffect.Count);
     }
     MoteMaker.MakeStaticMote(explosion.Position, explosion.Map, ThingDefOf.Mote_ExplosionFlash, explosion.radius * 6f);
 }
 public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
 {
     if (this.def.explosionHeatEnergyPerCell > 1.401298E-45f)
     {
         GenTemperature.PushHeat(explosion.Position, explosion.Map, this.def.explosionHeatEnergyPerCell * (float)cellsToAffect.Count);
     }
     FleckMaker.Static(explosion.DrawPos, explosion.Map, FleckDefOf.ExplosionFlash, explosion.radius * 6f);
 }
 public override void CompTick()
 {
     base.CompTick();
     if (this.parent.IsHashIntervalTick(60) && this.ShouldPushHeatNow)
     {
         GenTemperature.PushHeat(this.parent.PositionHeld, this.parent.MapHeld, HeatPerSecondVariable);
     }
 }
 public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
 {
     if (this.def.explosionHeatEnergyPerCell > 1.401298E-45f)
     {
         GenTemperature.PushHeat(explosion.Position, explosion.Map, this.def.explosionHeatEnergyPerCell * (float)cellsToAffect.Count);
     }
     this.ExplosionVisualEffectCenter(explosion);
 }
Example #13
0
 public override void UsedThisTick()
 {
     base.UsedThisTick();
     if (Find.TickManager.TicksGame % 30 == 4)
     {
         GenTemperature.PushHeat(this, def.building.heatPerTickWhileWorking * 30f);
     }
 }
Example #14
0
 public override void CompTickRare()
 {
     base.CompTickRare();
     if (ShouldPushHeatNow)
     {
         GenTemperature.PushHeat(parent.PositionHeld, parent.MapHeld, Props.heatPerSecond * 4.16666651f);
     }
 }
Example #15
0
 public override void CompTick()
 {
     base.CompTick();
     if (parent.IsHashIntervalTick(60) && ShouldPushHeatNow)
     {
         GenTemperature.PushHeat(parent.PositionHeld, parent.MapHeld, Props.heatPerSecond);
     }
 }
        // Token: 0x06000014 RID: 20 RVA: 0x00002440 File Offset: 0x00000640
        public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
        {
            if (def.explosionHeatEnergyPerCell > float.Epsilon)
            {
                GenTemperature.PushHeat(explosion.Position, explosion.Map,
                                        def.explosionHeatEnergyPerCell * cellsToAffect.Count);
            }

            FleckMaker.Static(explosion.Position, explosion.Map, FleckDefOf.ExplosionFlash, explosion.radius * 6f);
        }
Example #17
0
 public override void CompTick()
 {
     this.ticks++;
     if (this.ticks % this.Props.howOften == 0)
     {
         GenTemperature.PushHeat(this.parent, this.Props.temperature);
         MoteMaker.ThrowFireGlow(this.parent.Position, this.parent.Map, 1);
         MoteMaker.ThrowSmoke(this.parent.Position.ToVector3(), this.parent.Map, 1);
     }
 }
Example #18
0
 public override void CompTick()
 {
     base.CompTick();
     if (this.parent.IsHashIntervalTick(60) && this.ShouldPushHeatNow)
     {
         CompProperties_HeatPusher props = this.Props;
         float ambientTemperature        = this.parent.AmbientTemperature;
         GenTemperature.PushHeat(this.parent, (this.parent as Building_Computer).HeatEnergy);
     }
 }
        // Token: 0x06000041 RID: 65 RVA: 0x00002D3C File Offset: 0x00000F3C
        public override void CompTick()
        {
            base.CompTick();
            bool flag = Find.TickManager.TicksGame % 60 == this.HashCodeToMod(60) && this.ShouldPushHeat;

            if (flag)
            {
                GenTemperature.PushHeat(this.parent.Position, this.parent.Map, this.PushAmount);
            }
        }
        public override void TickRare()
        {
            if (this.CurrentTemp < -2000f)
            {
                this.CurrentTemp = GridsUtility.GetTemperature(base.Position, base.Map);
            }
            foreach (IntVec3 cell in this.AllSlotCells())
            {
                foreach (Thing thing in GridsUtility.GetThingList(cell, base.Map))
                {
                    CompRottable rottable = ThingCompUtility.TryGetComp <CompRottable>(thing);
                    if (rottable != null && !(rottable is CompBetterRottable))
                    {
                        ThingWithComps     thingWithComps     = thing as ThingWithComps;
                        CompBetterRottable compBetterRottable = new CompBetterRottable();
                        thingWithComps.AllComps.Remove(rottable);
                        thingWithComps.AllComps.Add(compBetterRottable);
                        compBetterRottable.props       = rottable.props;
                        compBetterRottable.parent      = thingWithComps;
                        compBetterRottable.RotProgress = rottable.RotProgress;
                    }

                    if (ThingCompUtility.TryGetComp <CompFrosty>(thing) == null && thing.def.defName == "Beer")
                    {
                        ThingWithComps thingWithComps = thing as ThingWithComps;
                        CompFrosty     compFrosty     = new CompFrosty();
                        thingWithComps.AllComps.Add(compFrosty);
                        compFrosty.props  = CompProperties_Frosty.Beer;
                        compFrosty.parent = thingWithComps;
                        ((TickList)typeof(TickManager).GetField("tickListRare", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Find.TickManager)).RegisterThing(thingWithComps);
                    }
                }
            }

            float roomTemperature   = GridsUtility.GetTemperature(base.Position, base.Map);
            float changetemperature = (roomTemperature - this.CurrentTemp) * 0.01f;
            float changeEnergy      = -changetemperature;
            float powerMultiplier   = 0f;

            if (this.CurrentTemp + changetemperature > this.DesiredTemp)
            {
                float change = Mathf.Max(this.DesiredTemp - (this.CurrentTemp + changetemperature), -1f);
                if (this.powerComp != null && this.powerComp.PowerOn)
                {
                    changetemperature += change;
                    changeEnergy      -= change * 1.25f;
                }
                powerMultiplier = change * -1f;
            }
            this.CurrentTemp += changetemperature;
            IntVec3 pos = base.Position + IntVec3.North.RotatedBy(base.Rotation);

            GenTemperature.PushHeat(pos, base.Map, changeEnergy * 1.25f);
            this.powerComp.PowerOutput = -((CompProperties_Power)this.powerComp.props).basePowerConsumption * (powerMultiplier * 0.9f + 0.1f);
        }
Example #21
0
        // Token: 0x0600000C RID: 12 RVA: 0x000027F4 File Offset: 0x000017F4
        public override void Tick()
        {
            base.Tick();
            checked
            {
                if (powerComp.PowerOn)
                {
                    timer++;
                    if (timer >= TexResFrames.Length * 3)
                    {
                        timer = 0;
                    }

                    HandleAnimation();
                    if (Charges >= 90000)
                    {
                        Stage = 1;
                    }

                    if (Charges < 90000)
                    {
                        Charges++;
                        powerComp.PowerOutput = -1000f;
                    }

                    if (Stage <= 0)
                    {
                        if (Position.GetTemperature(Map) > -100f)
                        {
                            GenTemperature.PushHeat(this, -0.5f);
                        }

                        if (Math.IEEERemainder(Charges, 4500.0) == 1.0)
                        {
                            ChargesString++;
                        }
                    }
                    else if (Stage > 0)
                    {
                        powerComp.PowerOutput =
                            Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.SolarFlare) ? 2000f : 1000f;

                        if (Position.GetTemperature(Map) < 100f)
                        {
                            GenTemperature.PushHeat(this, 0.5f);
                        }
                    }
                }
                else if (!powerComp.PowerOn && Stage <= 0)
                {
                    Charges       = 0;
                    ChargesString = 0;
                }
            }
        }
        private void DoTickerWork(int tickAmount)
        {
            if (compTempControl.targetTemperature > maxTargetTemperature || compTempControl.targetTemperature < minTargetTemperature)
            {
                compTempControl.targetTemperature = defaultTargetTemp;
            }
            heat = TempDelta();
            compPowerTrader.PowerOutput = EnergyOutput(heat);

            GenTemperature.PushHeat(this, heat * tickAmount / 60 / 10f * TenDegreeDeltaThermalEnergyPerSecond);
        }
Example #23
0
 public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
 {
     GenTemperature.PushHeat(explosion.Position, explosion.Map, def.explosionHeatEnergyPerCell * cellsToAffect.Count);
     MoteMaker.MakeStaticMote(explosion.Position, explosion.Map, ThingDefOf.Mote_ExplosionFlash, explosion.radius * 6f);
     if (explosion.Map == Find.CurrentMap)
     {
         float magnitude = (explosion.Position.ToVector3Shifted() - Find.Camera.transform.position).magnitude;
         Find.CameraDriver.shaker.DoShake(4f * explosion.radius / magnitude);
     }
     ExplosionVisualEffectCenter(explosion);
 }
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            base.Apply(target, dest);
            Map map = this.parent.pawn.Map;

            foreach (IntVec3 intVec in Find.CurrentMap.AllCells)
            {
                GenTemperature.PushHeat(target.Cell, map, 10f);
            }
            GenExplosion.DoExplosion(target.Cell, this.parent.pawn.MapHeld, this.Props.flameRadius, DamageDefOf.Flame, null, this.Props.flameDamage, -1, null, null, null, null, this.Props.filthType, 1, 1, false, null, 0, 0, 1f, false, null, null);
        }
    public override void ExplosionStart(Explosion explosion, List <IntVec3> cellsToAffect)
    {
        if (def.explosionHeatEnergyPerCell > 1.401298E-45f)
        {
            GenTemperature.PushHeat(explosion.Position, explosion.Map,
                                    def.explosionHeatEnergyPerCell * cellsToAffect.Count);
        }

        FleckMaker.Static(explosion.Position, explosion.Map, FleckDefOf.ExplosionFlash, explosion.radius * 6f);
        FleckMaker.Static(explosion.Position, explosion.Map, FleckDefOf.ExplosionFlash, explosion.radius * 6f);
        ExplosionVisualEffectCenter(explosion);
    }
Example #26
0
        public override void Tick()
        {
            base.Tick();
            if (!this.IsHashIntervalTick(60))
            {
                return;
            }
            if (!compPowerTrader.PowerOn)
            {
                return;
            }

            //None changed
            var intVec  = Position + IntVec3.South.RotatedBy(Rotation);
            var intVec2 = Position + IntVec3.North.RotatedBy(Rotation);
            var flag    = false;

            if (!intVec2.Impassable(this.Map) && !intVec.Impassable(this.Map))
            {
                var temperature  = intVec2.GetTemperature(this.Map);
                var temperature2 = intVec.GetTemperature(this.Map);
                var num          = temperature - temperature2;
                if (temperature - 40f > num)
                {
                    num = temperature - 40f;
                }
                var num2 = 1f - num * 0.0076923077f;
                if (num2 < 0f)
                {
                    num2 = 0f;
                }
                var num3 = compTempControl.Props.energyPerSecond * num2 * 4.16666651f;
                var num4 = GenTemperature.ControlTemperatureTempChange(intVec, this.Map, num3,
                                                                       compTempControl.targetTemperature);
                flag = !Mathf.Approximately(num4, 0f);
                if (flag)
                {
                    intVec.GetRoom(this.Map).Group.Temperature += num4;
                    GenTemperature.PushHeat(intVec2, this.Map, -num3 * 1.25f);
                }
            }
            if (flag)
            {
                compPowerTrader.PowerOutput = -compPowerTrader.Props.basePowerConsumption;
            }
            else
            {
                compPowerTrader.PowerOutput = -compPowerTrader.Props.basePowerConsumption *
                                              compTempControl.Props.lowPowerConsumptionFactor;
            }
            compTempControl.operatingAtHighPower = flag;
        }
Example #27
0
 public override void CompTick()
 {
     base.CompTick();
     if (parent.IsHashIntervalTick(HeatPushInterval) && ShouldPushHeatNow)
     {
         CompProperties_HeatPusher props = Props;
         var temperature = parent.Position.GetTemperature(parent.Map);
         if (temperature < props.heatPushMaxTemperature && temperature > props.heatPushMinTemperature)
         {
             GenTemperature.PushHeat(parent.Position, parent.Map, props.heatPerSecond);
         }
     }
 }
Example #28
0
        public override void CompTick()
        {
            base.CompTick();
            if (parent.IsHashIntervalTick(60))
            {
                if (Temperature > props.heatSuckMinTemperature)
                {
                    GenTemperature.PushHeat(parent.Position, parent.MapHeld, -props.coldPerSecond);
                }

                SnowUtility.AddSnowRadial(parent.Position, parent.Map, props.snowRadius, props.snowDepth);
            }
        }
 public override void CompTick()
 {
     base.CompTick();
     if (this.parent.IsHashIntervalTick(60) && this.ShouldPushHeatNow)
     {
         CompProperties_HeatPusher props = this.Props;
         float temperature = this.parent.Position.GetTemperature(this.parent.Map);
         if (temperature < props.heatPushMaxTemperature && temperature > props.heatPushMinTemperature)
         {
             GenTemperature.PushHeat(this.parent.Position, this.parent.Map, props.heatPerSecond);
         }
     }
 }
Example #30
0
        public override void CompTick()
        {
            base.CompTick();

            if (parent.IsHashIntervalTick(1000))
            {
                parent.TakeDamage(new DamageInfo(DamageDefOf.Crush, parent.MaxHitPoints * 0.01f));
            }

            if (parent.IsHashIntervalTick(60) && ShouldPushHeatNow)
            {
                GenTemperature.PushHeat(parent.PositionHeld, parent.MapHeld, -8);
            }
        }