rjw-events/Source/LordJobs/LordJob_Joinable_Orgy.cs

102 lines
2.4 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;
namespace RJW_Events
{
class LordJob_Joinable_Orgy : LordJob_Joinable_Party
{
2021-07-28 06:10:59 +00:00
List<Pawn> participants;
2021-04-12 07:48:48 +00:00
protected override ThoughtDef AttendeeThought
{
get
{
return ThoughtDefOf.AttendedOrgy;
}
}
protected override TaleDef AttendeeTale
{
get
{
return TaleDefOf.AttendedOrgy;
}
}
protected override ThoughtDef OrganizerThought
{
get
{
return ThoughtDefOf.AttendedOrgy;
}
}
protected override TaleDef OrganizerTale
{
get
{
return TaleDefOf.AttendedOrgy;
}
}
public LordJob_Joinable_Orgy(IntVec3 spot, Pawn organizer, GatheringDef gatheringDef) : base(spot, organizer, gatheringDef)
{
}
public override void ExposeData()
{
Scribe_Collections.Look<Pawn>(ref this.participants, "orgyParticipants", LookMode.Reference, Array.Empty<object>());
}
2021-04-12 07:48:48 +00:00
public override float VoluntaryJoinPriorityFor(Pawn p)
{
2021-04-13 19:40:37 +00:00
if (!CasualSex_Helper.CanHaveSex(p)) return 0;
2021-04-12 07:48:48 +00:00
2021-07-24 14:32:04 +00:00
if (ModLister.IdeologyInstalled)
{
var ideo = p.ideo.Ideo;
2021-07-28 06:10:59 +00:00
if (!ideo.HasPrecept(DefDatabase<PreceptDef>.GetNamed("Lovin_FreeApproved", true)) &&
!ideo.HasPrecept(DefDatabase<PreceptDef>.GetNamed("Lovin_Free", true)))
2021-07-24 14:32:04 +00:00
{
return 0;
}
}
2021-04-12 07:48:48 +00:00
return base.VoluntaryJoinPriorityFor(p);
}
2021-07-28 06:10:59 +00:00
public override void Notify_PawnAdded(Pawn p)
{
if(participants == null)
{
participants = new List<Pawn>();
}
participants.Add(p);
base.Notify_PawnAdded(p);
}
public override void Cleanup()
{
foreach(Pawn participant in participants)
{
participant.TryGetComp<CompRJW>().drawNude = false;
participant.Drawer.renderer.SetAllGraphicsDirty();
2021-07-28 06:10:59 +00:00
}
participants = null;
base.Cleanup();
}
2021-04-12 07:48:48 +00:00
}
}