mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
vanilla lovin does animation
This commit is contained in:
parent
b04afef7b1
commit
1e05e7a3dc
7 changed files with 77 additions and 6 deletions
Binary file not shown.
|
@ -2,7 +2,8 @@
|
|||
|
||||
<ModMetaData>
|
||||
<name>Rimworld-Animations</name>
|
||||
<author>Platinumspoons</author>
|
||||
<author>C0ffee</author>
|
||||
<url>https://gitgud.io/Platinumspoons/rimworld-animations/</url>
|
||||
<supportedVersions>
|
||||
<li>1.1</li>
|
||||
</supportedVersions>
|
||||
|
@ -20,12 +21,23 @@
|
|||
<downloadUrl>https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest</downloadUrl>
|
||||
<steamWorkshopUrl>steam://url/CommunityFilePage/818773962</steamWorkshopUrl>
|
||||
</li>
|
||||
<li>
|
||||
<packageId>rim.job.world</packageId>
|
||||
<displayName>RimJobWorld</displayName>
|
||||
<downloadUrl>https://www.loverslab.com/topic/110270-mod-rimjobworld/</downloadUrl>
|
||||
</li>
|
||||
</modDependencies>
|
||||
<loadAfter>
|
||||
<li>UnlimitedHugs.HugsLib</li>
|
||||
<li>brrainz.harmony</li>
|
||||
<li>rim.job.world</li>
|
||||
</loadAfter>
|
||||
<description>
|
||||
Rimworld Animations! Hurray!
|
||||
</description>
|
||||
Rimworld Animations! Hurray!
|
||||
|
||||
Questions or bugs?
|
||||
Chat with me on the forums: https://www.loverslab.com/topic/140386-rjw-animations/
|
||||
Or on the rjw discord: https://discord.gg/CXwHhv8
|
||||
|
||||
</description>
|
||||
</ModMetaData>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<Defs>
|
||||
<!--
|
||||
<rjw.AnimationDef>
|
||||
Todo, finalize vanilla template first
|
||||
|
||||
Todo: tell Ed to uncomment start() and end() in jobdrivers
|
||||
|
||||
</rjw.AnimationDef>
|
||||
-->
|
||||
</Defs>
|
|
@ -90,6 +90,7 @@
|
|||
<Compile Include="Source\Patches\HarmonyPatch_Pawn_DrawTracker.cs" />
|
||||
<Compile Include="Source\Patches\HarmonyPatch_ShowHairWithHats.cs" />
|
||||
<Compile Include="Source\Patches\Harmony_PatchAll.cs" />
|
||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_DoLovinAnimationPatch.cs" />
|
||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
|
||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_JoinInBedGiveJob.cs" />
|
||||
<Compile Include="Source\Patches\rjwPatches\HarmonyPatch_SexTick.cs" />
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace Rimworld_Animations {
|
|||
Toil startPartnerSex = new Toil();
|
||||
startPartnerSex.initAction = delegate {
|
||||
|
||||
Log.Message("Attempting to start job...");
|
||||
Job gettinLovedJob = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("GettinLovedAnimation"), pawn, Bed); // new gettin loved toil that wakes up the pawn goes here
|
||||
|
||||
Partner.jobs.jobQueue.EnqueueFirst(gettinLovedJob);
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
using Verse.AI;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(JobGiver_DoLovin), "TryGiveJob")]
|
||||
public static class HarmonyPatch_DoLovinAnimationPatch {
|
||||
|
||||
public static void Postfix(ref Pawn pawn, ref Job __result) {
|
||||
|
||||
if(__result != null) {
|
||||
|
||||
RestUtility.WakeUp(pawn);
|
||||
Pawn partnerInMyBed = LovePartnerRelationUtility.GetPartnerInMyBed(pawn);
|
||||
__result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), partnerInMyBed, partnerInMyBed.CurrentBed());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -107,6 +107,37 @@ namespace Rimworld_Animations {
|
|||
|
||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||
|
||||
//Stolen from vanilla lovin
|
||||
//to make sure vanilla lovin variables are set
|
||||
if(__instance.pawn?.mindState?.canLovinTick != null) {
|
||||
|
||||
SimpleCurve LovinIntervalHoursFromAgeCurve = new SimpleCurve
|
||||
{
|
||||
new CurvePoint(16f, 1.5f),
|
||||
new CurvePoint(22f, 1.5f),
|
||||
new CurvePoint(30f, 4f),
|
||||
new CurvePoint(50f, 12f),
|
||||
new CurvePoint(75f, 36f)
|
||||
};
|
||||
|
||||
int ticksToNextLovin;
|
||||
if (DebugSettings.alwaysDoLovin) {
|
||||
|
||||
ticksToNextLovin = 100;
|
||||
|
||||
} else {
|
||||
|
||||
float centerX = LovinIntervalHoursFromAgeCurve.Evaluate(__instance.pawn.ageTracker.AgeBiologicalYearsFloat);
|
||||
|
||||
centerX = Rand.Gaussian(centerX, 0.3f);
|
||||
if (centerX < 0.5f) {
|
||||
centerX = 0.5f;
|
||||
}
|
||||
ticksToNextLovin = (int)(centerX * 2500f);
|
||||
}
|
||||
__instance.pawn.mindState.canLovinTick = Find.TickManager.TicksGame + ticksToNextLovin;
|
||||
}
|
||||
|
||||
if (__instance.Target.jobs?.curDriver is JobDriver_SexBaseReciever) {
|
||||
if (__instance.pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue