private static void AppendByInfo(Info info)
        {
            ReligionProperty weaponProperty = GetProperty(info.instigator, info.victim, SettingsTagDefOf.WeaponTag, info.weapon);

            AppendForPawn(info.instigator, info.victim, weaponProperty, true);

            foreach (ReligionProperty prop in GetProperties(info.instigator, info.victim, SettingsTagDefOf.KillTag, info.criteria))
            {
                AppendForPawn(info.instigator, info.victim, prop, true);
            }

            foreach (Pawn pawn in info.witnesses)
            {
                if (info.instigator != null)
                {
                    foreach (ReligionProperty prop in GetProperties(pawn, info.instigator, SettingsTagDefOf.KillTag, info.criteria))
                    {
                        AppendForPawn(pawn, info.instigator, prop, false);
                    }
                }
                else
                {
                    foreach (ReligionProperty prop in GetProperties(pawn, info.victim, SettingsTagDefOf.DeathTag, info.criteria))
                    {
                        AppendForPawn(pawn, info.victim, prop, false);
                    }
                }
            }
        }
Пример #2
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            if (!p.RaceProps.Humanlike)
            {
                return((ThoughtState)false);
            }

            if (!RelationsUtility.PawnsKnowEachOther(p, other))
            {
                return((ThoughtState)false);
            }

            Religion thisPawnReligion  = p.GetReligionComponent().Religion;
            Religion otherPawnReligion = other.GetReligionComponent().Religion;

            ReligionSettings_Social opinionSettings = thisPawnReligion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.OpinionTag);

            if (opinionSettings == null)
            {
                return((ThoughtState)false);
            }

            ReligionProperty property = opinionSettings.GetPropertyByObject(p, otherPawnReligion.Def, other);

            if (property == null || property.Witness == null || property.Witness.OpinionThought == null || property.Witness.OpinionThought != this.def)
            {
                return((ThoughtState)false);
            }

            return(ThoughtState.ActiveAtStage(p.GetReligionComponent().PietyTracker.PietyNeed.CurCategoryInt, otherPawnReligion.Def.LabelCap));
        }
Пример #3
0
 public ActivityTask(ActivityTask task)
 {
     this.dayOfTask = task.dayOfTask;
     this.startHour = task.startHour;
     this.property  = task.property;
     this.loadID    = Find.UniqueIDsManager.GetNextBillID();
     this.humanlike = task.humanlike;
     this.animal    = task.humanlike;
     this.filter    = task.filter;
 }
 private static void AppendForPawn(Pawn pawn, Pawn otherPawm, ReligionProperty property, bool isSubject)
 {
     if (property != null)
     {
         if (isSubject)
         {
             PietyUtility.TryApplyOnPawn(property.Subject, pawn, property.GetObject().LabelCap, otherPawm);
         }
         else
         {
             PietyUtility.TryApplyOnPawn(property.Witness, pawn, property.GetObject().LabelCap, otherPawm);
         }
     }
 }
        public override PietyState CurrentState(Pawn p)
        {
            CompReligion comp = p.GetReligionComponent();

            if (comp == null)
            {
                return(PietyState.Inactive);
            }

            ReligionSettings_Social settings = comp.Religion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.TemperatureTag);

            if (settings == null)
            {
                return(PietyState.Inactive);
            }

            ReligionProperty property = settings.DefaultPropety;

            if (property == null || property.Subject == null || property.Subject.Piety == null || property.Subject.Piety != this.def)
            {
                return(PietyState.Inactive);
            }

            float num = p.AmbientTemperature;

            if ((double)num >= 0.0)
            {
                return(PietyState.Inactive);
            }
            if ((double)num > -10.0)
            {
                return(PietyState.ActiveAtStage(0));
            }
            if ((double)num > -20.0)
            {
                return(PietyState.ActiveAtStage(1));
            }
            if ((double)num > -30.0)
            {
                return(PietyState.ActiveAtStage(2));
            }
            if ((double)num > -40.0)
            {
                return(PietyState.ActiveAtStage(3));
            }
            return(PietyState.ActiveAtStage(4));
        }
Пример #6
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            CompReligion comp = p.GetReligionComponent();

            if (comp == null)
            {
                return(ThoughtState.Inactive);
            }

            ReligionSettings_Social settings = comp.Religion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.TemperatureTag);

            if (settings == null)
            {
                return(ThoughtState.Inactive);
            }

            ReligionProperty property = settings.DefaultPropety;

            if (property == null || property.Subject == null || property.Subject.Piety == null || property.Subject.Thought != this.def)
            {
                return(ThoughtState.Inactive);
            }

            float num = p.AmbientTemperature;

            if ((double)num <= 0.0)
            {
                return(ThoughtState.Inactive);
            }
            if ((double)num < 10.0)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            if ((double)num < 20.0)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            if ((double)num < 30.0)
            {
                return(ThoughtState.ActiveAtStage(2));
            }
            if ((double)num < 40.0)
            {
                return(ThoughtState.ActiveAtStage(3));
            }
            return(ThoughtState.ActiveAtStage(4));
        }
Пример #7
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil relax;

            if (this.FromBed)
            {
                this.KeepLyingDown(TargetIndex.A);
                yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.A, TargetIndex.None));

                yield return(Toils_Bed.GotoBed(TargetIndex.A));

                relax = Toils_LayDown.LayDown(TargetIndex.A, true, false, true, true);
                relax.AddFailCondition(() => !this.pawn.Awake());
            }
            else
            {
                yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

                relax            = new Toil();
                relax.initAction = delegate
                {
                    this.faceDir = ((!this.job.def.faceDir.IsValid) ? Rot4.Random : this.job.def.faceDir);
                };
                relax.handlingFacing = true;
            }
            relax.defaultCompleteMode = ToilCompleteMode.Delay;
            relax.defaultDuration     = this.job.def.joyDuration;
            relax.AddPreTickAction(delegate
            {
                if (this.faceDir.IsValid)
                {
                    this.pawn.rotationTracker.FaceCell(this.pawn.Position + this.faceDir.FacingCell);
                }
                this.pawn.GainComfortFromCellIfPossible();
                JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.EndJob, 1f, null);
                PrayUtility.TickCheckEnd(pawn);
            });
            yield return(relax);

            this.AddFinishAction(() =>
            {
                ReligionProperty property = pawn.GetReligionComponent().Religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag).Property;
                PietyUtility.TryApplyOnPawn(property.Subject, pawn);
            });
        }
Пример #8
0
 public ActivityTask(ScheduledDay dayOfTask, ReligionProperty property)
 {
     this.dayOfTask = dayOfTask;
     if (Scribe.mode == LoadSaveMode.Inactive)
     {
         this.loadID   = Find.UniqueIDsManager.GetNextThingID();
         startHour     = 18;
         this.property = property;
         humanlike     = new IngredientPawn();
         animal        = new IngredientPawn();
         List <ThingDef> defs = new List <ThingDef>();
         foreach (ThingDefsCount tcd in ActivityTaskDef.ThingDefsCount)
         {
             defs.Add(tcd.Thing);
         }
         filter = new SimpleFilter(defs);
     }
 }
Пример #9
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            base.AddEndCondition(delegate
            {
                Thing thing = this.GetActor().jobs.curJob.GetTarget(TargetIndex.A).Thing;
                if (thing is Building && !thing.Spawned)
                {
                    return(JobCondition.Incompletable);
                }
                return(JobCondition.Ongoing);
            });
            this.FailOnBurningImmobile(TargetIndex.A);

            if (TargetC.HasThing)
            {
                yield return(Toils_Goto.GotoCell(TargetIndex.C, PathEndMode.OnCell));
            }
            else
            {
                yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell));
            }

            yield return(new Toil()
            {
                defaultCompleteMode = ToilCompleteMode.Never,
                tickAction = delegate
                {
                    PrayUtility.TickCheckEnd(pawn);
                    this.pawn.rotationTracker.FaceCell(base.TargetA.Cell);
                    this.pawn.GainComfortFromCellIfPossible();
                }
            });

            this.AddFinishAction(() =>
            {
                ReligionProperty property = pawn.GetReligionComponent().Religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag).Property;
                PietyUtility.TryApplyOnPawn(property.Subject, pawn);
            });
        }
        public override PietyState CurrentState(Pawn p)
        {
            CompReligion   comp        = p.GetReligionComponent();
            string         reason      = (string)null;
            int            num         = 0;
            List <Apparel> wornApparel = p.apparel.WornApparel;

            if (comp == null)
            {
                return(PietyState.Inactive);
            }

            ReligionSettings_Social settings = comp.Religion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.ApparelTag);

            if (settings == null)
            {
                return(PietyState.Inactive);
            }

            for (int index = 0; index < wornApparel.Count; ++index)
            {
                ReligionProperty property = settings.GetPropertyByObject(p, wornApparel[index].Stuff);

                if (property != null && property.Subject.Piety == this.def)
                {
                    if (reason == null)
                    {
                        reason = wornApparel[index].def.label;
                    }
                    ++num;
                }
            }
            if (num == 0)
            {
                return(PietyState.Inactive);
            }
            return(PietyState.ActiveAtStage((num - 1) + (comp.PietyTracker.PietyNeed.CurCategoryInt * 5), reason));
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            CompReligion   comp        = p.GetReligionComponent();
            string         reason      = (string)null;
            int            num         = 0;
            List <Apparel> wornApparel = p.apparel.WornApparel;

            if (comp == null)
            {
                return(ThoughtState.Inactive);
            }

            ReligionSettings_Social settings = comp.Religion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.ApparelTag);

            if (settings == null)
            {
                return(ThoughtState.Inactive);
            }

            for (int index = 0; index < wornApparel.Count; ++index)
            {
                ReligionProperty property = settings.GetPropertyByObject(p, wornApparel[index].def);

                if (property != null && property.Subject.Thought == this.def)
                {
                    if (reason == null)
                    {
                        reason = wornApparel[index].def.label;
                    }
                    ++num;
                }
            }
            if (num == 0)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(num - 1, reason));
        }