rjw-events/Source/JobDrivers/JobDriver_OrgySexReceiver.cs

73 lines
1.7 KiB
C#
Raw Normal View History

2021-04-12 07:48:48 +00:00
using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
namespace RJW_Events
{
public class JobDriver_OrgySexReceiver : JobDriver_SexBaseReciever
2021-04-12 07:48:48 +00:00
{
protected override IEnumerable<Toil> MakeNewToils()
{
base.setup_ticks();
this.parteners.Add(base.Partner);
if (this.pawn.relations.OpinionOf(base.Partner) < 0)
{
this.ticks_between_hearts += 50;
}
else if (this.pawn.relations.OpinionOf(base.Partner) > 60)
{
this.ticks_between_hearts -= 25;
}
this.FailOnDespawnedOrNull(this.iTarget);
this.FailOn(() => this.Partner == null);
2021-04-12 17:43:58 +00:00
this.FailOn(() => !(Partner.jobs.curDriver is JobDriver_Sex));
2021-04-12 07:48:48 +00:00
this.FailOn(() => !base.Partner.health.capacities.CanBeAwake);
this.FailOn(() => this.pawn.Drafted);
this.FailOn(() => base.Partner.Drafted);
yield return Toils_Reserve.Reserve(this.iTarget, 1, 0, null);
Toil toil2 = this.MakeSexToil();
toil2.handlingFacing = false;
yield return toil2;
yield break;
}
private Toil MakeSexToil()
{
Toil toil = new Toil();
toil.defaultCompleteMode = ToilCompleteMode.Never;
2021-04-13 19:40:37 +00:00
toil.socialMode = RandomSocialMode.Normal;
2021-04-12 07:48:48 +00:00
toil.handlingFacing = true;
toil.tickAction = delegate ()
{
if (this.pawn.IsHashIntervalTick(this.ticks_between_hearts))
{
2021-07-23 22:49:39 +00:00
FleckMaker.ThrowMetaIcon(this.pawn.Position, this.pawn.Map, FleckDefOf.Heart);
2021-04-12 07:48:48 +00:00
}
};
toil.AddEndCondition(delegate
{
if (this.parteners.Count <= 0)
{
return JobCondition.Succeeded;
}
return JobCondition.Ongoing;
2021-04-12 17:43:58 +00:00
});
2021-04-12 07:48:48 +00:00
toil.socialMode = RandomSocialMode.Off;
return toil;
}
}
}