public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { if (t == null || pawn == null) { return(null); } Pawn pawn2 = t as Pawn; if (!PawnHelper.is_human(pawn) || !PawnHelper.is_human(pawn2)) { return(null); } if (IsMate(pawn, pawn2)) { return(new Job(Constants.JobWooHoo_Baby, pawn2, bed) { count = 1 }); } else { return(new Job(Constants.JobWooHoo, pawn2, bed) { count = 1 }); } }
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { if (t == null || pawn == null) { return(false); } if (t is Pawn pawn2 && pawn != pawn2 && (forced || canAutoLove(pawn, pawn2)) && !pawn2.Downed && !pawn2.Drafted && !pawn.Drafted && PawnHelper.is_human(pawn) && PawnHelper.is_human(pawn2) && PawnHelper.IsNotWoohooing(pawn) && PawnHelper.IsNotWoohooing(pawn2)) { LocalTargetInfo target = pawn2; if (!pawn.CanReserve(target, 1, -1, null, forced)) { return(false); } bed = BetterBedFinder.DoBetterBedFinder(pawn, pawn2); return(bed != null); } return(false); }
public override bool TryMakePreToilReservations(bool errorOnFailed) { Pawn mate; Building_Bed bed; if (TargetA != null && TargetA.Thing != null && (mate = TargetA.Thing as Pawn) != null && TargetB != null && TargetB.Thing != null && (bed = TargetB.Thing as Building_Bed) != null && pawn != null && PawnHelper.is_human(pawn) && PawnHelper.is_human(mate) && !bed.IsBurning() && pawn.mindState.canLovinTick < Find.TickManager.TicksGame ) { return(true); //base.TryMakePreToilReservations(errorOnFailed); } Log.Message("[" + pawn.Name + "] can't woohoo right. Timing out their lovin for 500 ticks. They tried to some weird stuff:" + this.GetReport(), true); pawn.mindState.canLovinTick = Find.TickManager.TicksGame + 500; return(false); }
protected override IEnumerable <Toil> MakeNewToils() { //Pawn mate = TargetA.Thing as Pawn; //Building_Bed bed = TargetB.Thing as Building_Bed; Pawn mate; Building_Bed bed; if (TargetA != null && TargetA.Thing != null && (mate = TargetA.Thing as Pawn) != null && TargetB != null && TargetB.Thing != null && (bed = TargetB.Thing as Building_Bed) != null && pawn != null && PawnHelper.is_human(pawn) && PawnHelper.is_human(mate) && !bed.IsBurning() ) { //everything is in order then } else { Log.Error("[" + pawn.Name + "] can't woohoo right.", true); EndJobWith(JobCondition.Errored); return(null); } if (pawn == mate) { throw new Exception("You cant WooHoo Alone and Together with yourself"); } var hookupBedManager = new HookupBedManager(bed); bool partnerSaidYes; IEnumerable <Toil> toilsAskForWoohoo; if (PawnHelper.IsNotWoohooing(mate)) { pawn.records.Increment(Constants.CountAskedForWoohoo); mate.records.Increment(Constants.CountGotAskedToWooHoo); partnerSaidYes = AskPartner(pawn, mate); toilsAskForWoohoo = WoohooManager.ToilsAskForWoohoo(pawn, mate, bed, partnerSaidYes, hookupBedManager); } else { /* Log.Message("Partner already woohooin, dont need to ask."); */ partnerSaidYes = true; toilsAskForWoohoo = nothing(); } ///Log.Message("[WooHoo]Toils Ongoing: ["+r.Count()+"]"); if (partnerSaidYes) { toilsAskForWoohoo = toilsAskForWoohoo?.Union(WoohooManager.MakePartnerWoohoo(pawn, mate, bed)) .Union(WoohooManager.AnimateLovin(pawn, mate, bed)) .Union(MakeMyLoveToils(pawn, mate)) .Union( WoohooManager.AnimateLovin(pawn, mate, bed, null , 500) ); } else { mate.records.Increment(Constants.CountGotAskedToWooHooSaidNo); } toilsAskForWoohoo = toilsAskForWoohoo?.Union(hookupBedManager.GiveBackToil()); /* Log.Message("[WooHoo]Toils: ["+r.Count()+"]"); */ PawnHelper.DelayNextWooHoo(pawn); return(toilsAskForWoohoo); }