Exemple #1
0
 public override void CompTick()
 {
     if (FireUtility.ContainsStaticFire(base.parent.Position, base.parent.Map))
     {
         this.BurningNow = true;
         for (int i = 0; i < 4; i++)
         {
             IntVec3      vec    = base.parent.Position + GenAdj.CardinalDirectionsAround[i];
             List <Thing> things = base.parent.Map.thingGrid.ThingsListAt(vec);
             for (int j = 0; j < things.Count; j++)
             {
                 FlammableLinkComp comp = things[j].TryGetComp <FlammableLinkComp>();
                 if (comp != null && this.IsConnected(comp))
                 {
                     comp.TrySparksFly(compDef.ignitionDef.spreadPower);
                 }
             }
         }
     }
     else
     {
         this.BurningNow    = false;
         this.AmountOfHeat -= this.WeatherFactor(this.compDef.ignitionDef.easeCooling, CorrectWeatherFactorCooling);
         if (this.AmountOfHeat < 0)
         {
             this.AmountOfHeat = 0;
         }
     }
 }
Exemple #2
0
        private IntVec3 GetCell(ref IntVec3 root, Map map) => CellFinder.RandomClosewalkCellNear(root, map, Radius,
                                                                                                 (IntVec3 vec) =>
        {
            if (FireUtility.ContainsStaticFire(vec, map))
            {
                return(false);
            }

            return(true);
        });
Exemple #3
0
        protected virtual void TryBurning(float fireSize)
        {
            if (FireUtility.ContainsStaticFire(base.parent.Position, base.parent.Map))
            {
                return;
            }

            Fire fire = (Fire)ThingMaker.MakeThing(ThingDefOf.Fire, null);

            fire.fireSize = fireSize;
            GenSpawn.Spawn(fire, base.parent.Position, base.parent.Map, Rot4.North);
            return;
        }
Exemple #4
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 cell = CellFinder.RandomClosewalkCellNear(pawn.Position, pawn.Map, 10, (IntVec3 vec) =>
            {
                if (FireUtility.ContainsStaticFire(vec, pawn.Map))
                {
                    return(false);
                }

                return(true);
            });

            Job job = new Job(JobDefOfLocal.FireAround, cell);

            return(job);
        }
Exemple #5
0
        public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
        {
            absorbed = false;

            if (this.flammableLinkcomp != null)
            {
                if (!(FireUtility.ContainsStaticFire(base.Position, base.Map)))
                {
                    if ((dinfo.Instigator != null && dinfo.Instigator.Faction != Faction.OfPlayer) && !(dinfo.Weapon != null && dinfo.Weapon.IsRangedWeapon))
                    {
                        return;
                    }

                    float heat = flammableLinkcomp.HeatedByHitOf(dinfo);
                    this.flammableLinkcomp.TrySparksFly(heat);
                    MoteUtility.DrawHeatedMote(this.flammableLinkcomp.HeatRatio, base.DrawPos, base.Position, base.Map);
                    dinfo.SetAmount(0);
                }
            }
        }