コード例 #1
0
        public bool TryBeatFire(Fire targetFire)
        {
            bool result;

            if (this.BeatFireVerb == null)
            {
                Log.ErrorOnce(string.Concat(new object[]
                {
                    this.pawn,
                    " tried to beat fire ",
                    targetFire,
                    " but has no beat fire verb."
                }), 935137531, false);
                result = false;
            }
            else
            {
                result = (!this.pawn.stances.FullBodyBusy && this.BeatFireVerb.TryStartCastOn(targetFire, false, true));
            }
            return(result);
        }
コード例 #2
0
        private Job FleeLargeFireJob(Pawn pawn)
        {
            if (pawn.Map.listerThings.ThingsInGroup(ThingRequestGroup.Fire).Count < 60)
            {
                return(null);
            }
            TraverseParms tp            = TraverseParms.For(pawn);
            Fire          closestFire   = null;
            float         closestDistSq = -1f;
            int           firesCount    = 0;

            RegionTraverser.BreadthFirstTraverse(pawn.Position, pawn.Map, (Region from, Region to) => to.Allows(tp, isDestination : false), delegate(Region x)
            {
                List <Thing> list = x.ListerThings.ThingsInGroup(ThingRequestGroup.Fire);
                for (int i = 0; i < list.Count; i++)
                {
                    float num = pawn.Position.DistanceToSquared(list[i].Position);
                    if (!(num > 400f))
                    {
                        if (closestFire == null || num < closestDistSq)
                        {
                            closestDistSq = num;
                            closestFire   = (Fire)list[i];
                        }
                        firesCount++;
                    }
                }
                return(closestDistSq <= 100f && firesCount >= 60);
            }, 18);
            if (closestDistSq <= 100f && firesCount >= 60)
            {
                Job job = FleeJob(pawn, closestFire);
                if (job != null)
                {
                    return(job);
                }
            }
            return(null);
        }
コード例 #3
0
        protected override bool TryCastShot()
        {
            Fire fire       = (Fire)this.currentTarget.Thing;
            Pawn casterPawn = base.CasterPawn;
            bool result;

            if (casterPawn.stances.FullBodyBusy)
            {
                result = false;
            }
            else
            {
                Thing     thing      = fire;
                DamageDef extinguish = DamageDefOf.Extinguish;
                float     amount     = 32f;
                Thing     caster     = this.caster;
                thing.TakeDamage(new DamageInfo(extinguish, amount, 0f, -1f, caster, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null));
                casterPawn.Drawer.Notify_MeleeAttackOn(fire);
                result = true;
            }
            return(result);
        }
コード例 #4
0
        public static void TryAttachFire(this Thing t, float fireSize)
        {
            if (!t.CanEverAttachFire())
            {
                return;
            }
            if (t.HasAttachment(ThingDefOf.Fire))
            {
                return;
            }
            Fire fire = (Fire)ThingMaker.MakeThing(ThingDefOf.Fire, null);

            fire.fireSize = fireSize;
            fire.AttachTo(t);
            GenSpawn.Spawn(fire, t.Position, t.Map, Rot4.North, WipeMode.Vanish, false);
            Pawn pawn = t as Pawn;

            if (pawn != null)
            {
                pawn.jobs.StopAll(false);
                pawn.records.Increment(RecordDefOf.TimesOnFire);
            }
        }
コード例 #5
0
ファイル: FireUtility.cs プロジェクト: sachdevs/RW-Decompile
        public static void TryAttachFire(this Thing t, float fireSize)
        {
            if (!t.CanEverAttachFire())
            {
                return;
            }
            if (t.HasAttachment(ThingDefOf.Fire))
            {
                return;
            }
            Fire fire = (Fire)ThingMaker.MakeThing(ThingDefOf.Fire, null);

            fire.fireSize = fireSize;
            fire.AttachTo(t);
            GenSpawn.Spawn(fire, t.Position, t.Map, Rot4.North, false);
            Pawn pawn = t as Pawn;

            if (pawn != null)
            {
                pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                pawn.records.Increment(RecordDefOf.TimesOnFire);
            }
        }