rjw-events/Source/JobDrivers/JobDriver_OrgySexReceiver.cs

81 lines
1.8 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);
float num = xxx.get_sex_ability(base.Partner);
if (num < 0.8f)
{
this.ticks_between_thrusts += 120;
}
else if (num > 2f)
{
this.ticks_between_thrusts -= 30;
}
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);
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))
{
base.ThrowMetaIcon(this.pawn.Position, this.pawn.Map, ThingDefOf.Mote_Heart);
}
};
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;
}
}
}