public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (Widgets.ButtonText(rect, "Reset Bladder")) { NeedUtil.GetBladder(pawn).CurLevelPercentage = 0.28f; } }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (Widgets.ButtonText(rect, "Reset Libido")) { NeedUtil.GetSexNeed(pawn).CurLevelPercentage = 0f; } }
public override void Tick() { var sexNeed = NeedUtil.GetSexNeed(pawn).CurLevelPercentage; if (sexNeed < 0.3f) { Severity = 1f; } else if (sexNeed < 0.7f) { Severity = 0.5f; } else { Severity = 0; } }
public override bool TryMakePreToilReservations() { duration = 0; anal = false; pissDrinking = false; if (NeedUtil.GetSexNeed(pawn).CurLevelPercentage < minLibido + 0.1f || NeedUtil.GetSexNeed(Receiver).CurInstantLevelPercentage < minLibido + 0.1f) { duration += 500; anal = true; } if (NeedUtil.GetBladder(pawn).CurLevelPercentage < maxBladder + 0.1f) { duration += 100; pissDrinking = true; } return(true); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOnDowned(TargetIndex.A); this.FailOnNotCasualInterruptible(TargetIndex.A); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); Toil prepare = Toils_General.WaitWith(TargetIndex.A, duration, false, false); prepare.tickAction = delegate { if (pawn.IsHashIntervalTick(TicksBetweenHeartMotes)) { MoteMaker.ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart); } if (Receiver.IsHashIntervalTick(TicksBetweenHeartMotes)) { MoteMaker.ThrowMetaIcon(Receiver.Position, pawn.Map, ThingDefOf.Mote_Heart); } }; yield return(prepare); yield return(Toils_General.Do(delegate { if (anal) { NeedUtil.GetSexNeed(pawn).CurLevelPercentage = 1; NeedUtil.GetSexNeed(Receiver).CurLevelPercentage = 1; } if (pissDrinking) { NeedUtil.GetBladder(pawn).CurLevelPercentage = 1; } pawn.needs.mood.thoughts.memories.TryGainMemory(DefDatabase <ThoughtDef> .GetNamed("HadSex"), Receiver); Receiver.needs.mood.thoughts.memories.TryGainMemory(DefDatabase <ThoughtDef> .GetNamed("HadSex"), pawn); pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true); })); }
protected override Job TryGiveJob(Pawn pawn) { var failconditions = pawn.gender != Gender.Male || !pawn.IsColonist; if (failconditions) { Log.Message("Failed : " + pawn.Name.ToStringShort); return(null); } var nearbyPawns = PawnFinder.GetNearbyPawns(pawn); var females = nearbyPawns.Where(x => x.gender == Gender.Female && x.CanCasuallyInteractNow()); if (females.Count() == 0) { return(null); } var female = females.MinBy(x => NeedUtil.GetSexNeed(x).CurLevelPercentage); if (female == null) { Log.Message("Cant find other pawn"); return(null); } failconditions = (NeedUtil.GetSexNeed(pawn).CurLevelPercentage > sexTrigger && pawn.needs.TryGetNeed <Need_Bladder>().CurLevelPercentage > maxBladder && NeedUtil.GetSexNeed(female).CurLevelPercentage > sexTrigger); if (failconditions) { return(null); } Log.Message("Found other pawn"); return(new Job(DefDatabase <JobDef> .GetNamed("HaveSex"), female)); }