mirror of
https://gitgud.io/c0ffeeeeeeee/rjw-events.git
synced 2024-08-14 23:57:42 +00:00
first commit
This commit is contained in:
parent
1c82248286
commit
6d1a218b2e
23 changed files with 836 additions and 0 deletions
20
Source/DefOfs/TaleDefOf.cs
Normal file
20
Source/DefOfs/TaleDefOf.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using RimWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
[DefOf]
|
||||
public static class TaleDefOf
|
||||
{
|
||||
static TaleDefOf()
|
||||
{
|
||||
DefOfHelper.EnsureInitializedInCtor(typeof(TaleDefOf));
|
||||
}
|
||||
|
||||
public static TaleDef AttendedOrgy;
|
||||
}
|
||||
}
|
20
Source/DefOfs/ThoughtDefOf.cs
Normal file
20
Source/DefOfs/ThoughtDefOf.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using RimWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
[DefOf]
|
||||
public static class ThoughtDefOf
|
||||
{
|
||||
static ThoughtDefOf()
|
||||
{
|
||||
DefOfHelper.EnsureInitializedInCtor(typeof(ThoughtDefOf));
|
||||
}
|
||||
|
||||
public static ThoughtDef AttendedOrgy;
|
||||
}
|
||||
}
|
25
Source/GatheringWorkers/GatheringWorker_Orgy.cs
Normal file
25
Source/GatheringWorkers/GatheringWorker_Orgy.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using RimWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using Verse.AI.Group;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
class GatheringWorker_Orgy : GatheringWorker
|
||||
{
|
||||
|
||||
protected override LordJob CreateLordJob(IntVec3 spot, Pawn organizer)
|
||||
{
|
||||
return new LordJob_Joinable_Orgy(spot, organizer, this.def);
|
||||
}
|
||||
protected override bool TryFindGatherSpot(Pawn organizer, out IntVec3 spot)
|
||||
{
|
||||
return RCellFinder.TryFindGatheringSpot_NewTemp(organizer, this.def, false, out spot);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
29
Source/JobDrivers/JobDriver_GetNaked.cs
Normal file
29
Source/JobDrivers/JobDriver_GetNaked.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
class JobDriver_GetNaked : JobDriver
|
||||
{
|
||||
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
Toil t = new Toil();
|
||||
t.AddFinishAction(() => {
|
||||
|
||||
SexUtility.DrawNude(pawn);
|
||||
|
||||
});
|
||||
yield return t;
|
||||
}
|
||||
}
|
||||
}
|
111
Source/JobDrivers/JobDriver_OrgySex.cs
Normal file
111
Source/JobDrivers/JobDriver_OrgySex.cs
Normal file
|
@ -0,0 +1,111 @@
|
|||
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;
|
||||
using Verse.AI.Group;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
class JobDriver_OrgySex : JobDriver_SexQuick
|
||||
{
|
||||
|
||||
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
base.setup_ticks();
|
||||
JobDef PartnerJob = DefDatabase<JobDef>.GetNamed("GettinOrgySex", true);
|
||||
this.FailOnDespawnedNullOrForbidden(this.iTarget);
|
||||
this.FailOn(() => !this.Partner.health.capacities.CanBeAwake);
|
||||
this.FailOn(() => this.pawn.IsFighting());
|
||||
this.FailOn(() => this.Partner.IsFighting());
|
||||
this.FailOn(() => this.pawn.Drafted);
|
||||
yield return Toils_Goto.GotoThing(this.iTarget, PathEndMode.OnCell);
|
||||
yield return new Toil
|
||||
{
|
||||
defaultCompleteMode = ToilCompleteMode.Delay,
|
||||
initAction = delegate ()
|
||||
{
|
||||
this.ticksLeftThisToil = 5000;
|
||||
},
|
||||
tickAction = delegate ()
|
||||
{
|
||||
this.pawn.GainComfortFromCellIfPossible(false);
|
||||
if (this.pawn.Position.DistanceTo(this.Partner.Position) <= 1f)
|
||||
{
|
||||
this.ReadyForNextToil();
|
||||
}
|
||||
}
|
||||
};
|
||||
yield return new Toil
|
||||
{
|
||||
defaultCompleteMode = ToilCompleteMode.Instant,
|
||||
socialMode = RandomSocialMode.Off,
|
||||
initAction = delegate ()
|
||||
{
|
||||
|
||||
if(Partner.CurJob.def != PartnerJob)
|
||||
{
|
||||
Job newJob = JobMaker.MakeJob(PartnerJob, this.pawn, this.Partner);
|
||||
this.Partner.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Toil toil = new Toil();
|
||||
toil.defaultCompleteMode = ToilCompleteMode.Never;
|
||||
toil.socialMode = RandomSocialMode.Off;
|
||||
toil.defaultDuration = this.duration;
|
||||
toil.handlingFacing = true;
|
||||
toil.FailOn(() => this.Partner.CurJob.def != PartnerJob);
|
||||
toil.initAction = delegate ()
|
||||
{
|
||||
this.Partner.pather.StopDead();
|
||||
this.Partner.jobs.curDriver.asleep = false;
|
||||
this.usedCondom = (CondomUtility.TryUseCondom(this.pawn) || CondomUtility.TryUseCondom(this.Partner));
|
||||
this.Start();
|
||||
};
|
||||
toil.AddPreTickAction(delegate
|
||||
{
|
||||
this.ticks_left--;
|
||||
if (this.pawn.IsHashIntervalTick(this.ticks_between_hearts))
|
||||
{
|
||||
this.ThrowMetaIcon(this.pawn.Position, this.pawn.Map, ThingDefOf.Mote_Heart);
|
||||
}
|
||||
this.SexTick(this.pawn, this.Partner, true, true);
|
||||
SexUtility.reduce_rest(this.Partner, 1f);
|
||||
SexUtility.reduce_rest(this.pawn, 1f);
|
||||
if (this.ticks_left <= 0)
|
||||
{
|
||||
this.ReadyForNextToil();
|
||||
}
|
||||
});
|
||||
toil.AddFinishAction(delegate
|
||||
{
|
||||
this.End();
|
||||
if(LordUtility.GetLord(pawn)?.CurLordToil != null && !(LordUtility.GetLord(pawn).CurLordToil is LordToil_End))
|
||||
SexUtility.DrawNude(pawn);
|
||||
});
|
||||
yield return toil;
|
||||
yield return new Toil
|
||||
{
|
||||
initAction = delegate ()
|
||||
{
|
||||
SexUtility.ProcessSex(this.pawn, this.Partner, this.usedCondom, this.isRape, false, false, this.sexType);
|
||||
},
|
||||
defaultCompleteMode = ToilCompleteMode.Instant
|
||||
};
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
79
Source/JobDrivers/JobDriver_OrgySexReceiver.cs
Normal file
79
Source/JobDrivers/JobDriver_OrgySexReceiver.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
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
|
||||
{
|
||||
class JobDriver_OrgySexReceiver : JobDriver_SexBaseReciever
|
||||
{
|
||||
|
||||
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);
|
||||
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;
|
||||
toil.socialMode = RandomSocialMode.Off;
|
||||
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;
|
||||
});
|
||||
toil.socialMode = RandomSocialMode.Off;
|
||||
return toil;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
102
Source/JobGivers/JobGiver_FindOrgyPartner.cs
Normal file
102
Source/JobGivers/JobGiver_FindOrgyPartner.cs
Normal file
|
@ -0,0 +1,102 @@
|
|||
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;
|
||||
using Verse.AI.Group;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
|
||||
|
||||
public class JobGiver_FindOrgyPartner : ThinkNode_JobGiver
|
||||
{
|
||||
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
if (!RJWHookupSettings.HookupsEnabled)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (pawn.Drafted)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Pawn_MindState mindState = pawn.mindState;
|
||||
DutyDef dutyDef;
|
||||
if (mindState == null)
|
||||
{
|
||||
dutyDef = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
PawnDuty duty = mindState.duty;
|
||||
dutyDef = ((duty != null) ? duty.def : null);
|
||||
}
|
||||
if (dutyDef == DutyDefOf.TravelOrLeave)
|
||||
{
|
||||
if (RJWSettings.DebugLogJoinInBed)
|
||||
{
|
||||
ModLog.Message("JoinInBed.TryGiveJob:(" + xxx.get_pawnname(pawn) + "): has TravelOrLeave, no time for lovin!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!CasualSex_Helper.CanHaveSex(pawn))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns;
|
||||
|
||||
Pawn pawn2 = null;
|
||||
if(!BestPawnForOrgyExists(pawn, targets, out pawn2))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (pawn2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pawn2.jobs.curDriver is JobDriver_SexBaseInitiator)
|
||||
{
|
||||
pawn2 = (Pawn)pawn2.CurJob.targetA;
|
||||
}
|
||||
else if (pawn.CurJob != null && pawn.jobs.curDriver != null)
|
||||
{
|
||||
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
|
||||
}
|
||||
return JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("OrgySex", true), pawn2);
|
||||
}
|
||||
|
||||
public bool BestPawnForOrgyExists(Pawn pawn1, List<Pawn> targets, out Pawn result)
|
||||
{
|
||||
if(targets.TryRandomElementByWeight((Pawn p) => {
|
||||
|
||||
float chance = pawn1.relations.SecondaryRomanceChanceFactor(p);
|
||||
if(!(p.jobs.curDriver is JobDriver_Sex))
|
||||
{
|
||||
//higher chance if person is doing nothing
|
||||
chance *= 3f;
|
||||
}
|
||||
return chance;
|
||||
|
||||
}, out Pawn option)) {
|
||||
result = option;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
18
Source/JobGivers/JobGiver_GetNaked.cs
Normal file
18
Source/JobGivers/JobGiver_GetNaked.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
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 JobGiver_GetNaked : ThinkNode_JobGiver
|
||||
{
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
return JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("GetNaked", true));
|
||||
}
|
||||
}
|
||||
}
|
64
Source/LordJobs/LordJob_Joinable_Orgy.cs
Normal file
64
Source/LordJobs/LordJob_Joinable_Orgy.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
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
|
||||
{
|
||||
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 float VoluntaryJoinPriorityFor(Pawn p)
|
||||
{
|
||||
if (!CasualSex_Helper.CanHaveSex(p) || p.Map.mapPawns.FreeColonists.Exists((Pawn p1) =>
|
||||
{
|
||||
|
||||
return p.relations.SecondaryRomanceChanceFactor(p1) > 0 || p1.relations.SecondaryRomanceChanceFactor(p) > 0;
|
||||
|
||||
})) return 0;
|
||||
|
||||
return base.VoluntaryJoinPriorityFor(p);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
24
Source/Patches/HarmonyPatch_ReclotheOnEnd.cs
Normal file
24
Source/Patches/HarmonyPatch_ReclotheOnEnd.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
[HarmonyPatch(typeof(LordJob_Joinable_Party), "ApplyOutcome")]
|
||||
public static class HarmonyPatch_ReclotheOnEnd
|
||||
{
|
||||
public static void Postfix(LordToil_Party toil)
|
||||
{
|
||||
List<Pawn> ownedPawns = toil.lord.ownedPawns;
|
||||
foreach(Pawn p in ownedPawns)
|
||||
{
|
||||
p.Drawer.renderer.graphics.ResolveApparelGraphics();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
Source/Patches/Harmony_PatchAll.cs
Normal file
21
Source/Patches/Harmony_PatchAll.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
class Harmony_PatchAll
|
||||
{
|
||||
static Harmony_PatchAll()
|
||||
{
|
||||
Harmony harmony = new Harmony("rimworldevents");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
}
|
||||
}
|
39
Source/ThinkNodes/ThinkNode_ConditionalNude.cs
Normal file
39
Source/ThinkNodes/ThinkNode_ConditionalNude.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
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 ThinkNode_ConditionalNude : ThinkNode_Conditional
|
||||
{
|
||||
protected override bool Satisfied(Pawn pawn)
|
||||
{
|
||||
//if pawn is rendering apparel they shouldn't be,
|
||||
if (pawn.Drawer.renderer.graphics.apparelGraphics.Any((ApparelGraphicRecord x) => {
|
||||
|
||||
if (x.sourceApparel.def.defName.ToLower().ContainsAny(new string[]
|
||||
{
|
||||
"vibrator",
|
||||
"piercing",
|
||||
"strapon"
|
||||
}) || (RJWPreferenceSettings.sex_wear == RJWPreferenceSettings.Clothing.Headgear && !x.sourceApparel.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}))
|
||||
{
|
||||
//they aren't nude
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue